请教各位专家,我的设备现在有两块网卡,eth0参数为IP:37.134.6.1,MAK:255.255.255.128,GW37.134.6.126;eth1参数为IP:37.134.6.129,MAK:255.255.255.128,GW37.134.6.254;对方服务器的IP地址为37.134.0.150。
我现在两个网卡都添加默认路由,或者都添加静态路由,总是只有一个网卡能通,另外一个无法通讯。
请问我该如何配置路由才能实现双网卡同时通讯。以下是两种情况下的路由表信息,请问各位,该如何配置才能好用??
//两个网卡都使用默认路由
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
37.134.6.128 * 255.255.255.128 U 0 0 0 eth1
37.134.6.0 * 255.255.255.128 U 0 0 0 eth0
default 37.134.6.254 0.0.0.0 UG 0 0 0 eth1
default 37.134.6.126 0.0.0.0 UG 0 0 0 eth0
//两个网卡都添加静态路由
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
37.134.6.128 * 255.255.255.128 U 0 0 0 eth1
37.134.6.0 * 255.255.255.128 U 0 0 0 eth0
37.134.0.0 37.134.6.254 255.255.255.0 UG 0 0 0 eth1
37.134.0.0 37.134.6.126 255.255.255.0 UG 0 0 0 eth0
default 172.21.25.1 0.0.0.0 UG 0 0 0 eth2
哪位仁兄若能够帮助解决问题,小弟可私下发个红包,略表心意^_^
配置聚合链路
你可以尝试设置下建立路由表响应来自不同接口的,在做规则使来自不同的口的走不同的路由表,你这个也是有点奇怪,正常的linux机器只支持一条默认的GW,你应该是统一一个GW在做路由转发,就像我下面的命令一样
命令为如下,使用后如果不行则重启网卡去除
ip route add default via 37.134.6.1 dev eth0 table 37
ip rule add from 255.255.255.128 table 37
ip route add default via 37.134.6.129 dev eth0 table 38
ip rule add from37.134.6.254 table 38