How does the bonding driver change MAC addresses?

本文探讨了bonding驱动改变MAC地址的方式。介绍了Red Hat Enterprise Linux环境下网络链路聚合情况,提出bonding驱动改变MAC地址及查看真实MAC地址的问题。阐述了bonding接口MAC地址变化规则,还说明了不同bonding模式下MAC地址的使用和变化情况。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值