centos设置双网卡绑定band0
1、执行setup命令-->网络配置-->本例中四块网卡。
2、ifconfig列出四块网卡。
3、我们的目标,绑定eth0和eth1两块网卡作为公网网卡,ip设置为192.168.0.51
4、首先备份两块网卡的配置文件
Mv/etc/sysconfig/network-scripts/ifcfg-eth0/etc/sysconfig/bak_network-scripts/ifcfg-eth0_bak
Mv /etc/sysconfig/network-scripts/ifcfg-eth1 /etc/sysconfig/bak_network-scripts/ifcfg-eth1_bak
5、重新创建ifcfg-eth0网卡配置文件
vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
USERCTL=no
ONBOOT=yes
SLAVE=yes
MASTER=bond0
BOOTPROTO=none
6、重建eth1网卡配置文件
vi /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
USERCTL=no
ONBOOT=yes
SLAVE=yes
MASTER=bond0
BOOTPROTO=none
7、创建bond0虚拟网卡配置文件
Vi /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
IPADDR=192.168.0.51
NETMASK=255.255.255.0
USERCTL=no
BOOTPROTO=none
ONBOOT=yes
GATEWAY=192.168.0.1
IPV6INIT=no
TYPE=Ethernet
#DNS1=192.168.0.1
8、修改配置文件/etc/modprobe.d/dist.conf
vi dist.conf
最后新增如下两行:
alias bond0 bonding
options bond0 miimon=100 mode=0
mode=0表示做负载均衡9、加载bond0模块[plain]view plaincopy[root@rac1modprobe.d]#modprobebonding
[root@rac1modprobe.d]#lsmod|grepbond
bonding1273310
8021q253171bonding
ipv632142230bonding,ip6t_REJECT,nf_conntrack_ipv6,nf_defrag_ipv610、重启网络服务service network stop11、最好也重启下sshd服务service sshd restart12、查看bond0状态:[plain]view plaincopy[root@rac1network-scripts]#cat/proc/net/bonding/bond0
EthernetChannelBondingDriver:v3.6.0(September26,2009)
BondingMode:loadbalancing(round-robin)
MIIStatus:up
MIIPollingInterval(ms):0
UpDelay(ms):0
DownDelay(ms):0
SlaveInterface:eth0
MIIStatus:up
Speed:1000Mbps
Duplex:full
LinkFailureCount:0
PermanentHWaddr:08:00:27:fc:7e:5b
SlavequeueID:0
SlaveInterface:eth1
MIIStatus:up
Speed:1000Mbps
Duplex:full
LinkFailureCount:0
PermanentHWaddr:08:00:27:6f:e3:9d
SlavequeueID:0
[root@rac1network-scripts]#
13、查看ifconfig[plain]view plaincopy[root@rac1network-scripts]#ifconfig
bond0Linkencap:EthernetHWaddr08:00:27:FC:7E:5B
inetaddr:192.168.0.51Bcast:192.168.0.255Mask:255.255.255.0
inet6addr:fe80::a00:27ff:fefc:7e5b/64Scope:Link
UPBROADCASTRUNNINGMASTERMULTICASTMTU:1500Metric:1
RXpackets:4135errors:0dropped:0overruns:0frame:0
TXpackets:2025errors:0dropped:0overruns:0carrier:0
collisions:0txqueuelen:0
RXbytes:375692(366.8KiB)TXbytes:261792(255.6KiB)
eth0Linkencap:EthernetHWaddr08:00:27:FC:7E:5B
UPBROADCASTRUNNINGSLAVEMULTICASTMTU:1500Metric:1
RXpackets:3394errors:0dropped:0overruns:0frame:0
TXpackets:1640errors:0dropped:0overruns:0carrier:0
collisions:0txqueuelen:1000
RXbytes:304735(297.5KiB)TXbytes:219122(213.9KiB)
eth1Linkencap:EthernetHWaddr08:00:27:FC:7E:5B
UPBROADCASTRUNNINGSLAVEMULTICASTMTU:1500Metric:1
RXpackets:742errors:0dropped:0overruns:0frame:0
TXpackets:387errors:0dropped:0overruns:0carrier:0
collisions:0txqueuelen:1000
RXbytes:71017(69.3KiB)TXbytes:43378(42.3KiB)
eth2Linkencap:EthernetHWaddr08:00:27:18:29:48
inetaddr:192.168.0.7Bcast:192.168.0.255Mask:255.255.255.0
inet6addr:fe80::a00:27ff:fe18:2948/64Scope:Link
UPBROADCASTRUNNINGMULTICASTMTU:1500Metric:1
RXpackets:862errors:0dropped:0overruns:0frame:0
TXpackets:113errors:0dropped:0overruns:0carrier:0
collisions:0txqueuelen:1000
RXbytes:77480(75.6KiB)TXbytes:12978(12.6KiB)
eth3Linkencap:EthernetHWaddr08:00:27:59:1E:79
inetaddr:192.168.0.99Bcast:192.168.0.255Mask:255.255.255.0
inet6addr:fe80::a00:27ff:fe59:1e79/64Scope:Link
UPBROADCASTRUNNINGMULTICASTMTU:1500Metric:1
RXpackets:768errors:0dropped:0overruns:0frame:0
TXpackets:42errors:0dropped:0overruns:0carrier:0
collisions:0txqueuelen:1000
RXbytes:73511(71.7KiB)TXbytes:2732(2.6KiB)
loLinkencap:LocalLoopback
inetaddr:127.0.0.1Mask:255.0.0.0
inet6addr:::1/128Scope:Host
UPLOOPBACKRUNNINGMTU:16436Metric:1
RXpackets:8errors:0dropped:0overruns:0frame:0
TXpackets:8errors:0dropped:0overruns:0carrier:0
collisions:0txqueuelen:0
RXbytes:728(728.0b)TXbytes:728(728.0b)
[root@rac1network-scripts]#注意eth0和eth1是不应该有ip显示的。14、ok
http://www.dengb.com/Linuxjc/1232680.htmlwww.dengb.comtruehttp://www.dengb.com/Linuxjc/1232680.htmlTechArticlecentos设置双网卡绑定band0 1、执行setup命令--网络配置--本例中四块网卡。 2、ifconfig列出四块网卡。 3、我们的目标,绑定eth0和eth1两块网卡作...