Linux双网卡邦定技术有两个方面的好处:一是可以增加服务器的可靠性,二是增加了可用网络带宽,为用户提供不间断的关键服务。上面一篇我们说了具体的做法,这里我进行一下具体的说明。
说明
miimon是用来进行链路监测的。 比如:miimon=100,那么系统每100ms监测一次链路连接状态,如果
有一条线路不通就转入另一条线路
下面我们讨论以下mode分别为0,1时的情况
mode=1工作在主备模式下,这时eth1作为备份网卡是no arp的
[root@rhas-13 network-scripts]# ifconfig 验证网卡的配置信息
bond0 Link encap:Ethernet HWaddr 00:0E:7F:25:D9:8B
inet addr:172.31.0.13 Bcast:172.31.3.255 Mask:255.255.252.0
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:18495 errors:0 dropped:0 overruns:0 frame:0
TX packets:480 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1587253 (1.5 Mb) TX bytes:89642 (87.5 Kb)
eth0 Link encap:Ethernet HWaddr 00:0E:7F:25:D9:8B
inet addr:172.31.0.13 Bcast:172.31.3.255 Mask:255.255.252.0
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:9572 errors:0 dropped:0 overruns:0 frame:0
TX packets:480 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:833514 (813.9 Kb) TX bytes:89642 (87.5 Kb)
Interrupt:11
eth1 Link encap:Ethernet HWaddr 00:0E:7F:25:D9:8B
inet addr:172.31.0.13 Bcast:172.31.3.255 Mask:255.255.252.0
UP BROADCAST RUNNING NOARP SLAVE MULTICAST MTU:1500 Metric:1
RX packets:8923 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:753739 (736.0 Kb) TX bytes:0 (0.0 b)
Interrupt:15
那也就是说在主备模式下,当一个网络接口失效时(例如主交换机掉电等),不回出现网络中断,系统会按照cat /etc/rc.d/rc.local里指定网卡的顺序工作,机器仍能对外服务,起到了失效保护的功能.
在mode=0 负载均衡工作模式,他能提供两倍的带宽,下我们来看一下网卡的配置信息
[root@rhas-13 root]# ifconfig
bond0 Link encap:Ethernet HWaddr 00:0E:7F:25:D9:8B
inet addr:172.31.0.13 Bcast:172.31.3.255 Mask:255.255.252.0
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:2817 errors:0 dropped:0 overruns:0 frame:0
TX packets:95 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:226957 (221.6 Kb) TX bytes:15266 (14.9 Kb)
eth0 Link encap:Ethernet HWaddr 00:0E:7F:25:D9:8B
inet addr:172.31.0.13 Bcast:172.31.3.255 Mask:255.255.252.0
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:1406 errors:0 dropped:0 overruns:0 frame:0
TX packets:48 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:113967 (111.2 Kb) TX bytes:7268 (7.0 Kb)
Interrupt:11
eth1 Link encap:Ethernet HWaddr 00:0E:7F:25:D9:8B
inet addr:172.31.0.13 Bcast:172.31.3.255 Mask:255.255.252.0
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:1411 errors:0 dropped:0 overruns:0 frame:0
TX packets:47 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:112990 (110.3 Kb) TX bytes:7998 (7.8 Kb)
Interrupt:15
在这种情况下出现一块网卡失效,仅仅会是服务器出口带宽下降,也不会影响网络使用.
通过查看bond0的工作状态查询能详细的掌握bonding的工作状态
[root@rhas-13 bonding]# cat /proc/net/bonding/bond0
bonding.c:v2.4.1 (September 15, 2003)
Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 0
Up Delay (ms): 0
Down Delay (ms): 0
Multicast Mode: all slaves
Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:0e:7f:25:d9:8a
Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:0e:7f:25:d9:8b
这下差不多就对Linux双网卡绑定技术有了一个相关的说明。
【编辑推荐】