bonding in linux
####### bond0 #######
dond0 use dhcp
$cat ifcfg-bond0
DEVICE=bond0
BOOTPROTO=dhcp
ONBOOT=yes
$cat ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
MASTER=bond0
SLAVE=yes
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
MASTER=bond0
SLAVE=yes
####### bond1 #######
$cat ifcfg-bond1
DEVICE=bond1
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.56.101
NETMASK=255.255.255.0
BONDING_OPTS=”mode=1 miimon=80 arp_interval=500 arp_ip_target=192.168.56.1″
$cat ifcfg-eth2
DEVICE=eth2
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
MASTER=bond1
SLAVE=yes
$cat ifcfg-eth3
DEVICE=eth3
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
MASTER=bond1
SLAVE=yes
#######################3
cat /etc/modprobe.conf
add:
alias bond1 bonding
options bond1 miimon=80 mode=1
$modprobe bonding
$sudo /sbin/service network restart
$cat /proc/net/bonding/bond0
$cat /proc/net/bonding/bond1
[root@2hei.net ~]# ifconfig
bond0 Link encap:Ethernet HWaddr 08:00:27:88:8C:E3
inet addr:10.100.10.110 Bcast:10.100.10.255 Mask:255.255.254.0
inet6 addr: fe80::a00:27ff:fe88:8ce3/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:50626 errors:0 dropped:0 overruns:0 frame:0
TX packets:2674 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:4491313 (4.2 MiB) TX bytes:425663 (415.6 KiB)
bond1 Link encap:Ethernet HWaddr 08:00:27:6F:EE:83
inet addr:192.168.56.101 Bcast:192.168.56.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe6f:ee83/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:1980 errors:0 dropped:0 overruns:0 frame:0
TX packets:2064 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:124007 (121.1 KiB) TX bytes:111090 (108.4 KiB)
eth0 Link encap:Ethernet HWaddr 08:00:27:88:8C:E3
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:26130 errors:0 dropped:0 overruns:0 frame:0
TX packets:2405 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2316248 (2.2 MiB) TX bytes:386534 (377.4 KiB)
eth1 Link encap:Ethernet HWaddr 08:00:27:88:8C:E3
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:24505 errors:0 dropped:0 overruns:0 frame:0
TX packets:289 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2175605 (2.0 MiB) TX bytes:42289 (41.2 KiB)
eth2 Link encap:Ethernet HWaddr 08:00:27:6F:EE:83
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:1980 errors:0 dropped:0 overruns:0 frame:0
TX packets:2032 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:124007 (121.1 KiB) TX bytes:105295 (102.8 KiB)
eth3 Link encap:Ethernet HWaddr 08:00:27:6F:EE:83
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:32 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:5795 (5.6 KiB)
[root@2hei.net ~]# mii-tool
eth0: no autonegotiation, 100baseTx-FD, link ok
eth1: no autonegotiation, 100baseTx-FD, link ok
eth2: no autonegotiation, 100baseTx-FD, link ok
eth3: no autonegotiation, 100baseTx-FD, link ok
[root@2hei.net ~]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.4.0 (October 7, 2008)
Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 0
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: 08:00:27:88:8c:e3
Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: 08:00:27:2d:3d:56
[root@2hei.net ~]# cat /proc/net/bonding/bond1
Ethernet Channel Bonding Driver: v3.4.0 (October 7, 2008)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth2
MII Status: up
MII Polling Interval (ms): 0
Up Delay (ms): 0
Down Delay (ms): 0
ARP Polling Interval (ms): 500
ARP IP target/s (n.n.n.n form): 192.168.56.1
Slave Interface: eth2
MII Status: up
Link Failure Count: 0
Permanent HW addr: 08:00:27:6f:ee:83
Slave Interface: eth3
MII Status: down
Link Failure Count: 1
Permanent HW addr: 08:00:27:9c:5a:b8
本文固定链接: https://www.2hei.net/2011/02/18/bonding_in_linux/ | 2hei.net
最活跃的读者