1. 程式人生 > >NIC Channel Bond on Linux

NIC Channel Bond on Linux

Binding Configure

1.伺服器

dev1 為服務端,ip為 192.168.1.7,計劃使用eth2,eth3聚合繫結成虛擬網絡卡bond0。
dev2 為客戶端,ip為192.168.1.10。
若無指明,則傳輸檔案測試是從 dev1 傳輸到 dev2,傳輸為單檔案,大小為9.7G。

2.網路結構

dev1,dev2的網絡卡均連線到同一個物理交換機。

3.測試要點

a.頻寬:主要測試雙網絡卡繫結時,頻寬是否有增加,傳輸是否更快;主要使用time檢視時間,scp帶實時的傳輸速率顯示。 b.冗餘:主要測試雙網絡卡繫結時,其中一個網絡卡工作異常,是否會走另外一個網絡卡;主要使用netstat檢視資料包。

4.測試點

主要分為單網絡卡、網絡卡繫結(分模式0,1,6,以及在6下禁用其中一個網絡卡)的測試:

  • a.單網絡卡測試
  • b.模式0繫結:負載均衡方式,兩塊網絡卡都工作,需要交換機作支援
  • c.模式1繫結:冗餘方式,網絡卡只有一個工作,一個出問題啟用另外的
  • d.模式6繫結:負載均衡方式,兩塊網絡卡都工作,不需要交換機作支援
  • e.模式6繫結時禁用一個網絡卡
  • f.模式6繫結時禁用一個網絡卡,從客戶端到服務端傳輸
  • 注:a,b,c,d,e均是從服務端到客戶端傳輸檔案。
  1. mode

Allows you to specify the bonding policy. The ‘value’ can be one of:

  • balance-rr or 0 — Sets a round-robin policy for fault tolerance and load balancing. Transmissions are received and sent out sequentially on each bonded slave interface beginning with the first one available.
  • active-backup or 1 — Sets an active-backup policy for fault tolerance. Transmissions are received and sent out via the first available bonded slave interface. Another bonded slave interface is only used if the active bonded slave interface fails.
  • balance-xor or 2 — Sets an XOR (exclusive-or) policy for fault tolerance and load balancing. Using this method, the interface matches up the incoming request’s MAC address with the MAC address for one of the slave NICs. Once this link is established, transmissions are sent out sequentially beginning with the first available interface.
  • broadcast or 3 — Sets a broadcast policy for fault tolerance. All transmissions are sent on all slave interfaces.
  • 802.3ad or 4 — Sets an IEEE 802.3ad dynamic link aggregation policy. Creates aggregation groups that share the same speed and duplex settings. Transmits and receives on all slaves in the active aggregator. Requires a switch that is 802.3ad compliant.
  • balance-tlb or 5 — Sets a Transmit Load Balancing (TLB) policy for fault tolerance and load balancing. The outgoing traffic is distributed according to the current load on each slave interface. Incoming traffic is received by the current slave. If the receiving slave fails, another slave takes over the MAC address of the failed slave.
  • balance-alb or 6 — Sets an Active Load Balancing (ALB) policy for fault tolerance and load balancing. Includes transmit and receive load balancing for IPV4 traffic. Receive load balancing is achieved through ARP negotiation.

6.測試結論

  • a.頻寬:單網絡卡和雙網絡卡繫結時相比,頻寬並無明顯差異。
  • b.冗餘:雙網絡卡繫結有冗餘效果,正在傳輸時,其中一個網絡卡工作異常,會自動走另外一個網絡卡,暫且沒有出現數據包丟失的現象。

Network Interface

[[email protected] etc]# uname -a
Linux dev1.egolife.com 2.6.39-400.17.1.el6uek.x86_64 #1 SMP Fri Feb 22 18:16:18 PST 2013 x86_64 x86_64 x86_64 GNU/Linux

[[email protected] etc]# lspci | grep Ethernet
04:00.0 Ethernet controller: Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet (rev 20)
04:00.1 Ethernet controller: Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet (rev 20)
0e:00.0 Ethernet controller: Intel Corporation 82580 Gigabit Network Connection (rev 01)
0e:00.1 Ethernet controller: Intel Corporation 82580 Gigabit Network Connection (rev 01)

