Linux 系统双网卡绑定配置实现
系统版本
[root@~]#cat/etc/redhat-release CentOSrelease6.8(Final) [root@~]#uname-r 2.6.32-642.6.1.el6.x86_64
网卡说明
eth0 192.168.1.8(服务器外网卡)
eth1
eth2
两块服务器网卡(内网)
关闭防火墙
[root@~]#/etc/init.d/iptablesstop [root@~]#chkconfigiptablesoff
关闭selinux
[root@~]#setenforce0 [root@~]#sed-i‘s/SELINUX=enforcing/SELINUX=disabled/‘/etc/selinux/config
禁用NetworkManager
[root@~]#/etc/init.d/NetworkManagerstop StoppingNetworkManagerdaemon:[OK] [root@~]#chkconfigNetworkManageroff [root@~]#/etc/init.d/networkrestart
编辑eth1网卡
[root@~]#cd/etc/sysconfig/network-scripts/ [root@network-scripts\]#cat>ifcfg-eth1<编辑eth2网卡
[root@network-scripts]#cat>ifcfg-eth2<编辑bind0网卡
[root@network-scripts]#cat>ifcfg-bind0<配置bond参数
[root@network-scripts]#cat>/etc/modprobe.conf<加入开机自启动(/etc/rc.local)
[root@network-scripts]#cat>>/etc/rc.local<重启网络服务
[root@LVS-2network-scripts]#servicenetworkrestart Shuttingdowninterfaceeth0:[OK] Shuttingdowninterfaceeth1:[OK] Shuttingdowninterfaceeth2:[OK] Shuttingdownloopbackinterface:[OK] Bringinguploopbackinterface:[OK] Bringingupinterfacebind0:WARNING:Deprecatedconfigfile/etc/modprobe.conf,allconfigfilesbelonginto/etc/modprobe.d/. WARNING:Deprecatedconfigfile/etc/modprobe.conf,allconfigfilesbelonginto/etc/modprobe.d/. Determiningifipaddress10.0.0.8isalreadyinusefordevicebind0..[OK] Bringingupinterfaceeth0:Determiningifipaddress192.168.1.8isalreadyinusefordeviceeth0...[OK] Bringingupinterfaceeth1:RTNETLINKanswers:Fileexists[OK] Bringingupinterfaceeth2:RTNETLINKanswers:Fileexists[OK]配置使绑定立即生效
[root@LVS-2network-scripts]#ifenslavebind0eth1eth2测试联通
[root@LVS-2network-scripts]#ping10.0.0.8 PING10.0.0.8(10.0.0.8)56(84)bytesofdata. 64bytesfrom10.0.0.8:icmp_seq=1ttl=64time=0.089ms 64bytesfrom10.0.0.8:icmp_seq=2ttl=64time=0.046ms ^C ---10.0.0.8pingstatistics--- 2packetstransmitted,2received,0%packetloss,time1921ms rttmin/avg/max/mdev=0.046/0.067/0.089/0.023ms此时会发现系统多一个网卡
[root@LVS-2network-scripts]#ifconfigbind0 bind0 Linkencap:EthernetHWaddr00:0C:29:CC:9B:5 inetaddr:10.0.0.8Bcast:10.0.0.255Mask:255.255.255.0 inet6addr:fe80::20c:29ff:fecc:9b55/64Scope:LinkUPBROADCASTRUNNINGMASTERMULTICASTMTU:1500Metric:1 RXpackets:151errors:0dropped:0overruns:0frame:0 TXpackets:3errors:0dropped:0overruns:0carrier:0 collisions:0txqueuelen:0 RXbytes:11826(11.5KiB)TXbytes:258(258.0b)到此这篇关于Linux系统双网卡绑定配置实现的文章就介绍到这了,更多相关Linux双网卡绑定配置内容请搜索毛票票以前的文章或继续浏览下面的相关文章希望大家以后多多支持毛票票!