2012-09-04 37 views
0

我必须使用与multible接口和multible互联网连接 路由器荫一台Linux机器说的eth0 - ISP1Linux的具体路线机流量掷特定输出接口

eth1--isp2 

eth2--isp3 

网关是eth0的罚球ISP1

和ETH3 - LOCAL1 10.0.0.X

eth4--local2 192.168.1.x 

我需要LOCAL1 IP 192.168.1.10去扔ISP3,ETH2

谢谢

回答

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 
+0

这是真的,但你首先需要通过修改配置文件 的/ etc/iproute2的/ rt_tables创建表 – EngEhaB

0

尝试route add 192.168.1.0 netmask 255.255.255.0 dev eth4--local,假设这些是本地连接的网络。如果没有,你需要指定一个网关机器来路由数据包。实际上你的问题是畸形的(可能属于serverfault)。如果您在这些网络上已经有地址,则这些路由应该已经存在。如果你不这样做,你的问题可能比你想象的更复杂。