#vi /etc/modprobe.conf
添加:
alias bond0 bonding
options bond0 miimon=100 mode=1
(mode=0 表示load blance 简称AA模式;mode=1 表示热备,简称AB模式)注:millmon是用来进行链路监测的,millmon=100,表示每100ms监测一次链路连接状态,
如果有一条不通,就转入另一条,这个值建议为100, 设成其它值可能导致不稳定)
cd /etc/sysconfig/network-scripts/
cp ifcfg-eth0 ifcfg-bond0
vi ifcfg-bond0
DEVICE=bond0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.0.12
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
USERCTL=no
#vi ifcfg-eth0
DEVICE=eth0
USERCTL=no
ONBOOT=yes
MASTER=bond0 //这两行主要是用于系统service network restart
SLAVE=yes //后自动启用
BOOTPROTO=none
HWADDR=XXXXXXXXXXXXXX (本网卡的MAC,可加可不加)
#cp ifcfg-eth0 ifcfg-eth1
#vi ifcfg-eth1
DEVICE=eth1
USERCTL=no
ONBOOT=yes
MASTER=bond0 //这两行主要是用于系统service network restart
SLAVE=yes //后自动启用
BOOTPROTO=none
HWADDR=XXXXXXXXXXXXXX (本网卡的MAC,可加可不加)
或者 cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.1.2 (January 20, 2007)
Primary Slave: None
Currently Active Slave: eth1
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
MII Status: down
Link Failure Count: 0
Permanent HW addr: 00:14:5e:fc:16:78
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:14:5e:fc:16:7a
ONBOOT=yes
BOOTPROTO=static
NETWORK=172.16.174.0
NETMASK=255.255.255.0
IPADDR=172.16.174.11
GATEWAY=172.16.174.254
USERCTL=no
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=static
NETWORK=172.16.175.0
NETMASK=255.255.255.0
IPADDR=172.16.175.11
GATEWAY=172.16.175.254
USERCTL=no
TYPE=Ethernet
alias scsi_hostadapter usb-storage
alias eth0 bnx2
alias eth1 bnx2
alias eth2 e1000
alias eth3 e1000e
alias scsi_hostadapter1 qla2xxx_conf
alias scsi_hostadapter2 qla2xxx
alias scsi_hostadapter2 cciss
alias scsi_hostadapter3 ata_piix
alias usb-controller uhci-hcd
alias usb-controller1 ehci-hcd
alias bond0 bonding
options bonding mode=1 miimon=100 updelay=100 max_bonds=2 (做两个bond时此处设为2)
alias bond1 bonding
[root@addrdb02 ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
BOOTPROTO=none
ONBOOT=yes
NETWORK=172.16.174.0
NETMASK=255.255.255.0
IPADDR=172.16.174.11
GATEWAY=172.16.174.254
USERCTL=no
TYPE=Ethernet
DEVICE=bond0
BOOTPROTO=none
ONBOOT=yes
NETWORK=172.16.175.0
NETMASK=255.255.255.0
IPADDR=172.16.175.11
USERCTL=no
TYPE=Ethernet
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
USERCTL=no
HWADDR=XXXXXXXXXXXXXX (本网卡的MAC,可加可不加)
TYPE=Ethernet
[root@addrdb02 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
USERCTL=no
HWADDR=XXXXXXXXXXXXXX (本网卡的MAC,可加可不加)
TYPE=Ethernet
DEVICE=eth2
ONBOOT=yes
BOOTPROTO=none
MASTER=bond1
SLAVE=yes
USERCTL=no
HWADDR=XXXXXXXXXXXXXX (本网卡的MAC,可加可不加)
TYPE=Ethernet
[root@addrdb02 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth3
DEVICE=eth3
ONBOOT=yes
BOOTPROTO=none
MASTER=bond1
SLAVE=yes
USERCTL=no
HWADDR=XXXXXXXXXXXXXX (本网卡的MAC,可加可不加)
TYPE=Ethernet