LINUX BONDING测试
MODE=0 2
1、相关配置信息: 2
2、MODE=0测试结论: 5
MOD=6 7
1、相关配置: 7
2、MODE=6测试结论: 10
LINUX BONDING测试
MODE=0
1、相关配置信息:
SRV:
[root@srv1 ~]# modprobe bonding miimon=100 mode=0
[root@srv1 ~]# ifconfig bond0 202.100.1.2 netmask 255.255.255.0 up
ifenslave bond0 eth0 eth1[root@srv1 ~]# ifenslave bond0 eth0 eth1
[root@srv1 ~]#
[root@srv1 ~]#
[root@srv1 ~]#
[root@srv1 ~]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.0.3 (March 23, 2006)
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
Link Failure Count: 0
Permanent HW addr: 00:08:c7:85:1f:49
Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:08:c7:59:79:c5
[root@srv1 ~]# ifconfig -a
bond0 Link encap:Ethernet HWaddr 00:08:C7:85:1F:49
inet addr:202.100.1.2 Bcast:202.100.1.255 Mask:255.255.255.0
inet6 addr: fe80::208:c7ff:fe85:1f49/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:778 errors:0 dropped:0 overruns:0 frame:0
TX packets:1155 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:67624 (66.0 KiB) TX bytes:89956 (87.8 KiB)
eth0 Link encap:Ethernet HWaddr 00:08:C7:85:1F:49
inet6 addr: fe80::208:c7ff:fe85:1f49/64 Scope:Link
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:425 errors:0 dropped:0 overruns:0 frame:0
TX packets:660 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:37868 (36.9 KiB) TX bytes:52328 (51.1 KiB)
eth1 Link encap:Ethernet HWaddr 00:08:C7:85:1F:49
inet6 addr: fe80::208:c7ff:fe85:1f49/64 Scope:Link
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:353 errors:0 dropped:0 overruns:0 frame:0
TX packets:495 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:29756 (29.0 KiB) TX bytes:37628 (36.7 KiB)
eth2 Link encap:Ethernet HWaddr 00:E0:4C:E2:9D:03
inet addr:172.25.149.253 Bcast:172.25.149.255 Mask:255.255.255.0
inet6 addr: fe80::2e0:4cff:fee2:9d03/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:10888 errors:0 dropped:0 overruns:0 frame:0
TX packets:9139 errors:0 dropped:0 overruns:0 carrier:0
collisions:1238 txqueuelen:1000
RX bytes:1206863 (1.1 MiB) TX bytes:1363435 (1.3 MiB)
Interrupt:11 Base address:0xa000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:23 errors:0 dropped:0 overruns:0 frame:0
TX packets:23 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2464 (2.4 KiB) TX bytes:2464 (2.4 KiB)
sit0 Link encap:IPv6-in-IPv4
NOARP MTU:1480 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:9.9.8.254 P-t-P:9.9.8.253 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1400 Metric:1
RX packets:5018 errors:0 dropped:0 overruns:0 frame:0
TX packets:5670 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:288993 (282.2 KiB) TX bytes:663879 (648.3 KiB)
[root@srv1 ~]#
交换机:
[S3108]dis version
H3C Comware Platform Software
Comware Software, Version 3.10, Release 2108P01
Copyright (c) 2004-2008 Hangzhou H3C Technologies Co., Ltd. All rights reserved.
H3C S3100-8C-SI uptime is 0 week, 0 day, 0 hour, 16 minutes
H3C S3100-8C-SI with 1 Processor
64M bytes SDRAM
8M bytes Flash Memory
Config Register points to FLASH
Hardware Version is REV.C
Bootrom Version is 553
[Subslot 0] 8FE Hardware Version is REV.C
[Subslot 1] 1GE Hardware Version is REV.A
[S3108]dis cu
[S3108]dis current-configuration
#
sysname S3108
#
link-aggregation group 1 mode manual
#
radius scheme system
#
domain system
#
vlan 1
#
interface Aux1/0/0
#
interface Ethernet1/0/1
#
interface Ethernet1/0/2
#
interface Ethernet1/0/3
#
interface Ethernet1/0/4
#
interface Ethernet1/0/5
#
interface Ethernet1/0/6
#
interface Ethernet1/0/7
duplex full
speed 100
port link-aggregation group 1
#
interface Ethernet1/0/8
duplex full
speed 100
port link-aggregation group 1
#
interface GigabitEthernet1/1/1
#
interface NULL0
#
user-interface aux 0
idle-timeout 0 0
user-interface vty 0 4
#
return
[S3108]
2、MODE=0测试结论:
如果交换机未配置链路聚合则会发生MAC动荡的情况,在配置了链路聚合后不会出现,SRV发出数据包的MAC为Bond0的MAC,相关信息如下:
SRV:
[root@srv1 ~]# ping 202.100.1.1
PING 202.100.1.1 (202.100.1.1) 56(84) bytes of data.
64 bytes from 202.100.1.1: icmp_seq=1 ttl=255 time=2.51 ms
64 bytes from 202.100.1.1: icmp_seq=2 ttl=255 time=1.39 ms
64 bytes from 202.100.1.1: icmp_seq=3 ttl=255 time=1.37 ms
64 bytes from 202.100.1.1: icmp_seq=4 ttl=255 time=1.37 ms
64 bytes from 202.100.1.1: icmp_seq=5 ttl=255 time=1.36 ms
64 bytes from 202.100.1.1: icmp_seq=6 ttl=255 time=1.33 ms
64 bytes from 202.100.1.1: icmp_seq=7 ttl=255 time=1.34 ms
64 bytes from 202.100.1.1: icmp_seq=8 ttl=255 time=1.32 ms
64 bytes from 202.100.1.1: icmp_seq=9 ttl=255 time=1.30 ms
64 bytes from 202.100.1.1: icmp_seq=10 ttl=255 time=1.30 ms
64 bytes from 202.100.1.1: icmp_seq=11 ttl=255 time=1.28 ms
64 bytes from 202.100.1.1: icmp_seq=12 ttl=255 time=1.27 ms
64 bytes from 202.100.1.1: icmp_seq=13 ttl=255 time=1.26 ms
64 bytes from 202.100.1.1: icmp_seq=14 ttl=255 time=1.25 ms
64 bytes from 202.100.1.1: icmp_seq=15 ttl=255 time=1.24 ms
交换机:
[S3108-Ethernet1/0/7]dis mac-address
MAC ADDR VLAN ID STATE PORT INDEX AGING TIME(s)
0008-c785-1f49 1 Learned Ethernet1/0/7 AGING
000f-e25c-a135 1 Learned Ethernet1/0/1 AGING
000f-e211-705c 1 Learned Ethernet1/0/1 AGING
--- 3 mac address(es) found ---
[S3108-Ethernet1/0/7]dis mac-address
MAC ADDR VLAN ID STATE PORT INDEX AGING TIME(s)
0008-c785-1f49 1 Learned Ethernet1/0/7 AGING
000f-e25c-a135 1 Learned Ethernet1/0/1 AGING
000f-e211-705c 1 Learned Ethernet1/0/1 AGING
--- 3 mac address(es) found ---
[S3108-Ethernet1/0/7]dis mac-address
MAC ADDR VLAN ID STATE PORT INDEX AGING TIME(s)
0008-c785-1f49 1 Learned Ethernet1/0/7 AGING
000f-e25c-a135 1 Learned Ethernet1/0/1 AGING
000f-e211-705c 1 Learned Ethernet1/0/1 AGING
--- 3 mac address(es) found ---
[S3108-Ethernet1/0/7]dis mac-address
MAC ADDR VLAN ID STATE PORT INDEX AGING TIME(s)
0008-c785-1f49 1 Learned Ethernet1/0/7 AGING
000f-e25c-a135 1 Learned Ethernet1/0/1 AGING
000f-e211-705c 1 Learned Ethernet1/0/1 AGING
--- 3 mac address(es) found ---
[S3108-Ethernet1/0/7]dis mac-address
MAC ADDR VLAN ID STATE PORT INDEX AGING TIME(s)
0008-c785-1f49 1 Learned Ethernet1/0/7 AGING
000f-e25c-a135 1 Learned Ethernet1/0/1 AGING
000f-e211-705c 1 Learned Ethernet1/0/1 AGING
--- 3 mac address(es) found ---
[S3108-Ethernet1/0/7]dis mac-address
MAC ADDR VLAN ID STATE PORT INDEX AGING TIME(s)
0008-c785-1f49 1 Learned Ethernet1/0/7 AGING
000f-e25c-a135 1 Learned Ethernet1/0/1 AGING
000f-e211-705c 1 Learned Ethernet1/0/1 AGING
--- 3 mac address(es) found ---
[S3108-Ethernet1/0/7]
MOD=6
1、相关配置:
SRV:
[root@srv1 ~]# modprobe bonding miimon=100 mode=6
[root@srv1 ~]# ifconfig bond0 202.100.1.2 netmask 255.255.255.0 up
ifenslave bond0 eth0 eth1[root@srv1 ~]# ifenslave bond0 eth0 eth1
[root@srv1 ~]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.0.3 (March 23, 2006)
Bonding Mode: adaptive load balancing
Primary Slave: None
Currently Active Slave: eth0
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:08:c7:85:1f:49
Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:08:c7:59:79:c5
[root@srv1 ~]# ifconfig -a
bond0 Link encap:Ethernet HWaddr 00:08:C7:85:1F:49
inet addr:202.100.1.2 Bcast:202.100.1.255 Mask:255.255.255.0
inet6 addr: fe80::208:c7ff:fe85:1f49/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:823 errors:0 dropped:0 overruns:0 frame:0
TX packets:1260 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:71380 (69.7 KiB) TX bytes:97196 (94.9 KiB)
eth0 Link encap:Ethernet HWaddr 00:08:C7:85:1F:49
inet6 addr: fe80::208:c7ff:fe85:1f49/64 Scope:Link
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:452 errors:0 dropped:0 overruns:0 frame:0
TX packets:715 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:40476 (39.5 KiB) TX bytes:56118 (54.8 KiB)
eth1 Link encap:Ethernet HWaddr 00:08:C7:59:79:C5
inet6 addr: fe80::208:c7ff:fe59:79c5/64 Scope:Link
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:371 errors:0 dropped:0 overruns:0 frame:0
TX packets:545 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:30904 (30.1 KiB) TX bytes:41078 (40.1 KiB)
eth2 Link encap:Ethernet HWaddr 00:E0:4C:E2:9D:03
inet addr:172.25.149.253 Bcast:172.25.149.255 Mask:255.255.255.0
inet6 addr: fe80::2e0:4cff:fee2:9d03/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:12852 errors:0 dropped:0 overruns:0 frame:0
TX packets:10997 errors:0 dropped:0 overruns:0 carrier:0
collisions:1266 txqueuelen:1000
RX bytes:1398886 (1.3 MiB) TX bytes:1582750 (1.5 MiB)
Interrupt:11 Base address:0xa000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:39 errors:0 dropped:0 overruns:0 frame:0
TX packets:39 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:4200 (4.1 KiB) TX bytes:4200 (4.1 KiB)
sit0 Link encap:IPv6-in-IPv4
NOARP MTU:1480 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:9.9.8.254 P-t-P:9.9.8.253 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1400 Metric:1
RX packets:5939 errors:0 dropped:0 overruns:0 frame:0
TX packets:6745 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:335429 (327.5 KiB) TX bytes:747911 (730.3 KiB)
[root@srv1 ~]#
交换机:
[S3108]dis current-configuration
#
sysname S3108
#
radius scheme system
#
domain system
#
vlan 1
#
interface Aux1/0/0
#
interface Ethernet1/0/1
#
interface Ethernet1/0/2
#
interface Ethernet1/0/3
#
interface Ethernet1/0/4
#
interface Ethernet1/0/5
#
interface Ethernet1/0/6
#
interface Ethernet1/0/7
duplex full
speed 100
#
interface Ethernet1/0/8
duplex full
speed 100
#
interface GigabitEthernet1/1/1
#
interface NULL0
#
user-interface aux 0
idle-timeout 0 0
user-interface vty 0 4
#
return
[S3108]
2、MODE=6测试结论:
此时交换机无需特殊配置,即可实现负载均衡。2个网卡发出的包使用的是各自的MAC,因此也不会造成交换机MAC地址表的动荡。相关结果如下:
SRV:
[root@srv1 ~]# ping -c 5 202.100.1.1
PING 202.100.1.1 (202.100.1.1) 56(84) bytes of data.
64 bytes from 202.100.1.1: icmp_seq=1 ttl=255 time=2.58 ms
64 bytes from 202.100.1.1: icmp_seq=2 ttl=255 time=1.49 ms
64 bytes from 202.100.1.1: icmp_seq=3 ttl=255 time=1.47 ms
64 bytes from 202.100.1.1: icmp_seq=4 ttl=255 time=1.47 ms
64 bytes from 202.100.1.1: icmp_seq=5 ttl=255 time=1.46 ms
--- 202.100.1.1 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4000ms
rtt min/avg/max/mdev = 1.462/1.699/2.585/0.443 ms
[root@srv1 ~]# ping -c 5 202.100.1.11
PING 202.100.1.11 (202.100.1.11) 56(84) bytes of data.
64 bytes from 202.100.1.11: icmp_seq=1 ttl=255 time=4.46 ms
64 bytes from 202.100.1.11: icmp_seq=2 ttl=255 time=0.761 ms
64 bytes from 202.100.1.11: icmp_seq=3 ttl=255 time=0.766 ms
64 bytes from 202.100.1.11: icmp_seq=4 ttl=255 time=0.767 ms
64 bytes from 202.100.1.11: icmp_seq=5 ttl=255 time=0.763 ms
--- 202.100.1.11 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 3999ms
rtt min/avg/max/mdev = 0.761/1.504/4.466/1.481 ms
[root@srv1 ~]#
交换机:
[S3108]dis mac-address
MAC ADDR VLAN ID STATE PORT INDEX AGING TIME(s)
0008-c785-1f49 1 Learned Ethernet1/0/8 AGING
000f-e25c-a135 1 Learned Ethernet1/0/1 AGING
000f-e211-705c 1 Learned Ethernet1/0/1 AGING
0008-c759-79c5 1 Learned Ethernet1/0/7 AGING
--- 4 mac address(es) found ---
[S3108]