Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to do ip aliasing on my ubuntu 12.04 guest and it was not working.

host
11.x.11.2

guest 
11.x.11.3

guest is using bridge networking with host.

on guest specified

auto eth0
iface eth0 inet static
    address 11.x.11.2
    netmask 255.255.255.0
    network 11.x.11.0
    broadcast 11.x.11.255
    gateway 11.x.11.1

auto eth0:0
iface eth0:0 inet static
    address 11.x.11.3
    netmask 255.255.255.0
    network 11.x.11.0
    broadcast 11.x.11.255
    gateway 11.x.11.1

after network restart it was showing Failed to bring up eth0:0. .Even reboot also didnt work.

But when changed order in configuration and a network restart fixed the issue

auto eth0
iface eth0 inet static
address 11.x.11.3
netmask 255.255.255.0
network 11.x.11.0
broadcast 11.x.11.255
gateway 11.x.11.1

auto eth0:0
iface eth0:0 inet static
address 11.x.11.2
netmask 255.255.255.0
network 11.x.11.0
broadcast 11.x.11.255
gateway 11.x.11.1

But what difference this can make,

share|improve this question
    
you don't need to specify gateway on eth0:0 interface. try to remove it and restart. –  chocripple Mar 5 '13 at 8:23
    
earlier there was no gw on alias,so i tried adding them,but still it didnt work.When it worked i didnt remove it. :) –  Blue Gene Mar 5 '13 at 9:34

1 Answer 1

Interface aliases are seriously deprecated. The same effect can be achieved with a single stanza and an ip addr command (which is what modern ifupdown is using anyway):

auto eth0
iface eth0 inet static
    address 11.x.11.3
    netmask 255.255.255.0
    network 11.x.11.0
    broadcast 11.x.11.255
    gateway 11.x.11.1
    up ip addr add 11.x.11.2/24 dev eth0
    # no need for down, ifupdown flush all addresses on stop.

Now see the output of ip addr, and look how you don't need interface aliases to add several addresses to an interface. And forget about the deprecated ifconfig

share|improve this answer
    
wow that is a good trick,i havent even heard of it. but how can we see signed ip,its not listing in ifconfig. –  Blue Gene Mar 5 '13 at 9:42
2  
@BlueGene: This is already explained in the answer: forget about the old deprecated ifconfig from 1999, and use ip addr instead. ip addr without any options will list the interfaces and addresses. –  BatchyX Mar 5 '13 at 9:53
    
You don't need to call ip addr from an up directive. It's cleaner to just define a second iface stanza for eth0: wiki.debian.org/NetworkConfiguration#iproute2_method –  AGWA Jun 26 at 19:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.