Single Interface

ifconfig

[[email protected] ~]# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 6C:AE:8B:78:4C:44  
		  inet addr:172.29.73.7  Bcast:172.29.73.255  Mask:255.255.255.0
		  inet6 addr: fe80::6eae:8bff:fe78:4c44/64 Scope:Link
		  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
		  RX packets:8679827 errors:0 dropped:0 overruns:0 frame:0
		  TX packets:11695363 errors:0 dropped:0 overruns:0 carrier:0
		  collisions:0 txqueuelen:1000 
		  RX bytes:10981189708 (10.2 GiB)  TX bytes:11622829842 (10.8 GiB)

eth1      Link encap:Ethernet  HWaddr 6C:AE:8B:78:4C:46  
		  BROADCAST MULTICAST  MTU:1500  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:1000 
		  RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

eth2      Link encap:Ethernet  HWaddr 90:E2:BA:43:4F:CA  
		  BROADCAST MULTICAST  MTU:1500  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:1000 
		  RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

eth3      Link encap:Ethernet  HWaddr 90:E2:BA:43:4F:CB  
		  BROADCAST MULTICAST  MTU:1500  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:1000 
		  RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

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:16 errors:0 dropped:0 overruns:0 frame:0
		  TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
		  collisions:0 txqueuelen:0 
		  RX bytes:960 (960.0 b)  TX bytes:960 (960.0 b)

route

[[email protected] ~]# route 
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         172.29.73.1     0.0.0.0         UG    0      0        0 eth0
link-local      *               255.255.0.0     U     1002   0        0 eth0
link-local      *               255.255.0.0     U     1007   0        0 eth1
172.29.73.0     *               255.255.255.0   U     0      0        0 eth0
192.168.1.0     *               255.255.255.0   U     0      0        0 eth1

ping

[[email protected] ~]# ping 192.168.1.10
PING 192.168.1.10 (192.168.1.10) 56(84) bytes of data.
^C
--- 192.168.1.10 ping statistics ---
43 packets transmitted, 0 received, 100% packet loss, time 42421ms

eth2

[[email protected] ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth2
DEVICE=eth2
HWADDR=90:E2:BA:43:4F:CA
TYPE=Ethernet
UUID=c57d0153-e9d7-42a0-bc6b-4cc3295d4796
IPADDR=192.168.1.7
BROADCAST=192.168.1.255
NETMASK=255.255.255.0
ONBOOT=no
NM_CONTROLLED=no
BOOTPROTO=static
IPV6INIT=no
USERCTL=no

[[email protected] ~]# ifup eth2

[[email protected] ~]# ifconfig eth2
eth2      Link encap:Ethernet  HWaddr 90:E2:BA:43:4F:CA  
          inet addr:192.168.1.7  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::92e2:baff:fe43:4fca/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 b)  TX bytes:412 (412.0 b)

[[email protected] ~]# ping 192.168.1.10
PING 192.168.1.10 (192.168.1.10) 56(84) bytes of data.
64 bytes from 192.168.1.10: icmp_seq=1 ttl=64 time=1.42 ms
^C
--- 192.168.1.10 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 626ms
rtt min/avg/max/mdev = 1.423/1.423/1.423/0.000 ms

speed test

[[email protected] ~]# ll -h /u2
total 9.7G
drwx------. 2 root root  16K Jun 26 15:28 lost+found
-rw-r--r--. 1 root root 9.7G Jun 26 16:39 oracle_1213_apps.tar.gz

[[email protected] ~]# time scp /u2/oracle_1213_apps.tar.gz 192.168.1.10:/tmp
The authenticity of host '192.168.1.10 (192.168.1.10)' can't be established.
RSA key fingerprint is d2:6f:03:40:a0:78:a9:71:1e:c4:6f:73:e4:d8:4f:7b.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.10' (RSA) to the list of known hosts.
[email protected]'s password: 
oracle_1213_apps.tar.gz                                                                                                                 100% 9855MB 110.7MB/s   01:29    

real	1m35.725s
user	0m58.625s
sys		0m39.648s

Configure bond0 with eth2, eth3

Channel Bonding Configure

bond0

