天天看點

How does the bonding driver change MAC addresses?How does the bonding driver change MAC addresses?

How does the bonding driver change MAC addresses?

https://access.redhat.com/solutions/876193

 SOLUTION 已驗證 - 已更新 2015年一月14日10:54 - 

English 

環境

  • Red Hat Enterprise Linux
  • Network link aggregation for load balancing and failover using the 

    bonding

     driver

問題

  • How does the bonding driver change MAC addresses?
  • When running 

    bonding

    , all slaves have the same MAC address, or different MAC addresses.
  • How can I see the real true MAC address of a bonded slave interface?

決議

The bonding interface starts with all-zeros MAC address and changes to be the same as the first interface enslaved.

After enslaving the interface, its original MAC address is stored and can be checked at 

/proc/net/bonding/<bond interface name>

 file.

Look for 

Permanent HW addr

:

Raw

# cat /proc/net/bonding/bond0  
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)  

Bonding Mode: load balancing (round-robin)  
MII Status: up  
MII Polling Interval (ms): 100  
Up Delay (ms): 0  
Down Delay (ms): 0  

Slave Interface: p1p1  
MII Status: down  
Speed: Unknown  
Duplex: Unknown  
Link Failure Count: 0  
Permanent HW addr: 00:10:18:38:0d:dc  
Slave queue ID: 0  

Slave Interface: p1p2  
MII Status: up  
Speed: 1000 Mbps  
Duplex: full  
Link Failure Count: 0  
Permanent HW addr: 00:10:18:38:0d:de  
Slave queue ID: 0  
           

The original interface's MAC address is restored upon release from bonding interface. If you release the first slave, its MAC address is restored and likely will be equal to the one used by the bond interface. That causes the following warning to show up:

Raw

bonding: bond0: Warning: the permanent HWaddr of p1p1 - 00:10:18:38:0d:dc - is still in use by bond0. Set the HWaddr of p1p1 to a different address to avoid conflicts.
           

Behaviour in each bonding modes

balance-rr or 0

All slaves use the master's MAC address. No changes happens while it is being used.

active-backup or 1

It depends on the 

fail_over_mac

 parameter. By default, all slaves are set to use the same MAC address at the enslavement.

Raw

fail_over_mac

 none or 0   - default behavior, all slaves use the same MAC address. The MAC
               address is configured at the enslavement.

 active or 1 - Each slave keeps its own MAC address. The master interface MAC
               address changes during the failover to be the address of current
               active slave.

 follow or 2 - The master interface uses the first enslavement interface MAC
               address to start, but subsequent enslavements keeps the original
               MAC address, so all backup interfaces remains unchanged.  When a
               failover happens and the interface changes to active, its MAC
               address is changed to be the master MAC address.
           

balance-xor or 2

Works the same as in mode 

balance-rr/0

broadcast or 3

Works the same as in mode 

balance-rr/0

802.3ad or 4

Works the same as in mode 

balance-rr/0

balance-tlb or 5

Each slave keeps its own MAC address. The master interfaces uses the address of the current active slave (first enslaved).

If the receiving slave fails, another slave takes over the MAC address of the failed receiving slave.

balance-alb or 6

Each slave keeps its own MAC address. The master interfaces uses the address of the current active slave (first enslaved).

If the receiving slave fails, another slave takes over the MAC address of the failed receiving slave.

Notice that, in this mode, the receiving is also balanced and it is done by sending updates (ARP replies) to all remote peers with their individually assigned hardware address such that the traffic is redistributed. When a slave fails, join or leaves the bond, the traffic is redistributed sending those updates again.

繼續閱讀