Results 1 to 5 of 5

Thread: How do maintain a constant mac address on bonded NICs?

  1. #1
    Join Date
    Dec 2008
    Location
    Taxes
    Beans
    455
    Distro
    Ubuntu Studio 12.04 Precise Pangolin

    How do maintain a constant mac address on bonded NICs?

    I know there are some differences between configuration of simple bonded pairs (mode 0) in 12.04 from 10.04.

    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.

    I have tried using the hwaddress parameter - in the bond0 section it just
    causes networking to fail. It's ignored in the eth0 or eth1 section.


    Code:
    auto lo
    iface lo inet loopback
    
    auto eth0
    iface eth0 inet manual
    bond-master bond0
    
    auto eth1
    iface eth1 inet manual
    bond-master bond0
    
    auto bond0
    iface bond0 inet dhcp
    slaves eth0 eth1
    
    # LACP confuration
    bond_mode 0
    bond_miimon 100
    Last edited by MakOwner; April 28th, 2012 at 10:39 PM. Reason: Title. Shoot me. :/

  2. #2
    Join Date
    Mar 2008
    Location
    Back to India
    Beans
    278
    Distro
    Ubuntu Gnome 14.04 Trusty Tahr

    Re: How do maintain a constant mac address on bonded NICs?

    Will something help checking /etc/udev/rules.d/ net file !

  3. #3
    Join Date
    Dec 2008
    Location
    Taxes
    Beans
    455
    Distro
    Ubuntu Studio 12.04 Precise Pangolin

    Re: How do maintain a constant mac address on bonded NICs?

    Quote Originally Posted by Vishal Agarwal View Post
    Will something help checking /etc/udev/rules.d/ net file !
    I tried editing /etc/udev/rules.d/70-persistent-net.rules
    After reboot I end up with an additional device with the original MAC address defined - and the second and third devices are not active.


    Code:
    # This file was automatically generated by the /lib/udev/write_net_rules
    # program, run by the persistent-net-generator.rules rules file.
    #
    # You can modify it, as long as you keep each rule on a single
    # line, and change only the value of the NAME= key.
    
    # PCI device 0x14e4:/sys/devices/pci0000:00/0000:00:1c.4/0000:05:00.0 (tg3)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:13:72:fc:0f:8a", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
    
    # PCI device 0x14e4:/sys/devices/pci0000:00/0000:00:1c.5/0000:06:00.0 (tg3)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:13:72:fc:0f:8a", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
    
    # PCI device 0x14e4:/sys/devices/pci0000:00/0000:00:1c.5/0000:06:00.0 (tg3)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:13:72:fc:0f:8b", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"

  4. #4
    Join Date
    Dec 2008
    Location
    Taxes
    Beans
    455
    Distro
    Ubuntu Studio 12.04 Precise Pangolin

    Re: How do maintain a constant mac address on bonded NICs?

    I have had three reboots that came up with a consistent MAC address with this configuration.
    No guarantee that this will work consistently, but its the best I have found so far.
    Don't know if it;s the hwaddress parameter or the longer bond-miimon settings.
    I know the positioning of the hwaddress paramter is sensitive - make sure you put it between the face line and the rest of the parameters.


    Code:
    ################################################
     # This file describes the network interfaces available on your system
     # and how to activate them. For more information, see interfaces(5).
    
     # The loopback network interface
    auto lo
    iface lo inet loopback
    
    auto eth0
    iface eth0 inet manual
    bond-master bond0
    
    auto eth1
    iface eth1 inet manual
    bond-master bond0
    
    
    auto bond0
    iface bond0 inet dhcp
    hwaddress xx:xx:xx:xx:xx:xx
    bond-slaves eth0 eth1
    bond-mode 0
    bond-miimon 1000
    Last edited by MakOwner; May 4th, 2012 at 10:06 PM.

  5. #5
    Join Date
    May 2012
    Beans
    1

    Re: How do maintain a constant mac address on bonded NICs?

    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

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •