Friday, August 30, 2013

How do maintain a constant mac address on bonded NICs?

SkyHi @ Friday, August 30, 2013
In 10.04 this consistenlty create bond0 with the mac address from eth0. with 12.04, the mac address used appears to be random - sometimes it's the address from eth0, sometimes it's the address from eth1.


After trying MakOwner's solution to no avail, I think I solved it for my case.

At bootup I noticed in dmesg that eth1 was coming up before eth0, probably due to some unpredictable hardware timing. To make things worse, I saw that the link states for eth0 and eth1 would sometimes go up a few seconds after bond0 went up. Perhaps the bond was polling for the link status of eth0 and eth1, cycling through each until one came up. Whichever was chosen first depended on timing.

My solution was to add a pre-up sleep command to eth1. This effectively delays it long enough to guarantee that eth0 is selected first.

Here is my configuration:

Code:
auto eth0
    iface eth0 inet manual
    bond-master  bond0

auto eth1
    iface eth1 inet manual
    # delay ifup to allow eth0 to come up first in the bond
    pre-up sleep 4
    bond-master  bond0

auto bond0
    iface bond0 inet dhcp
    bond-mode active-backup
    bond-miimon 100
    bond-slaves eth0 eth1


REFERENCES
http://ubuntuforums.org/showthread.php?t=1967987