Ubuntu 12.04 – Aliases of bonded interfaces not working correctly

aliasbondingUbuntuubuntu-12.04

I have the following /etc/network/interfaces

# The loopback network interface
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet manual
    bond-master bond0
    bond-primary eth0

auto eth1
iface eth1 inet manual
    bond-master bond0

auto bond0
iface bond0 inet static
    address 172.17.1.210
    netmask 255.255.255.0
    gateway 172.17.1.1
    bond-mode 1
    bond-miimon 100
    bond-slaves none

iface bond0:1 inet static
    address 172.17.1.215
    netmask 255.255.255.0
    gateway 172.17.1.1

If I try to manually bring up the alias interface bind0:1 I get the following error, but the interface does come up.

chris@abc1:~$ ifconfig bond0:1
bond0:1   Link encap:Ethernet  HWaddr d4:ae:52:ce:25:4b  
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1

chris@abc1:~$ sudo ifup bond0:1
RTNETLINK answers: File exists
Failed to bring up bond0:1.
chris@abc1:~$ ifconfig bond0:1
bond0:1   Link encap:Ethernet  HWaddr d4:ae:52:ce:25:4b  
          inet addr:172.17.1.215  Bcast:172.17.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1

If I try to bring the interface down, I get an error and the interface does not go down.

chris@abc1:~$ sudo ifdown bond0:1
ifdown: interface bond0:1 not configured
chris@abc1:~$ ifconfig bond0:1
bond0:1   Link encap:Ethernet  HWaddr d4:ae:52:ce:25:4b  
          inet addr:172.17.1.215  Bcast:172.17.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1

I've replicated this behaviour on two fresh installs of Ubuntu 12.04.3, on two entirely separate networks (on different sites) with different topologies (i.e. eths connected to two switches at one site, and both eths connected to the same switch at another).

I have a similar alias interface working on another machine on eth0:1 – so I think I'm running the correct commands.

I also have a similar system working on Ubuntu 10.04 – but that was before 12.04 changed how bonding had to be configured.

Can anyone explain what I'm doing wrong? Is this a bug?

Best Answer

You should remove the gateway line for the aliased interface as you can only have one default gateway.