Operating Environment
Oracle Linux Server Release 6.4
Kernel
Linux Rac1 2.6.39-400.17.1.el6uek.x86_64
[Email protected] ~]# vi/etc/sysconfig/network-scripts/ifcfg-bond0
Device=bond0
Bootproto=static
ipaddr=192.168.254.2
netmask=255.255.255.0
broadcast=192.168.254.1
Onboot=yes
Type=ethernet
gateway=192.168.254.1
Userctl=no
"/etc/sysconfig/network-scripts/ifcfg-bond0" [New] 17L, 163C written
[Email protected] ~]# cd/etc/sysconfig/network-scripts/
[Email protected] network-scripts]# VI ifcfg-eth1
Device=eth1
Bootproto=none
Onboot=yes
Userctl=no
Master=bond0
Slave=yes
~
"Ifcfg-eth1" 11L, 77C written
[Email protected] network-scripts]# VI ifcfg-eth2
Device=eth2
Bootproto=none
Onboot=yes
Userctl=no
Master=bond0
Slave=yes
~
"Ifcfg-eth2" 11L, 77C written
[Email protected] network-scripts]# vi/etc/modprobe.d/modprobe.conf
Alias Bond0 Bonding
Options Bond0 miimon=100 mode=1
~
~
"/etc/modprobe.d/modprobe.conf" [New] 4L, 54C written
Description
Miimon is used for link monitoring, such as: miimon=100, then the system every 100MS monitoring link connection status, if one line is not connected to another line; mode value represents the mode of operation, he has 0,1,2,3 four modes, commonly used for 0, 12 kinds.
The mode=0 indicates that load balancing (round-robin) is balanced, and both NICs work.
Mode=1 indicates that fault-tolerance (active-backup) provides redundancy, working in a way that the primary and standby means that only one NIC works by default, and the other is backed up.
[Email protected] network-scripts]# vi/etc/rc.d/rc.local
#!/bin/sh
#
# This script is executed *after* all and the other init scripts.
# can put your own initialization stuff in here if you don ' t
# want to does the full Sys V style init stuff.
Touch/var/lock/subsys/local
Ifenslave bond0 eth2 eth1
~
"/etc/rc.d/rc.local" 8L, 246C written
[Email protected] network-scripts]# ifconfig bond0 192.168.254.2 up
#[[email protected] network-scripts]# ifenslave bond0 eth2 eth1
Illegal operation:the specified slave interface ' eth0 ' is already a slave
Finally, restart the server:
[email protected] ~]# reboot
The bond card from below has been started
[[email protected] ~]# ifconfig
bond0 Link encap:ethernet HWaddr 08:00:27:e7:1f:5d
inet addr:192.168.254.2 bcast:192.168.254.1 mask:255.255.255.0
INET6 addr:fe80::a00:27ff:fee7:1f5d/64 scope:link
& nbsp up broadcast RUNNING MASTER multicast mtu:1500 metric:1
&N Bsp RX packets:35 errors:0 dropped:15 overruns:0 frame:0
TX packets:16 errors:0 dropped: 0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2498 (2.4 KiB) TX bytes:1028 (1.0 KiB)
eth1 Link encap:ethernet HWaddr 08:00:27:e7:1f:5d
& nbsp inet addr:192.168.254.2 bcast:192.168.254.255 mask:255.255.255.0
Up broadcast RUNNING SLAVE multicast mtu:1500 metric:1
RX Packets : errors:0 dropped:12 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns: 0 carrier:0
collisions:0 txqueuelen:1000
RX b ytes:6411 (6.2 KiB) TX bytes:288 (288.0 b)
eth2 Link encap:ethernet HWaddr 08:00:27:99:be:cc
& nbsp inet addr:192.168.254.2 bcast:192.168.254.255 mask:255.255.255.0
Up broadcast RUNNING SLAVE multicast mtu:1500 metric:1
RX Packets : errors:0 dropped:62 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 Overruns : 0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4935 (4.8 KiB) TX bytes:740 (740.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:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:240 (240.0 b) TX bytes:240 (240.0 b)
See below the current active Nic Ech1, the status is boot
[Email protected] ~]# cat/proc/net/bonding/bond0
Ethernet Channel Bonding driver:v3.7.1 (April 27, 2011)
Bonding mode:fault-tolerance (Active-backup)
Primary Slave:none
Currently Active Slave:eth1
MII Status:up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave interface:eth1
MII Status:up
speed:1000 Mbps
Duplex:full
Link Failure count:0
Permanent HW addr:08:00:27:e7:1f:5d
Slave Queue id:0
Slave Interface:eth2
MII Status:up
speed:1000 Mbps
Duplex:full
Link Failure count:1
Permanent HW ADDR:08:00:27:99:BE:CC
Slave Queue id:0
description of seven bond modes:
First mode: Mod=0, ie: (BALANCE-RR) round-robin policy (balanced Whirl cycle strategy)
Features: Transmission packet sequence is transmitted sequentially (that is: the 1th packet to go eth0, the next package will go eth1 ...). This mode provides load balancing and fault tolerance until the last transmission is complete), but we know that if a connection or session packet is sent from a different interface, After passing through different links, there is a good chance that packets will arrive out of order at the client, and the unordered arrival packets need to be sent again, so the throughput of the network will drop.
Second mode: mod=1, ie: (active-backup) active-backup policy (primary-backup strategy)
Features: Only one device is active, and when one is down the other is converted to the primary device immediately by the backup. The MAC address is externally visible, and from the outside, the MAC address of the bond is unique to avoid the switch from confusing. This mode only provides fault tolerance, so the advantage of this algorithm is that it can provide high availability of network connection, but its resource utilization is low, only one interface is working, and the resource utilization is 1/n in the case of N network interface.
Third mode: mod=2, ie: (balance-xor) XOR policy (Balancing strategy)
Feature: transmits packets based on the specified transfer 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, i.e.: Broadcast (broadcast strategy)
Feature: Each packet is transmitted on each slave interface, and this mode provides fault tolerance
Fifth mode: mod=4, i.e.: (802.3AD) IEEE 802.3adDynamic Link Aggregation (IEEE 802.3ad dynamic Link aggregation)
Feature: Create an aggregation group that shares the same rate and duplex settings. Multiple slave are working under the same active aggregate according to the 802.3AD specification.
The slave election for outgoing traffic is based on the transfer hash policy, which can be changed from the default XOR policy to another policy through the xmit_hash_policy option. It is important to note that not all transmission strategies are 802.3AD adapted, especially considering the problem of packet chaos mentioned in the 802.3AD standard 43.2.4 section. Different implementations may have different adaptations.
Necessary:
Conditional 1:ethtool supports getting the rate and duplex settings for each slave
Conditional 2:switch (switch) supports IEEE 802.3ad Dynamic link Aggregation
Condition 3: Most switch (switches) require a specific configuration to support 802.3ad mode
Sixth mode: mod=5, i.e.: (balance-tlb) Adaptive Transmit load balancing (adapter transport load Balancer)
Features: no special switch (switch) supported channel bonding is required. Out-of-office traffic is allocated on each slave based on the current load (calculated based on speed). If the slave that is accepting data fails, the other slave takes over the MAC address of the failed slave.
Required for this pattern: Ethtool supports getting the rate per slave
Seventh mode: mod=6, i.e.: (BALANCE-ALB) Adaptive load Balancing (adapter adaptive load Balancer)
Features: This mode includes the BALANCE-TLB mode, plus receive load balancing for IPV4 traffic (receive load balance, RLB), and does not require any switch (switch) support. Receive load balancing is implemented through ARP negotiation. The bonding driver intercepts the ARP response sent by the native and overwrites the source hardware address with the unique hardware address of one of the slave in bond, allowing different peer-to-peer communication using different hardware addresses.
Oracle Linux 6.4 (BOND) dual NIC binding Combat-additional instructions