linux下如何实现双网卡绑定,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。

点击(此处)折叠或打开
- Linux下的双网卡绑定 
- 将eth0,eth2绑定为bond0 ,节点内部通信用,使用192.168.1.0网段。 
- 将eth3,eth4绑定为bond1 ,对外服务,使用10.12*.*.0网段。注意将*替换成实际IP地址。 
- 确定可用的网卡 
- ethtool eth0 
- ifup eth0 
- ifdown eth0 
- 操作系统版本为:Red Hat Enterprise Linux AS release 4 (Nahant Update 7) 
- <1> 
- 将eth0,eth2绑定为bond0 
- vi /etc/sysconfig/network-scripts/ifcfg-bond0 
- DEVICE=bond0 
- BOOTPROTO=none 
- ONBOOT=yes 
- TYPE=Ethernet 
- USERCTL=no 
- IPADDR=192.168.1.2 
- NETMASK=255.255.255.0 
- NETWORK=192.168.1.0 
- BROADCAST=192.168.1.255 
- vi /etc/sysconfig/network-scripts/ifcfg-eth0 
- DEVICE=eth0 
- BOOTPROTO=none 
- ONBOOT=yes 
- USERCTL=no 
- MASTER=bond0 
- SLAVE=yes 
- 注:不要有实际网卡的MAC地址。 
- vi /etc/sysconfig/network-scripts/ifcfg-eth2 
- DEVICE=eth2 
- BOOTPROTO=none 
- ONBOOT=yes 
- USERCTL=no 
- MASTER=bond0 
- SLAVE=yes 
- <2> 
- 将eth3,eth4绑定为bond1 
- vi /etc/sysconfig/network-scripts/ifcfg-bond1 
- DEVICE=bond1 
- BOOTPROTO=none 
- ONBOOT=yes 
- TYPE=Ethernet 
- USERCTL=no 
- IPADDR=10.12*.*.61 
- NETMASK=255.255.255.0 
- NETWORK=10.12*.*.0 
- BROADCAST=10.12*.*.255 
- GATEWAY=10.12*.*.254 
- vi /etc/sysconfig/network-scripts/ifcfg-eth3 
- DEVICE=eth3 
- BOOTPROTO=none 
- ONBOOT=yes 
- USERCTL=no 
- MASTER=bond1 
- SLAVE=yes 
- vi /etc/sysconfig/network-scripts/ifcfg-eth4 
- DEVICE=eth4 
- BOOTPROTO=none 
- ONBOOT=yes 
- USERCTL=no 
- MASTER=bond1 
- SLAVE=yes 
- <3> 
- 添加内核模块: 
- vi /etc/modprobe.conf 
- 添加 
- # BONDING 
- install bond0 /sbin/modprobe bonding -o bond0 mode=1 miimon=100 
- install bond1 /sbin/modprobe --ignore-install bonding -o bond1 mode=1 miimon=100 
- note: 
- mode=0 : load balancing (round-robin) 
- mode=1 : fault-tolerance (active-backup) 
- 加入启动项 
- vi /etc/rc.d/rc.local 
- ifenslave bond0 eth0 eth2 
- ifenslave bond1 eth3 eth4 
- 启动网卡 
- ifconfig bond0 192.168.1.2 up 
- ifenslave bond0 eth0 eth2 
- ifconfig bond1 10.12*.*.61 up 
- ifenslave bond1 eth3 eth4 
- 重启网络服务或系统: 
- service network restart 
- 查看绑定网卡工作状况: 
- cat /proc/net/bonding/bond0 
- cat /proc/net/bonding/bond1 
- ************************************************************ 
- linux4.7上,使用如下方式配置,当设置两个或以上bond时,bond网卡的工作模式会有问题,并且第二个bond配置不工作: 
- vi /etc/modprobe.conf 
- 添加 
- # BONDING 
- alias bond1 bonding 
- options bond1 mode=1 miimon=100 
看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注创新互联-成都网站建设公司行业资讯频道,感谢您对创新互联的支持。
分享名称:linux下如何实现双网卡绑定-创新互联
文章分享:http://www.scyingshan.cn/article/degohe.html

 建站
建站
 咨询
咨询 售后
售后
 建站咨询
建站咨询 
 