centos5.5_ dual NIC binding Linux Dual card binding implementation is to use two network card virtual to become a network card, the aggregation of equipment appears to be a separate Ethernet interface equipment, popular point is that two network cards have the same IP address and parallel link aggregation into a logical link work. The first thing to see is whether Linux supports BONDING,RHEL4 already supported by default. [Root@localhost ~]# Modinfo Bonding FileName:/lib/modules/2.6.18-238.9.1.el5/kernel/drivers/net/bonding/bonding.ko author:thomas Davis, Tadavis@lbl.gov and many others description:ethernet Channel bonding Driver v3.4.0-1 version:3.4.0-1 LICENSE:GPL srcve RSION:358EAAF5610876F44387AEF Depends:ipv6 vermagic:2.6.18-238.9.1.el5 SMP mod_unload gcc-4.1 .................. .................. If there is a similar information output above, the instructions are already supported. Binding steps: 1. Modify the/etc/sysconfig/network-scripts/ifcfg-eth0 configuration document The revised contents are as follows: Device=eth0 Onboot=yes #系统启动时自动启用该设备 Bootproto=none #启动时不使用任何协议 2. Modify the/etc/sysconfig/network-scripts/ifcfg-eth1 configuration document The revised contents are as follows: Device=eth1 Onboot=yes #系统启动时自动启用该设备 Bootproto=none #启动时不使用任何协议 3. Create a configuration document that binds the network port/ETC/SYSCONFIG/NETWORK-SCRIPTS/IFCFG-BOND0 The contents are as follows: Device=bond0 #虚拟网卡名称 Bootproto=static ipaddr=192.168.0.2 #IP地址 netmask=255.255.255.0 #子网掩码 gateway=192.168.0.1 #网关 boradcast=192.168.0.255 #广播地址 Onboot=yes Type=ethernet You can also configure this: (1) Edit the virtual network interface configuration file (bond0) and specify the network adapter IP vi/etc/sysconfig/network-scripts/ifcfg-bond0 device=bond0 onboot=yes bootproto= Static ipaddr=192.168.0.254 broadcast=192.168.0.255 netmask=255.255.255.0 network=192.168.0.0 GATEWAY=192.168.0.1 Userctl=no type=ethernet Note: It is recommended that you do not specify a MAC address Vi/etc/sysconfig/network-scripts/ifcfg-eth0 Device=eth0 BOOTPROTO=none Onboot=yes userctl=no master=bond0 slave=yes Note: It is recommended that you do not specify a MAC address Vi/etc/sysconfig/network-scripts/ifcfg-eth1 Bootproto=none Onboot=yes userctl=no master=bond0 slave=yes Note: It is recommended that you do not specify a MAC address This is not the 5th step to configure. 4. Modify/etc/modprobe.conf, configure the binding model Add the following content: Alias Bond0 Bonding Options Bond0 millmon=100 mode=0 Description: miimon=100 Miimon refers to how long time to check the network, the Unit is MS (milliseconds) this side of the 100, is 100ms, that is, 0.1 seconds to assume that there is a network disconnection, will be in 0.1 seconds automatically backup mode a total of seven (0~6) mode= 0: Balanced load mode, there is automatic backup, but need "Switch" support and settings. Mode=1: Automatic standby mode, if one line is disconnected, the other lines will be automatically prepared for assistance. MODE=6: Balanced load mode, there is automatic backup, do not need to "Switch" support and settings. What needs to be explained is that if you want to achieve mode 0 load balancing, just set up here options bond0 miimon=100 mode=0 is not enough, the switch connected to the network card must be specially configured (these two ports should be aggregated), Because the two cards that make bonding are using the same MAC address. From the principle analysis (bond runs under mode 0): Mode 0 Under the bond of the network card to be bound to the IP is modified to the same MAC address, if these cards are connected to the same switch, then the switch ARP table this MAC address corresponding to the port there are multiple, Then the switch accepts which port the packet sent to this MAC address should be forwarded to. Under normal circumstances, the MAC address is the only global, a MAC address corresponding to multiple ports must make the switch confused. So mode0 bond. If you are connected to a switch, these ports should be aggregated (Cisco is called Ethernetchannel,foundry called PortGroup), because after the switch is aggregated, Several ports under aggregation are also bundled into a MAC address. Our solution is that two network cards are connected to different switches. There is no need to configure the switch in MODE6 mode because the two NICs that make the bonding are using a different MAC address. Ps:rhel4 (CENTOS4) and the following versions of the options are added to the/etc/modprobe.conf; RHEL5 (centos5) can add ifcfg-bond0 to bonding_opts= "Mode=1 arp_ interval=100 arp_ip_target=192.168.0.1 " 5. Modify the/etc/rc.local, responsible for the system at the start of the virtual network card and two physical network card binding Add the following: Ifenslave bond0 eth0 eth1 This configuration is complete, restart the machine, you can see a new bond0 card. You can view the current status by viewing the BOND0: [Root@localhost ~]# cat/proc/net/bonding/bond0 Ethernet Channel Bonding driver:v3.4.0-1 (October 7, 2008) Bonding Mode: Load Balancing (round-robin) MII status:up MII Polling Interval (ms): Up Delay (ms): 0 down Delay (ms): 0 Slave Inter Face:eth0 MII status:up speed:100 Mbps duplex:full Link failure count:0 Permanent HW addr:00:24:xxxxxxxx Slave Inter Face:eth1 MII status:up speed:100 Mbps duplex:full Link failure count:1 Permanent HW addr:00:24:xxxxxxxx [Ubuntu 10.04 Configuration] Apt-get Install ifenslave-2.6 Vi/etc/network/interfaces Auto Bond0 iface bond0 inet The static address 192.168.xx.xx gateway 192.168.x.x netmask 255.255.255.0 slaves eth1 eth2 # #slav Es eth0 eth1 eth2 eth3 eth4 bond-mode 0 Bond-miimon 100 If you want to bind all the cards, use slaves all Seven kinds of bond mode description: The first model: Mod=0, that is: (BALANCE-RR) round-robin policy (balanced LUN cycle strategy) features: Transmission packet sequence is transmitted sequentially (that is, the 1th packet go eth0, the next package go eth1 .... The loop continues until the last transmission is complete.This pattern provides load balancing and fault tolerance;But we know that if a connection or session packet is sent from a different interface, halfway through the different links, the client is likely to be the problem of disorderly arrival of packets, and disorderly arrival of packets need to be sent again, so that the throughput of the network will decline the second mode: Mod=1, namely: ( Active-backup) active-backup Policy (primary-backup strategy) features: Only one device is active, and when one is down another is immediately converted to a primary device by a backup. The MAC address is externally visible, and from the outside it appears that the Bond's MAC address is unique to avoid confusion in the switch (switch).This mode only provides fault tolerance;The advantage of this algorithm is that it can provide high network connectivity availability, but its resource utilization is low, only one interface is working, in the case of N network interface, resource utilization is 1/n third mode: mod=2, namely: (Balance-xor) XOR Policy (Balancing Policy) features: transmission of packets based on the specified transport hash policy. The default policy is: (Source MAC address XOR destination MAC address)% slave number. Other transport policies can be specified through the Xmit_hash_policy option, which provides load balancing and fault tolerance fourth mode: Mod=3, that is: Broadcast (broadcast policy) feature: Each packet is transmitted on each slave interface, which provides fault tolerance Mode Fifth: Mod=4, that is: (802.3AD) IEEE 802.3ad Dynamic Link Aggregation (IEEE 802.3ad dynamically linked aggregation) features: Create an aggregation group that shares the same rate and duplex settings. Multiple slave are worked under the same active aggregation under the 802.3AD specification. The slave election for outgoing traffic is based on the transport hash policy, which can be changed from the default XOR policy to other policies through the Xmit_hash_policy option. It should be noted that not all transport strategies are 802.3AD compliant, especially given the problem of packet chaos mentioned in the 802.3AD standard 43.2.4 section. Different implementations may have different adaptations. Prerequisites: Conditional 1:ethtool Support gets the rate and duplex settings for each slave 2:switch (switch) supports IEEE 802.3ad Dynamic link Aggregation condition 3: Most switch (switch) Requires a specific configuration to support the 802.3AD mode sixth mode: Mod=5, that is: (BALANCE-TLB) Adaptive Transmit load balancing (adapter transport load Balancing) features: No special switch (switch) required The supported channel bonding. The outgoing traffic is allocated on each slave according to the current load (calculated according to the speed). If the slave that is receiving the data fails, another slave takes over the MAC address of the failed slave. The necessary condition for this pattern: Ethtool support to get the rate of each slave seventh mode: mod=6, namely: (BALANCE-ALB) Adaptive load Balancing (Adapter Adaptive load Balancing) Feature: This mode contains balance-tlb mode, coupled with receive load balancing for IPV4 traffic (receive load balance, RLB), and no switch (switch) support is required。 Receive load balancing is implemented through ARP negotiation. The bonding driver intercepts the ARP reply sent by the native and rewrites the source hardware address as the only hardware address of a slave in the bond, allowing different pairs to communicate using different hardware addresses. Receive traffic from the server side will also be balanced. When the native sends an ARP request, the bonding driver copies and saves the IP information from the ARP packet. When the ARP response arrives from the End-to-end, the bonding driver extracts its hardware address and initiates an ARP response to a slave in the bond. One problem with using ARP negotiation for load balancing is that the hardware address of bond is used every time the ARP request is broadcast, so after learning the hardware address to the end, the receiving traffic will flow to the current slave. This problem can be solved by sending all the End-to-end updates (ARP answers), which contain their unique hardware addresses, resulting in a redistribution of traffic. When a new slave is added to the bond, or if an inactive slave is reactivated, the receive traffic is also distributed again. The received payload is sequentially distributed (round robin) in the bond of the highest speed slave a link is connected, or a new slave added to the bond, receive traffic in all currently activated slave all reassigned, by using the specified MAC address to each The client initiates an ARP reply. The Updelay parameter described below must be set to a value that is greater than or equal to the switch (switch) forwarding delay, thus guaranteeing that the ARP reply sent to the end is not blocked by the switch (switch). Requirements: Conditional 1:ethtool supports the rate at which each slave is fetched; Condition 2: The underlying driver supports setting the hardware address of a device so that there is always a slave (curr_active_slave) using the hardware address of bond, while guaranteeing that each bond The slave in has a unique hardware address. If the curr_active_slave fails, its hardware address will be taken over by the newly elected Curr_active_slave.in fact, the difference between mod=6 and mod=0: Mod=6, the first eth0 flow accounted for, and then accounted for Eth1,....ethx, and Mod=0, will find 2 mouth flow is very stable, the basic same bandwidth. And Mod=6, will find the first mouth flow is very high, the 2nd mouth only accounted for a small amount of traffic
[Root@localhost ~]# [root@localhost ~]# ifconfig eth0 Link encap:ethernet hwaddr 00:0c:29:6f:8f:b7 inet bcast:10.5.10.255 mask:255.255.255.0 inet6 addr:fe80::20c:29ff:fe6f:8fb7/64 scope:link up BROADCAST RUNNING MULTICAST M tu:1500 metric:1 RX packets:1594 errors:0 dropped:0 overruns:0 frame:0 Tx packets:832 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:212897 (207.9 KiB) TX bytes:1 01979 (99.5 KiB) interrupt:67 Base address:0x2000 eth1 Link encap:ethernet hwaddr 00:0c:29:6f:8f:c1 inet B cast:10.5.10.255 mask:255.255.255.0 inet6 addr:fe80::20c:29ff:fe6f:8fc1/64 scope:link up BROADCAST RUNNING MULTICAST mtu:1500 metric:1 RX packets:712 errors:0 dropped:0 overruns:0 frame:0 Tx packets:75 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:131195 (128.1 KiB) TX bytes:11 810 (11.5 KiB) interrupt:67 Base address:0x2080 lo Link encap:local loopback inet addr:127.0.0.1 mask:255.0.0.0 Inet6 ::: 1/128Scope:host up loopback RUNNING mtu:16436 metric:1 RX packets:1459 errors:0 dropped:0 overruns:0 frame:0 TX packets:1459 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 RX bytes:245559 (239.8 KiB) TX bytes:245559 (239.8 KiB) [root@localhost ~]# [root@localhost ~]#] [root@localhost ~]# Servic E Network restart shutting down interface eth0: [OK] shutting down interface eth1: [OK] shutting down loopback Interfa CE: [OK] bringing up loopback interface: [OK] bringing up interface bond0: [OK] bringing up interface Eth0:pcnet32 Device eth0 does not seem to be present, delaying initialization. [FAILED] Bringing Up interface eth1: [OK] [root@localhost ~]# ifconfig bond0 Link encap:ethernet hwaddr 00:0c:29:6f:8f:b7 inet AD dr:110.5.10.177 bcast:10.5.10.255 mask:255.255.255.0 inet6 addr:fe80::20c:29ff:fe6f:8fb7/64 Scope:Link up BROADCAST RUNNING multicast mtu:1500 metric:1 RX packets:1764 errors:0 dropped:0 overruns:0 frame:0 TX packets:926 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:239964 (234.3 KiB) TX bytes:119705 (116.8 KiB) interrupt:67 Base Address: 0x2000 eth1 Link encap:ethernet hwaddr 00:0c:29:6f:8f:c1 inet6 addr:fe80::20c:29ff:fe6f:8fc1/64 scope:link up BROADCAST R unning Multicast mtu:1500 metric:1 RX packets:780 errors:0 dropped:0 overruns:0 frame:0 Tx packets:90 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:144647 (141.2 KiB) TX bytes:16 173 (15.7 KiB) interrupt:67 Base address:0x2080 lo Link encap:local loopback inet addr:127.0.0.1 mask:255.0.0.0 Inet6 ::: 1/128 scope:host up loopback RUNNING mtu:16436 metric:1 RX packets:1557 errors:0 dropped:0 overruns:0 frame:0 TX packets:1557 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 RX bytes:261105 (254.9 KiB) TX bytes:261105 (254.9 KiB) [root@localhost ~]# modinfo bonding filename:/lib/modules/2.6.18- 53.el5/kernel/drivers/net/bonding/bonding.ko Author:thomas Davis, tadavis@lbl.gov and many others DescripTion:ethernet Channel bonding Driver, v3.1.2 version:3.1.2, LICENSE:GPL srcversion:6cd19765d6431c07199456e depends:ver Magic:2.6.18-53.el5 SMP mod_unload 686 regparm 4KSTACKS gcc-4.1 parm:max_bonds:Max number of bonded devices (int) Parm: Miimon:link check interval in milliseconds (int) Parm:updelay:Delay before considering Link up, in milliseconds (int) par M:downdelay:delay before considering link down, in milliseconds (int) parm:use_carrier:Use NETIF_CARRIER_OK (vs MII Ioct LS) in Miimon; 0 for out, 1 for On (default) (int) Parm:mode:Mode of operation:0 to BALANCE-RR, 1 for Active-backup, 2 for Balance-xo R, 3 for broadcast, 4 for 802.3AD, 5 for balance-tlb, 6 for Balance-alb (CHARP) parm:primary:Primary Network to US E (charp) Parm:lacp_rate:LACPDU TX rate to request from 802.3AD Partner (Slow/fast) (charp) Parm:xmit_hash_policy:XOR ha Shing method:0 for Layer 2 (default), 1 for Layer 3+4 (CHARP) Parm:arp_interval:arp interval in milliseconds (int) Parm: arp_ip_tArget:arp targets in N.N.N.N form (array of charp) parm:arp_validate:validate src/dst of ARP Probes:none (default), ACTI ve, Backup or All (CHARP) Module_sig: 883f350473854274432f7696771e6e11230fb09e34e7dba7e91b77e25d9ccb0ca9b4e6e5a1076a009f4091a23337f7cd53e737c1ec2189ff3a6d3cc73 8 [root@localhost ~]# cat/etc/sysconfig/network-scripts/ifcfg-eth0 # Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE] Device=eth0 Onboot=yes [Root@localhost ~]# |