Linux Creating or Adding New Network Alias To a Network Card (NIC)

Q. I would like to create alias for my network card (NIC). How do I setup 2 IP address on One NIC? How do I add alias under Centos / Fedora / Debian / Ubuntu Linux?

A. Linux allows you to add additional network address using alias feature. Please note that all additional network IP address must be in same subnet. For example if your eth0 using IP address then alias must be setup using subnet.

ifconfig command line

You can use ifconfig command to configure a network interface and alias. For example:

  • eth0 NIC IP
  • eth0:0 first NIC alias:

To setup eth0:0 alias type the following command as the root user:
# ifconfig eth0:0 up
Verify alias is up and running using following command:
# ifconfig -a
# ping
However, if you reboot the system you will lost all your alias. To make it permanent you need to add it network configuration file.

Debian / Ubuntu Linux Instructions

You can configure the additional IP addresses automatically at boot with another iface statement in /etc/network/interfaces:
# vi /etc/network/interfaces
Append text as follows:

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

Save and close the file. Restart the network:
# /etc/init.d/networking restart

Red Hat / RHEL / CentOS / Fedora Linux Instructions

Copy etc/sysconfig/network-scripts/ifcfg-eth0 file as /etc/sysconfig/network-scripts/ifcfg-eth0:0
# cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0
Open file /etc/sysconfig/network-scripts/ifcfg-eth0:0 using vi text editor:
# vi /etc/sysconfig/network-scripts/ifcfg-eth0:0
Find entry that read as follows:


Replace with:


Find entry that read as follows:

Replace it with your actual IP address:


At the end your file should like as follows:


Open file /etc/sysconfig/network-scripts/ifcfg-eth0 and make sure file does not have a GATEWAY= entry:
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
Find the entry that read as follows:


Remove or comment it out by prefixing # (hash) :


Save the file. Add the GATEWAY= to your /etc/sysconfig/network:

# vi /etc/sysconfig/network

Append or modify GATEWAY entry:


Save the file. Reboot the system or run the following command:

# ifup eth0:0


# service network restart

Red Hat / CentOS / Fedora Multiple IP address range

You can assign multiple ip address range as follows to eth0:
vi /etc/sysconfig/network-scripts/ifcfg-eth0-range0
Append following code from to


Save and close the file.

See also:

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 21 comments so far... add one

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
21 comments… add one
  • Walid Rudwan Osman Apr 16, 2007 @ 7:08

    Hello there
    I am using Linux enterprise 4 on my Toshipa Laptop but it didn’t recognizing my NIC so I had to ask for the NIC installation file so I get and this is the name of the file install_8_37[1].tar but I dont know what to do after that ,so i need any help to do this but just please make simple and much details as much as you can because I am not quite expert.

  • Manu Ignatius Nov 25, 2008 @ 2:02

    This blog explains how to create an aliased interface using a C program.
    Might be useful for some of you I guess.

  • Ross Sutherland Sep 1, 2009 @ 10:58

    Hello, I am very new to Linux. Currently using Ubuntu and was wondering what the following line means.
    “name Ethernet alias LAN card”
    Any help on this would be great thanks!

  • Vamsi Jan 19, 2010 @ 17:45

    thanks !..will try to ad failover ip’s on my ovh box :)

  • vamsi Jan 31, 2010 @ 19:52

    Hi sir
    If I have several additional IPs, will creating eth0:1, eth0:2 and so on.
    work’s ?
    thanks :D

  • Michael Leahy Mar 29, 2010 @ 17:50

    According to the documentation in /usr/share/doc/initscripts-*/sysconfig.txt, the file defining the eth0:0 device on RedHat/RHEL/CentOS/Fedora systems should only contain the information that is different from the parent eth0 device.

  • Stefan Lasiewski Feb 9, 2011 @ 22:22

    I agree with Michael Leahy.

    /usr/share/doc/initscripts-*/sysconfig.txt says that the alias interfaces should not duplicate the information contained in the parent device.

    From /usr/share/doc/initscripts-*/sysconfig.txt

    /etc/sysconfig/network-scripts/ifcfg- and

    The first defines an interface, and the second contains
    only the parts of the definition that are different in a
    “alias” (or alternative) interface. For example, the
    network numbers might be different, but everything else
    might be the same, so only the network numbers would be
    in the alias file, but all the device information would
    be in the base ifcfg file.

  • Andrew K Mar 17, 2011 @ 6:21

    Since when does an alias have to be on the same subnet? I use aliases all the time at work to create private “dev” VLANS with servers I SSH to directly (with a simple switch in between).

  • Steve Harper Mar 19, 2011 @ 23:15

    The ONBOOT parameter is not appropriate for a Virtual IP / IP Alias – you need to use the ONPARENT param instead.

    Steve Harper

  • Pinoy Apr 27, 2011 @ 19:19

    Thanks I just managed to add a new network alias to my server. :) I also followed Steve’s advice about the onboot parameter.

  • Patrick Jul 19, 2011 @ 15:54

    For my centos5 this information was not sufficient. I’ve added a IP alias eth1:1 on a different subnet than eth1 with this ifcfg-eth1:1 file:

    This works fine with a:
    service network restart

  • Ashish Jaiswal Aug 3, 2011 @ 5:25

    how many ip alias I can create in rhel 5, till now i have 64 alias of eth0 interface. I’m able to ping till 63th alias but not on 64 why’s that. I have found that in ubuntu we can create till 254 alias from one particular interface card.
    any idea all the configuration are perfect and from sitting on the machine i’m able to ping myself on 64 alias.
    but not from other machine which is in netwrok

  • mandeep kharel Dec 27, 2011 @ 15:27

    thanks this help to my configure my network

  • lury May 25, 2012 @ 14:28

    Is there any limit for network aliases?
    can i configure i.e. 512 ip addreses to one network card?

    • stfu May 16, 2013 @ 17:42

      Stop taking all the ipv4 addresses for no reason!

  • chetan Feb 6, 2013 @ 15:33

    IP address alias is simple option for adding multiple public IP address.

    check # ip address help

    Add IP Alias: ip addr add dev eth1

    Delete IP Alias: ip addr del dev eth1

    List IP Alias: ip addr show dev eth1

    • kashu Jan 31, 2016 @ 18:03

      I like this short way

      show status: ip a s eth0
      add ip alias: ip a a dev eth0
      delete ip alias: ip a d dev eth0
      add default route: ip r a via

  • NItan Jul 11, 2014 @ 5:46

    Hello Sir.
    Thank you so much and i have found a lot, but finally your website helped me , and i was using Vmware layer with RHEL 6 and trying to do IP alias but totally fail and after running this command
    #ifconfig eth0:0 192.168.*.* it works for me and sir how can i make these alias permanently after reboot ?????

  • sswireless Oct 11, 2015 @ 12:53

    in linux mint 17.2 there is nothing to do …just add another series of ip or another ip what ever require manually at network configuration n reboot pc everything works fine

  • Surya Raj Lama Dec 10, 2016 @ 5:36

    1. Create an alias call eth0:1 that uses an IP address of 10.254.254.X. Replace X with the address provided by the instructor.
    2. Make sure this alias is configured to start at boot.
    How can i do this problem? Do I have to download a server-based Linux system?

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Problem posting comment? Email me @