bonding virtual network interfaces in ubuntu

11,314

To bond two virtual interfaces eth0:1 and eth0:2, to create an auto failover interface, try this:

Open a terminal,

Press Ctrl+Alt+T

Run it:

To enable bonding You must install the ifenslave package:

sudo apt-get update
sudo apt-get install ifenslave

To configure it, You must modify the /etc/network/interfaces file:

sudo nano /etc/network/interfaces

In the open file modify the followings lines:

auto bond0

iface bond0 inet static
    address 10.31.1.5
    netmask 255.255.255.0
    network 10.31.1.0
    gateway 10.31.1.254
    slaves eth0:1 eth0:2
    bond_mode active-backup
    bond_miimon 100
    bond_downdelay 200
    bond_updelay 200

Ctrl + O, save file. Ctrl + X, close nano.

Share:
11,314

Related videos on Youtube

Arash Mousavi
Author by

Arash Mousavi

Updated on September 18, 2022

Comments

  • Arash Mousavi
    Arash Mousavi over 1 year

    I have one physical interface(eth0) and two virtual interfaces(eth0:1, eth0:2) , both of virtual interfaces have Public IP addresses. I want to bond these two virtual interfaces into bond0, As you can see /etc/network/interfaces :

    auto lo
    iface lo inet loopback
    
    auto eth0
    iface eth0 inet static
            address 144.yy.xx.124
            netmask 255.255.255.224
            network 144.yy.xx.96
            broadcast 144.yy.xx.127
            gateway 144.yy.xx.109
            dns-nameservers 8.8.8.8 4.2.2.2 4.2.2.4
    
    auto eth0:1
    allow-bond0 eth0:1
    iface eth0:1 inet static
            address 148.aa.bb.197
            netmask 255.255.255.248
            bond-master bond0
            bond-primary eth0:1
    
    auto eth0:2
    allow-bond0 eth0:2
    iface eth0:2 inet static
            address 148.cc.dd.198
            netmask 255.255.255.248
            bond-master bond0
    
    
    auto bond0
    iface bond0 inet static
        address 10.31.1.5
        netmask 255.255.255.0
        network 10.31.1.0
        gateway 10.31.1.254
        bond-slaves none
        bond_mode balance-rr
        bond_miimon 100
        bond_downdelay 200
        bond_updelay 200
    

    But when try to sudo ifup bond0, it returns:

    Waiting for a slave to join bond0 (will timeout after 60s)
    No slave joined bond0, continuing anyway
    

    Also I added bonding in /etc/modules

    UPDATE: I also tried this configuration for /etc/network/interfaces : http://paste.ubuntu.com/11980915/ But it has same problem.

    Is it Interface bonding possible for virtual interfaces? Whats the problem?

    • kyodake
      kyodake almost 9 years
      Why do you need to bond a virtual interface?. The whole idea of bonding is to combine two ethernet cards into one to get increased bandwidth. If the virtual interface is sharing a ethernet card then your not going to get any increase in bandwidth. Another reason to bond two interfaces is reliability. With LACP properly configured on the switch, the network connection will stay up even if one interface goes down. Admittedly this makes more sense when the interfaces are on separate cards.
    • Arash Mousavi
      Arash Mousavi almost 9 years
      I want to change source ip address round robin.
    • kyodake
      kyodake almost 9 years
      Public bug reported: "Using ifup on a master interface will call ifup for all slaves that are flagged with allow-bondX. (bondX being replaced by the master interface name). This will allow for extra setup for special slave interfaces." lists.ubuntu.com/archives/foundations-bugs/2012-June/…