0

我有一台 linux 机器,我将其用作具有多接口和多 Internet 连接的路由器,例如 eth0--isp1

eth1--isp2

eth2--isp3

网关是eth0 throw isp1

和 eth3--local1 10.0.0.x

eth4--local2 192.168.1.x

我需要 local1 ip 192.168.1.10 去抛出 isp3,eth2

谢谢

4

2 回答 2

0

尝试route add 192.168.1.0 netmask 255.255.255.0 dev eth4--local,假设这些是本地连接的网络。如果没有,您还需要指定一个网关机器来路由数据包。老实说,您的问题格式不正确(并且可能属于服务器故障)。如果您已经在这些网络上拥有地址,则这些路由应该已经存在。如果你不这样做,你的问题可能比你想象的要复杂。

于 2012-09-04T18:30:58.030 回答
0

您需要为此使用策略路由。您创建一个新的路由表并在源 IP 为 192.168.1.10 时使用它。

ip route add ... table $TABLENUM                  # your usual routes, for the new table
...
ip route add default via $ISP3 table $TABLENUM    # gateway for the new table
ip rule add from 192.168.1.10/32 lookup $TABLENUM # use the new table for this IP
ip rule add to 192.168.1.10/32 lookup $TABLENUM   # make it symmetric, for clarity
于 2012-09-04T21:29:07.963 回答