linux下多网卡配置同网段IP的问题以及解决方法
linux下多网卡配置同网段IP的问题以及解决方法在一台linux上安装了双网卡,并分别配置了同网段的两个IP, 两块网卡分别连接了网线接到同一个交换机上.问题:1. 从其他内网机器ping两个IP都通,但是arp -a两个IP都是eth0的mac 2. 默认路由是走其中某一块网卡,如果两个内网IP分别做1to1 NAT, 则不是默认路由的那块网卡外网IP不通。
·
linux下多网卡配置同网段IP的问题以及解决方法
在一台linux上安装了双网卡,并分别配置了同网段的两个IP, 两块网卡分别连接了网线接到同一个交换机上.
问题:
1. 从其他内网机器ping两个IP都通,但是arp -a两个IP都是eth0的mac
2. 默认路由是走其中某一块网卡,如果两个内网IP分别做1to1 NAT, 则不是默认路由的那块网卡外网IP不通。
解决方法: 把2块网卡分到2个不同的路由表中如下。 或者把两块网卡集束为一块网卡使用。
My MC:
eth0: 10.110.6.79
eth1: 10.110.6.81
Netmask: 255.255.255.0
gateway: 10.110.6.1
Please run the following four commands to adjust the route table of MC:
[root@Controller ~]# echo "210 eth0table" >> /etc/iproute2/rt_tables
[root@Controller ~]# echo "220 eth1table" >> /etc/iproute2/rt_tables
[root@Controller ~]# cat <<EOL >> /etc/rc.local
ip route add 10.110.6.0/24 dev eth0 src 10.110.6.79 table eth0table
ip route add 10.110.6.0/24 dev eth1 src 10.110.6.81 table eth1table
ip route add default dev eth0 via 10.110.6.1 table eth0table
ip route add default dev eth1 via 10.110.6.1 table eth1table
ip rule add from 10.110.6.79 table eth0table
ip rule add from 10.110.6.81 table eth1table
EOL
[root@Controller ~]# reboot
Ref:
http://bbs.chinaunix.net/forum.php?mod=viewthread&tid=1622182&page=1
http://bbs.chinaunix.net/thread-2128565-1-1.html
http://www.cnblogs.com/zelos/archive/2012/02/12/2348023.html
http://blog.chinaunix.net/uid-21977330-id-3745750.html
http://www.jb51.net/LINUXjishu/34042.html
http://blog.sina.com.cn/s/blog_602f87700102uzpb.html
在一台linux上安装了双网卡,并分别配置了同网段的两个IP, 两块网卡分别连接了网线接到同一个交换机上.
问题:
1. 从其他内网机器ping两个IP都通,但是arp -a两个IP都是eth0的mac
2. 默认路由是走其中某一块网卡,如果两个内网IP分别做1to1 NAT, 则不是默认路由的那块网卡外网IP不通。
解决方法: 把2块网卡分到2个不同的路由表中如下。 或者把两块网卡集束为一块网卡使用。
My MC:
eth0: 10.110.6.79
eth1: 10.110.6.81
Netmask: 255.255.255.0
gateway: 10.110.6.1
Please run the following four commands to adjust the route table of MC:
[root@Controller ~]# echo "210 eth0table" >> /etc/iproute2/rt_tables
[root@Controller ~]# echo "220 eth1table" >> /etc/iproute2/rt_tables
[root@Controller ~]# cat <<EOL >> /etc/rc.local
ip route add 10.110.6.0/24 dev eth0 src 10.110.6.79 table eth0table
ip route add 10.110.6.0/24 dev eth1 src 10.110.6.81 table eth1table
ip route add default dev eth0 via 10.110.6.1 table eth0table
ip route add default dev eth1 via 10.110.6.1 table eth1table
ip rule add from 10.110.6.79 table eth0table
ip rule add from 10.110.6.81 table eth1table
EOL
[root@Controller ~]# reboot
Ref:
http://bbs.chinaunix.net/forum.php?mod=viewthread&tid=1622182&page=1
http://bbs.chinaunix.net/thread-2128565-1-1.html
http://www.cnblogs.com/zelos/archive/2012/02/12/2348023.html
http://blog.chinaunix.net/uid-21977330-id-3745750.html
http://www.jb51.net/LINUXjishu/34042.html
http://blog.sina.com.cn/s/blog_602f87700102uzpb.html
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐

所有评论(0)