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:

🐧 If you liked this page, please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source & DevOps topics via:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
27 comments… add one
  • Bashed Nov 8, 2016 @ 3:39

    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.

  • Swati Jun 22, 2016 @ 6:16

    Thanks, it worked!

  • Innokenty Longway Jul 22, 2014 @ 15:41

    All worked out. Thank you.

  • Yan Adam Jan 13, 2014 @ 16:16

    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.

  • Alexis Wilke Sep 23, 2013 @ 21:20


    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.



  • Qui Sep 23, 2013 @ 12:10

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

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.