双网卡bond

查看:
cat /boot/config-<tab>|grep -i bonding
有CONFIG_BONDING=m 表示支持
有些网卡也可能不支持bonding。
使用ethtool -i eth0查看网卡使用什么驱动
 
错误:bringing up interface bond0: error:connection activation failed: the connection is not for this device
 
1. Remove Network Manager from startup Services.
#chkconfig NetworkManager off
 
2. Add Default Net Manager
#chkconfig network on
 
3.Stop NetworkManager first
#service NetworkManager stop
 
4.and then start Default Manager
#service network start
5./etc/init.d/network restart
 
配置:
[root@ceshi network-scripts]# more ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
[root@ceshi network-scripts]# more ifcfg-eth1
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
[root@ceshi network-scripts]# more ifcfg-bond0
DEVICE=bond0
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
BROADCAST=192.168.1.255
IPADDR=192.168.1.53
GATEWAY=192.168.1.1
NETMASK=255.255.255.0
NETWORK=192.168.1.0
DNS1=8.8.8.8
USERCTL=no
创建/etc/modprobe.conf 配置文件,并添加
[root@ceshi network-scripts]# more /etc/modprobe.conf
alias bond0 bonding
options bond0 miimon=100 mode=1
注解:
(1)、miimon 是链路监测的时间间隔单位是毫秒,miimon=100的意思就是,每100毫秒检测网卡和交换机之间是否连通, 如不通则使用另外的链路。 
(2)、mode=0 表示负载均衡方式,两块网卡都工作,需要交换机作支持。 
          mode=1 表示冗余方式,网卡只有一个工作,一个出问题启用另外的。 
          mode=6 表示负载均衡方式,两块网卡都工作,不需要交换机作支持。
 
然后重启网卡 <>_<>
 
查看网卡
[root@ceshi network-scripts]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP qlen 1000
link/ether 00:25:90:69:2a:f0 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP qlen 1000
link/ether 00:25:90:69:2a:f0 brd ff:ff:ff:ff:ff:ff
4: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
link/ether 00:25:90:69:2a:f0 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.53/24 brd 192.168.1.255 scope global bond0
inet6 fe80::225:90ff:fe69:2af0/64 scope link
valid_lft forever preferred_lft forever
You have new mail in /var/spool/mail/root
 
查看bond0的工作状态
[root@ceshi network-scripts]# more /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)
 
Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
 
Slave Interface: eth0
MII Status: up
Speed: 100 Mbps
Duplex: full
Link Failure Count: 4
Permanent HW addr: 00:25:90:69:2a:f0
Slave queue ID: 0
 
Slave Interface: eth1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 2
Permanent HW addr: 00:25:90:69:2a:f1
Slave queue ID: 0
 
 

原文地址:https://www.cnblogs.com/liuqiang0/p/15761567.html