I have configured multiple IP addresses on a ubuntu box, but when I run ifconfig it shows just one of them. I am able, however, to ping all other adresses assigned to this machine.

/etc/network/interface contents:

# 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

# The primary network interface
auto eth0
iface eth0 inet static

# dns-* options are implemented by the resolvconf package, if installed   
dns-search idil.dz1.da

auto eth0:1    
iface eth0:1 inet static

auto eth0:2
iface eth0:2 inet static

auto eth0:3
iface eth0:3 inet static

auto eth0:4
iface eth0:4 inet static

auto eth0:5
iface eth0:5 inet static

However, the output of the ifconfig is only:

  • ifconfig -a display everything? – Alex R Dec 10 '12 at 9:12
  • it is showing only eth0 ip address..:( – pankaj sharma Dec 10 '12 at 9:14
  • 1
    Which Ubuntu release are you running? Please add your information to bug #921280 too. – jdthood Dec 10 '12 at 11:52
  • 1
    ip addr show works – xinthose Dec 7 '18 at 16:35

ifconfig is essentially deprecated, although there are no plans that I am aware of to get rid of it. The replacement is the ip command. The modern equivalent of ifconfig on its own is ip address list.

Why has ifconfig been replaced with ip? Much new functionality has been added to Linux networking in the decades since ifconfig was written. This involved an entirely new API (netlink) for the userspace tool to speak to the kernel to configure the network. It was far more practical to write a new tool to better map the new functionality through the netlink API and down to the command line, than to try and adapt the old ifconfig tool. Check out the ip(8) manpage for all the cool new stuff that you can do now.

The kernel API used by ifconfig and the ifconfig tool itself remains for backwards compatibility, but this interface is blind to anything that does not easily map to the old model.

The reason that ifconfig doesn't show you the IP aliases is that it looks like they are being added by Debian's ifupdown (the package that handles /etc/network/interfaces) using a different mechanism that does not add the labels :1, :2, etc. So the ifconfig tool is blind to them, since the old API mandated these labels, and so the extra addresses do not map to the old API. From the ip-address(8) manpage:

          Each address may be tagged with a label string.  In order to
          preserve compatibility with Linux-2.0 net aliases, this string
          must coincide with the name of the device or must be prefixed
          with the device name followed by colon.

The bugs linked in maggotbrain's answer seem to be focused around adding support to ifconfig to read addresses without labels. Another approach might be to arrange for ifupdown to create the addresses with labels, such that ifconfig will be able to see them without modification.


This is most likely a bug in the net-tools package and ifconfig specifically.

See the launchpad bugs here and here for additional information.

If you enter your interfaces manually, from the command line using ifconfig like this(following your above configuration):

sudo ifconfig eth0:1 netmask
sudo ifconfig eth0:2 netmask
sudo ifconfig eth0:3 netmask
sudo ifconfig eth0:4 netmask
sudo ifconfig eth0:5 netmask

You will have those interfaces show up, as expected, when running ifconfig.

These changes will not show up in your /etc/network/interfaces, however. So, you will need to add them in both places.

Note: This is also not persistent across interface resets, so you will need to re-run the commands upon restarting the interface/machine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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