[[email protected] ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
BOOTPROTO=none
IPADDR=192.168.1.7
BROADCAST=192.168.1.255
NETMASK=255.255.255.0
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes

binding eth2,eth3 to bond0

[[email protected] ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth2
DEVICE=eth2
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=no

[[email protected] ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth3
DEVICE=eth3
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=no

modprobe with mode 0

[[email protected] ~]# cat /etc/modprobe.conf 
alias eth2 pcnet32
alias eth3 pcnet32
alias scsi_hostadapter mptbase
alias scsi_hostadapter3 mptspi
alias scsi_hostadapter4 ata_piix
alias peth0 pcnet32
alias bond0 bonding
options bond0 miimon=100 mode=0

注:

  • miimon 是鏈路監測的時間間隔單位是毫秒,miimon=100的意思就是,每100毫秒檢測網絡卡和交換機之間是否連通,如不通則使用另外的鏈路。
  • mode: mode=0 表示負載均衡方式,兩塊網絡卡都工作,需要交換機作支援
    mode=1 表示冗餘方式,網絡卡只有一個工作,一個出問題啟用另外的 mode=6 表示負載均衡方式,兩塊網絡卡都工作,不需要交換機作支援

enslave

[[email protected] ~]# ifenslave bond1 eth2 eth3
Master 'bond1': Error: handshake with driver failed. Aborting

[[email protected] ~]# dmesg | tail
ADDRCONF(NETDEV_UP): bond0: link is not ready
Loading kernel module for a network device with CAP_SYS_MODULE (deprecated).  Use CAP_NET_ADMIN and alias netdev-bond1 instead
ADDRCONF(NETDEV_UP): eth2: link is not ready
ADDRCONF(NETDEV_UP): eth3: link is not ready
igb: eth2 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None
ADDRCONF(NETDEV_CHANGE): eth2: link becomes ready
igb: eth3 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None
ADDRCONF(NETDEV_CHANGE): eth3: link becomes ready
eth2: no IPv6 routers present

restart network

[[email protected] ~]# service network restart
Shutting down interface bond0:                             [  OK  ]
Shutting down interface eth0:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface bond0:                               [  OK  ]
Bringing up interface eth0:                                [  OK  ]
Bringing up interface eth2:                                [  OK  ]
Bringing up interface eth3:                                [  OK  ]

enslave

[[email protected] ~]# ifenslave bond1 eth2 eth3

ping

[[email protected] ~]# ping 192.168.1.10
PING 192.168.1.10 (192.168.1.10) 56(84) bytes of data.
^C
--- 192.168.1.10 ping statistics ---
43 packets transmitted, 0 received, 100% packet loss, time 42421ms

[[email protected] ~]# ifconfig bond0
bond0     Link encap:Ethernet  HWaddr 90:E2:BA:43:4F:CA  
          inet addr:192.168.1.7  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::92e2:baff:fe43:4fca/64 Scope:Link
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
          RX packets:729735 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7551346 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:52531377 (50.0 MiB)  TX bytes:10862582133 (10.1 GiB)

注:

bond0: the mac address is set to the mac address of the first slave nic.

route

[[email protected] ~]# route 
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         172.29.73.1     0.0.0.0         UG    0      0        0 eth0
link-local      *               255.255.0.0     U     1002   0        0 eth0
link-local      *               255.255.0.0     U     1004   0        0 eth2
link-local      *               255.255.0.0     U     1005   0        0 eth3
link-local      *               255.255.0.0     U     1007   0        0 bond0
172.29.73.0     *               255.255.255.0   U     0      0        0 eth0
192.168.1.0     *               255.255.255.0   U     0      0        0 bond0

mode 0

ping

[[email protected] ~]# ping 192.168.1.10
PING 192.168.1.10 (192.168.1.10) 56(84) bytes of data.
64 bytes from 192.168.1.10: icmp_seq=1 ttl=64 time=1.69 ms
64 bytes from 192.168.1.10: icmp_seq=2 ttl=64 time=0.287 ms
^C
--- 192.168.1.10 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1395ms
rtt min/avg/max/mdev = 0.287/0.992/1.697/0.705 ms

test

[[email protected] ~]# time scp /u2/oracle_1213_apps.tar.gz 192.168.1.10:/tmp
[email protected]'s password: 
oracle_1213_apps.tar.gz                                                                                                                 100% 9855MB 109.5MB/s   01:30    

real	1m32.922s
user	0m58.353s
sys		0m46.081s

ifconfig to view traffic throughout

[[email protected] ~]# ifconfig bond0
bond0     Link encap:Ethernet  HWaddr 90:E2:BA:43:4F:CA  
          inet addr:192.168.1.7  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::92e2:baff:fe43:4fca/64 Scope:Link
          UP BROADCAST MASTER MULTICAST  MTU:1500  Metric:1
          RX packets:3879393 errors:0 dropped:0 overruns:0 frame:0
          TX packets:14996073 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:307412626 (293.1 MiB)  TX bytes:21719128132 (20.2 GiB)

[[email protected] ~]# ifconfig eth2
eth2      Link encap:Ethernet  HWaddr 90:E2:BA:43:4F:CA  
          inet addr:192.168.1.7  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:3879390 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10718053 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:307412446 (293.1 MiB)  TX bytes:15398686700 (14.3 GiB)

[[email protected] ~]# ifconfig eth3	
eth3      Link encap:Ethernet  HWaddr 90:E2:BA:43:4F:CA  
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:3 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4278020 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:180 (180.0 b)  TX bytes:6320441432 (5.8 GiB)

bring down eth2, eth3

[[email protected] ~]# ifdown eth2

[[email protected] ~]# ping 192.168.1.10
PING 192.168.1.10 (192.168.1.10) 56(84) bytes of data.
64 bytes from 192.168.1.10: icmp_seq=1 ttl=64 time=1.13 ms
64 bytes from 192.168.1.10: icmp_seq=2 ttl=64 time=0.256 ms
64 bytes from 192.168.1.10: icmp_seq=3 ttl=64 time=0.236 ms
^C
--- 192.168.1.10 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2596ms
rtt min/avg/max/mdev = 0.236/0.542/1.134/0.418 ms


[[email protected] ~]# time scp /u2/oracle_1213_apps.tar.gz 192.168.1.10:/tmp
[email protected]'s password: 
oracle_1213_apps.tar.gz                                                                                                                 100% 9855MB 112.0MB/s   01:28    

real	1m31.001s
user	0m59.142s
sys		0m30.835s

[[email protected] ~]# ifdown eth3

[[email protected] ~]# ping 192.168.1.10
PING 192.168.1.10 (192.168.1.10) 56(84) bytes of data.
^C
--- 192.168.1.10 ping statistics ---
7 packets transmitted, 0 received, 100% packet loss, time 6996ms

[[email protected] ~]# ifup eth2

[[email protected] ~]# ping 192.168.1.10
PING 192.168.1.10 (192.168.1.10) 56(84) bytes of data.
64 bytes from 192.168.1.10: icmp_seq=1 ttl=64 time=2005 ms
64 bytes from 192.168.1.10: icmp_seq=2 ttl=64 time=1005 ms
64 bytes from 192.168.1.10: icmp_seq=3 ttl=64 time=5.55 ms
64 bytes from 192.168.1.10: icmp_seq=4 ttl=64 time=0.283 ms
^C
--- 192.168.1.10 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3950ms
rtt min/avg/max/mdev = 0.283/754.118/2005.167/830.199 ms, pipe 3

[[email protected] ~]# ifup eth3

[[email protected] ~]# ping 192.168.1.10
PING 192.168.1.10 (192.168.1.10) 56(84) bytes of data.
64 bytes from 192.168.1.10: icmp_seq=1 ttl=64 time=0.253 ms
64 bytes from 192.168.1.10: icmp_seq=2 ttl=64 time=0.290 ms
^C
--- 192.168.1.10 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1639ms
rtt min/avg/max/mdev = 0.253/0.271/0.290/0.024 ms

[[email protected] ~]# ifconfig 
bond0     Link encap:Ethernet  HWaddr 90:E2:BA:43:4F:CA  
          inet addr:192.168.1.7  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::92e2:baff:fe43:4fca/64 Scope:Link
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
          RX packets:4544721 errors:0 dropped:0 overruns:0 frame:0
          TX packets:22217942 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:355677703 (339.2 MiB)  TX bytes:32559983059 (30.3 GiB)

eth0      Link encap:Ethernet  HWaddr 6C:AE:8B:78:4C:44  
          inet addr:172.29.73.7  Bcast:172.29.73.255  Mask:255.255.255.0
          inet6 addr: fe80::6eae:8bff:fe78:4c44/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:854 errors:0 dropped:0 overruns:0 frame:0
          TX packets:497 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:80825 (78.9 KiB)  TX bytes:76148 (74.3 KiB)

eth2      Link encap:Ethernet  HWaddr 90:E2:BA:43:4F:CA  
          UP BROADCAST SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:3879467 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10718143 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:307419536 (293.1 MiB)  TX bytes:15398694004 (14.3 GiB)

eth3      Link encap:Ethernet  HWaddr 90:E2:BA:43:4F:CA  
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:665254 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11499799 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:48258167 (46.0 MiB)  TX bytes:17161289055 (15.9 GiB)

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:293 errors:0 dropped:0 overruns:0 frame:0
          TX packets:293 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:31960 (31.2 KiB)  TX bytes:31960 (31.2 KiB)

bring down bind0

[[email protected] ~]# ifdown bond0

[[email protected] ~]# ping 192.168.1.10
PING 192.168.1.10 (192.168.1.10) 56(84) bytes of data.
^C
--- 192.168.1.10 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2719ms

bring up bond0

[[email protected] ~]# ifup bond0

[[email protected] ~]# ping 192.168.1.10
PING 192.168.1.10 (192.168.1.10) 56(84) bytes of data.
64 bytes from 192.168.1.10: icmp_seq=1 ttl=64 time=0.402 ms
64 bytes from 192.168.1.10: icmp_seq=2 ttl=64 time=0.293 ms
64 bytes from 192.168.1.10: icmp_seq=3 ttl=64 time=0.290 ms
^C
--- 192.168.1.10 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2490ms
rtt min/avg/max/mdev = 0.290/0.328/0.402/0.054 ms

[[email protected] ~]# netstat -i
Kernel Interface table
Iface       MTU Met    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
bond0      1500   0  4544721      0      0      0 22217942      0      0      0 BMmRU
eth0       1500   0      995      0      0      0      622      0      0      0 BMRU
eth2       1500   0  3879467      0      0      0 10718143      0      0      0 BMsRU
eth3       1500   0   665254      0      0      0 11499799      0      0      0 BMsRU
lo        16436   0      293      0      0      0      293      0      0      0 LRU

mode 1

[[email protected] ~]# cat /etc/modprobe.conf 
alias eth2 pcnet32
alias eth3 pcnet32
alias scsi_hostadapter mptbase
alias scsi_hostadapter3 mptspi
alias scsi_hostadapter4 ata_piix
alias peth0 pcnet32
alias bond0 bonding
options bond0 miimon=100 mode=1

[[email protected] ~]# service network restart
... ...

[[email protected] ~]# time scp /u2/oracle_1213_apps.tar.gz 192.168.1.10:/tmp
[email protected]'s password: 
oracle_1213_apps.tar.gz                                                                                                                 100% 9855MB 110.7MB/s   01:29    

real	1m31.298s
user	0m55.667s
sys		0m43.423s

[[email protected] ~]# netstat -i
Kernel Interface table
Iface       MTU Met    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
bond0      1500   0  8764945      0      0      0 29542976      0      0      0 BMmRU
eth0       1500   0      201      0      0      0      167      0      0      0 BMRU
eth2       1500   0  3879467      0      0      0 14399423      0      0      0 BMsRU
eth3       1500   0  4885478      0      0      0 15143553      0      0      0 BMsRU
lo        16436   0      293      0      0      0      293      0      0      0 LRU

[[email protected] ~]# ifdown eth2

[[email protected] ~]# time scp /u2/oracle_1213_apps.tar.gz 192.168.1.10:/tmp
[email protected]'s password: 
oracle_1213_apps.tar.gz                                                                                                                 100% 9855MB 112.0MB/s   01:28    

real	1m31.059s
user	0m59.240s
sys		0m30.670s

[[email protected] ~]# netstat -i
Kernel Interface table
Iface       MTU Met    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
bond0      1500   0  9432589      0      0      0 36767111      0      0      0 BMmRU
eth0       1500   0      440      0      0      0      329      0      0      0 BMRU
eth3       1500   0  5553122      0      0      0 22367688      0      0      0 BMsRU
lo        16436   0      293      0      0      0      293      0      0      0 LRU

mode 6

[[email protected] ~]# cat /etc/modprobe.conf 
alias eth2 pcnet32
alias eth3 pcnet32
alias scsi_hostadapter mptbase
alias scsi_hostadapter3 mptspi
alias scsi_hostadapter4 ata_piix
alias peth0 pcnet32
alias bond0 bonding
options bond0 miimon=100 mode=6

[[email protected] ~]# service network restart
... ...

scp test

[[email protected] ~]# time scp /u2/oracle_1213_apps.tar.gz 192.168.1.10:/tmp
[email protected]'s password: 
oracle_1213_apps.tar.gz                                                                                                                 100% 9855MB 110.7MB/s   01:29    

real	1m31.287s
user	0m56.114s
sys		0m44.767s

netstat

[[email protected] ~]# netstat -i
Kernel Interface table
Iface       MTU Met    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
bond0      1500   0 13269295      0      0      0 44134140      0      0      0 BMmRU
eth0       1500   0      211      0      0      0      162      0      0      0 BMRU
eth2       1500   0  3879467      0      0      0 18195589      0      0      0 BMsRU
eth3       1500   0  9389828      0      0      0 25938551      0      0      0 BMsRU
lo        16436   0      293      0      0      0      293      0      0      0 LRU

bring down eth3

[[email protected] ~]# ifdown eth3
[[email protected] ~]# time scp /u2/oracle_1213_apps.tar.gz 192.168.1.10:/tmp
[email protected]'s password: 
oracle_1213_apps.tar.gz                                                                                                                 100% 9855MB 112.0MB/s   01:28    

real	1m30.996s
user	0m58.047s
sys		0m39.067s

netstat

[[email protected] ~]# ifup eth3
[[email protected] ~]# netstat -i
Kernel Interface table
Iface       MTU Met    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
bond0      1500   0 13990944      0      0      0 51618873      0      0      0 BMmRU
eth0       1500   0      447      0      0      0      324      0      0      0 BMRU
eth2       1500   0  4601116      0      0      0 25680322      0      0      0 BMsRU
eth3       1500   0  9389828      0      0      0 25938551      0      0      0 BMsRU
lo        16436   0      293      0      0      0      293      0      0      0 LRU

when file transfering, bring down eth2

[[email protected] ~]# time scp /u2/oracle_1213_apps.tar.gz 192.168.1.10:/tmp
[email protected]'s password: 
oracle_1213_apps.tar.gz                                                                                                                 100% 9855MB 100.6MB/s   01:38    

real	1m40.639s
user	0m59.232s
sys		0m38.922s

[[email protected] ~]# ifup eth2

after completing transfering

[[email protected] ~]# netstat -i
Kernel Interface table
Iface       MTU Met    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
bond0      1500   0 14854993      0      0      0 58942784      0      0      0 BMmRU
eth0       1500   0     5220      0      0      0     2745      0      0      0 BMRU
eth2       1500   0  4868378      0      0      0 26232685      0      0      0 BMsU
eth3       1500   0  9986615      0      0      0 32710099      0      0      0 BMsRU
lo        16436   0      325      0      0      0      325      0      0      0 LRU

from client to server, while file transfering, bring down eth2

[[email protected] /]# time scp /tmp/oracle_1213_apps.tar.gz 192.168.1.7:/tmp
[email protected]'s password: 
oracle_1213_apps.tar.gz                                                                                                                 100% 9855MB 108.3MB/s   01:31    

real	1m37.377s
user	0m58.969s
sys		0m33.968s

[[email protected] ~]# ifdown eth3

after completing transfering

[[email protected] ~]# ifup eth3

[[email protected] ~]# netstat -i
Kernel Interface table
Iface       MTU Met    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
bond0      1500   0 22419759      0      0      0 59667621      0      0      0 BMmRU
eth0       1500   0     5412      0      0      0     2882      0      0      0 BMRU
eth2       1500   0 11898827      0      0      0 26932401      0      0      0 BMsRU
eth3       1500   0 10520932      0      0      0 32735220      0      0      0 BMsU
lo        16436   0      325      0      0      0      325      0      0      0 LRU

Test Summary

eth2

[[email protected] ~]# ll -h /u2
total 9.7G
drwx------. 2 root root  16K Jun 26 15:28 lost+found
-rw-r--r--. 1 root root 9.7G Jun 26 16:39 oracle_1213_apps.tar.gz

[[email protected] ~]# time scp /u2/oracle_1213_apps.tar.gz 192.168.1.10:/tmp
The authenticity of host '192.168.1.10 (192.168.1.10)' can't be established.
RSA key fingerprint is d2:6f:03:40:a0:78:a9:71:1e:c4:6f:73:e4:d8:4f:7b.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.10' (RSA) to the list of known hosts.
[email protected]'s password: 
oracle_1213_apps.tar.gz                                                                                                                 100% 9855MB 110.7MB/s   01:29    

real	1m35.725s
user	0m58.625s
sys		0m39.648s

bonding mode 0 載均衡方式,兩塊網絡卡都工作,需要交換機作支援

[[email protected] ~]# time scp /u2/oracle_1213_apps.tar.gz 192.168.1.10:/tmp
[email protected]'s password: 
oracle_1213_apps.tar.gz                                                                                                                 100% 9855MB 110.7MB/s   01:29    

real	1m31.298s
user	0m55.667s
sys		0m43.423s

bonding mode 1 表示冗餘方式,網絡卡只有一個工作,一個出問題啟用另外的

[[email protected] ~]# time scp /u2/oracle_1213_apps.tar.gz 192.168.1.10:/tmp
[email protected]'s password: 
oracle_1213_apps.tar.gz                                                                                                                 100% 9855MB 110.7MB/s   01:29    

real	1m31.298s
user	0m55.667s
sys		0m43.423s

bonding mode 6 表示負載均衡方式,兩塊網絡卡都工作,不需要交換機作支援

[[email protected] ~]# time scp /u2/oracle_1213_apps.tar.gz 192.168.1.10:/tmp
[email protected]'s password: 
oracle_1213_apps.tar.gz                                                                                                                 100% 9855MB 110.7MB/s   01:29    

real	1m31.287s
user	0m56.114s
sys		0m44.767s

bonding mode 6, when file transfering, bring down eth2

[[email protected] ~]# time scp /u2/oracle_1213_apps.tar.gz 192.168.1.10:/tmp
[email protected]'s password: 
oracle_1213_apps.tar.gz                                                                                                                 100% 9855MB 100.6MB/s   01:38    

real	1m40.639s
user	0m59.232s
sys		0m38.922s

after completing transfering

[[email protected] ~]# ifup eth2

[[email protected] ~]# netstat -i
Kernel Interface table
Iface       MTU Met    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
bond0      1500   0 14854993      0      0      0 58942784      0      0      0 BMmRU
eth0       1500   0     5220      0      0      0     2745      0      0      0 BMRU
eth2       1500   0  4868378      0      0      0 26232685      0      0      0 BMsU
eth3       1500   0  9986615      0      0      0 32710099      0      0      0 BMsRU
lo        16436   0      325      0      0      0      325      0      0      0 LRU

binding mode 6, from client to server, while file transfering, bring down eth2

[[email protected] /]# time scp /tmp/oracle_1213_apps.tar.gz 192.168.1.7:/tmp
[email protected]'s password: 
oracle_1213_apps.tar.gz                                                                                                                 100% 9855MB 108.3MB/s   01:31    

real	1m37.377s
user	0m58.969s
sys		0m33.968s

[[email protected] ~]# ifdown eth3

after completing transfering

[[email protected] ~]# ifup eth3

[[email protected] ~]# netstat -i
Kernel Interface table
Iface       MTU Met    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
bond0      1500   0 22419759      0      0      0 59667621      0      0      0 BMmRU
eth0       1500   0     5412      0      0      0     2882      0      0      0 BMRU
eth2       1500   0 11898827      0      0      0 26932401      0      0      0 BMsRU
eth3       1500   0 10520932      0      0      0 32735220      0      0      0 BMsU
lo        16436   0      325      0      0      0      325      0      0      0 LRU

Reference

blog comments powered by Disqus