≡ Menu

Ubuntu Linux: Creating ethernet alias for eth0 network device

Q. I am using Ubuntu Linux and I would like to know how to create alias for eth0 so that I can have multiple IP address?

A. To create alias for eth0 use ifconfig command. It is use to configure a network interface and aliases.

Assuming that your eth0 IP is and you would like to create an alias eth0:0 with IP Type the following command:

sudo ifconfig eth0:0 up


sudo /sbin/ifconfig eth0:0 up

Verify that alias is up and running using following two command(s):

ping your-getway-ip

Permanent configuration

Your ethernet configuration is located in a file called /etc/network/interfaces. If you reboot system you will lost your alias. To make it permanent you need to add it network configuration file:

gksudo gedit /etc/network/interfaces


sudo vi /etc/network/interfaces

Append the following configuration:

auto eth0:0
iface eth0:0 inet static
name Ethernet alias LAN card

Save the file and restart system or restart the network:

sudo /etc/init.d/networking restart

Please note that you can also use graphical tools located at System > Administration > Networking menu. Or use the following GUI tool to setup aliases, hostname, dns settings etc:

sudo network-admin

If you want more network aliases, use eth0:1, eth0:2, eth0:N (max upto 254).

See also:

Share this on:

Your support makes a big difference:
I have a small favor to ask. More people are reading the nixCraft. Many of you block advertising which is your right, and advertising revenues are not sufficient to cover my operating costs. So you can see why I need to ask for your help. The nixCraft, takes a lot of my time and hard work to produce. If you use nixCraft, who likes it, helps me with donations:
Become a Supporter →    Make a contribution via Paypal/Bitcoin →   

Don't Miss Any Linux and Unix Tips

Get nixCraft in your inbox. It's free:

{ 28 comments… add one }
  • kotnik June 18, 2006, 12:15 am


    There’s no such command. Fix the typo ;)

    • Juan Carlos Lau March 19, 2013, 11:58 pm


      I’m having a strange problem when adding eth0:2 to /etc/network/interfaces, when I try and restart the networking service the machine tries to reload the configuration and gets stuck there, the only way to bring networking back is removing the eth0:2 instances from the file and restarting (service restart won’t work after this happens the first time)

      If I simply bring up eth0:2 temporarily it doesn’t give me any problems.

      Any ideas?


  • nixCraft June 18, 2006, 11:26 am



    thanks for heads up :)

  • Cloudless August 4, 2006, 8:20 am

    Thank you so much for this guide! It is easy to understand.

  • Tamil December 28, 2006, 11:08 am

    simple and good guide. Thank you.

  • Alex January 28, 2007, 6:23 am

    What if you don’t use a permanent ip address and
    rely on DHCP to assign the IP address?

    Is this correct?
    sudo ifconfig eth0 up

    Do I need to setup dhcp?

  • jusdur August 8, 2007, 3:12 am

    what does mean this line:
    name Ethernet alias LAN card

    i look into man interfaces, but can’t found about name syntax


  • Zulqarnain November 27, 2007, 7:53 am

    i solve my problem of multi addresses.

  • Jayesh Sharma July 16, 2008, 10:50 am

    Hi All,
    This is a very good site to linux learner.But how can i post my query to get resolution.

  • nixCraft July 16, 2008, 11:14 am


    Use our Linux support forum

  • Alex October 3, 2008, 12:36 pm

    When creating an alias, must it be in the same subnetwork?
    To explain better, if my ip address id, the alias must be 1.1.1.x or can it be 2.x.x.x?


  • Manu Ignatius November 25, 2008, 2:08 am

    This link might be somewhat useful for aliasing an interface using programming.

  • Gaurav Pruthi January 22, 2009, 5:38 am

    Why we can’t use more than 254 aliases on a NIC?
    If i am using 2 NICs in my box, will the max. limit be 508?

  • Download Free Photos August 31, 2009, 7:42 am


    Can I manually add IP to /etc/network/interfaces ?
    Can someone post an example of multiple IP addresses on one NIC ?


  • Ross Sutherland September 1, 2009, 11:20 am

    Hell there. I am a new Linux user, more specifically Ubuntu. I was confused what was meant be the following line – “name Ethernet alias LAN card”. Is this the physical device name or just eth0?

    Any help with this would be great thanks.

  • Ross Cooney June 14, 2010, 7:38 pm

    Thanks for the helpful tip.

  • Alexis Wilke November 20, 2010, 6:59 am

    That is exactly what I have in my file… including the auto eth0:0. However, it looks like the auto is not that automatic on a reboot. Have you had problems on a reboot? Wondering because I’ve seen many people running in the problem of the 2nd IP disappearing after the machine is restarted.

    Thank you, Alexis

  • Anonymous April 21, 2011, 12:39 pm

    I have the same problem as Alexis Wike, Did anyone come up with a solution for this. After reboot the eth0:0 does not comeup. The auto eth0:0 line is there in the file but it seems that it does nothing. Thanks

  • Mitter Singh Thakur September 16, 2011, 10:24 am

    Hi all,


    Can you please tell me why there is limit to create an alias for NIC?

    How many IP’s we can assign to a single NIC any Why???

    Mitter Singh Thakur
    System Admin
    +91-7737603000 | +91-8890152367 | mitter1989@gmail.com

  • Alexis Wilke September 20, 2011, 6:22 am


    Yes. The limit is something like 254. It one byte. 0 and 255 cannot be used or something like that.


  • Michael December 18, 2011, 4:34 am

    The reason you may be having problems w/ AUTO on an alias is that you are not allowed to use anything other than the default subnet for the ip range in question.

    (Example: 10.x.x.x uses a default subnet of If you try to assign any other subnet mask to the aliased ip, it won’t let you, and will take down the interface instantly. (Also true if you use ifconfig to assign the netmask).

    Kind of ruins the point needing things like a server w/ several 10.x.x subnets, and forces one to use 192.168 addresses for

    Which would be fine if one didn’t already have a complex subnetted 10.x.x.x set of ranges in place because 192.168 doesn’t have enough subnets.

    Really annoying that.

  • Valdemar August 10, 2012, 5:49 pm

    Just big thanks!!! Ctrl+D

  • Qui September 23, 2013, 12:10 pm

    Hi , i want to know how you sure max alias is 254 ??

  • Alexis Wilke September 23, 2013, 9:20 pm


    It looks like the answer changed when Linux 2.2 came out. So there is no real limit (4 billion, 2 power 64 minus 1) but having too many will slowing down your system and your hardware is not unlikely going to have a limit of its own.



  • Yan Adam January 13, 2014, 4:16 pm

    This thread is a little stale I guess but it’s the closest I could find…

    For those having issues with their aliases not coming up automatically on reboot, I’ve discovered that if the “root” interface ethx with no alias is not brought up, the aliases do not get configured.

    I fixed this by adding this lone entry only to my /etc/network/interfaces :
    auto ethx

    This worked under Ubuntu 12.04 at least.

  • Innokenty Longway July 22, 2014, 3:41 pm

    All worked out. Thank you.

  • Swati June 22, 2016, 6:16 am

    Thanks, it worked!

  • Bashed November 8, 2016, 3:39 am

    How do I bind an entire /22 in Ubuntu 16 server?

    right now I have this in interfaces:

    auto eno1
    iface eno1 inet static
    address xxx.xxx.16.2
    network xxx.xxx.16.0
    broadcast xxx.xxx.19.255
    gateway xxx.xxx.16.1
    # dns-* options are implemented by the resolvconf package, if installed
    dns-search domain.com

    I need to bind the full /22. I can only ping the .2 right now.

Leave a Comment

   Tagged with: , , , , , , , , , , , , , , , , , ,