Create Multiple IP Addresses to One Single Network Interface

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Use our Linode referral link if you plan to buy VPS (it starts at only $10/month).
  4. Support us via PayPal donate - Make a Donation
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux course in 5 Days

We are thankful for your never ending support.

Narad Shrestha

He has over 10 years of rich IT experience which includes various Linux Distros, FOSS and Networking. Narad always believes sharing IT knowledge with others and adopts new technology with ease.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

Receive Your Free Complimentary eBook NOW! -

Download Free Linux eBooks

Advanced Bash-Scripting Guide
Linux Bible
A Newbie's Getting Started Guide to Linux
Introduction to Linux - A Hands on Guide

You may also like...

57 Responses

  1. dyh03 says:

    Hi,

    After I’m editing it using vi command for each ifcfg eth0:0 and eth0:1, then i want to check back if I’m inserting it correctly using command:

    # /etc/init.d/network restart
    

    then after that the output is “[failed]”

    then insert it “ifconfig” then it shows “command not found”, can i ask u guys, why this happens?

    • Ravi Saive says:

      @Haru,

      Please add the correct values to those ifcf interface files and about ifconfig command missing, you need to install it using yum package manager..

  2. ashwin says:

    when i try to make the files using ” cp ifcfg-eth0 ifcfg-eth0:0″
    it is showing me permission denied. pls help

    • Ravi Saive says:

      @Ashwin,

      I hope you running that command as root user, if not switch to root user and execute, it needs root privileges to execute that command.

  3. rajesh says:

    how many ips we can create using ip alisasing??

  4. dilip says:

    Please tell me how to add route permanently in linux

    • Ravi Saive says:

      @Dilip,

      To add a permanent static route on CentOS, RHEL or Fedora distributions, use the following command.

      # echo "192.168.10.0/16 via 192.168.5.5" >> /etc/sysconfig/network-scripts/route-eth0
      

      If you’re using Debian or Ubuntu distribution, try to run the following command to add a static route permanently.

      # echo "up route add -net 192.168.10.0/16 gw 192.168.5.5 dev eth0" >> /etc/network/interfaces
      

      Don’t forget to replace the IP address with your route IP address

  5. kashu says:

    typo…

    [root@ctos67 ~]# ip a s eth0
    2: eth0: mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 52:54:00:1c:9e:77 brd ff:ff:ff:ff:ff:ff
    inet 192.168.123.2/24 brd 192.168.123.255 scope global eth0
    inet6 fe80::5054:ff:fe1c:9e77/64 scope link
    valid_lft forever preferred_lft forever

    [root@ctos67 ~]# for i in {10..20}; do ip a a 192.168.123.${i}/24 dev eth0:$i; done
    [root@ctos67 ~]# ip a s eth0
    2: eth0: mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 52:54:00:1c:9e:77 brd ff:ff:ff:ff:ff:ff
    inet 192.168.123.2/24 brd 192.168.123.255 scope global eth0
    inet 192.168.123.10/24 scope global secondary eth0
    inet 192.168.123.11/24 scope global secondary eth0
    inet 192.168.123.12/24 scope global secondary eth0
    inet 192.168.123.13/24 scope global secondary eth0
    inet 192.168.123.14/24 scope global secondary eth0
    inet 192.168.123.15/24 scope global secondary eth0
    inet 192.168.123.16/24 scope global secondary eth0
    inet 192.168.123.17/24 scope global secondary eth0
    inet 192.168.123.18/24 scope global secondary eth0
    inet 192.168.123.19/24 scope global secondary eth0
    inet 192.168.123.20/24 scope global secondary eth0
    inet6 fe80::5054:ff:fe1c:9e77/64 scope link
    valid_lft forever preferred_lft forever

    [root@ctos67 ~]# for i in {10..20}; do ip a d 192.168.123.${i}/24 dev eth0:$i; done
    [root@ctos67 ~]# ip a s eth0
    2: eth0: mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 52:54:00:1c:9e:77 brd ff:ff:ff:ff:ff:ff
    inet 192.168.123.2/24 brd 192.168.123.255 scope global eth0
    inet6 fe80::5054:ff:fe1c:9e77/64 scope link
    valid_lft forever preferred_lft forever

  6. kashu says:

    I’d like to use ip command to temporarily create multiple ip address.

    for i in {0..10}; do ip a a 192.168.123.${i}/24 dev eth0:${i}; done

  7. akhil says:

    easy way is to use the command in centos
    ifconfig eth0:1 192.168.0.101

Got something to say? Join the discussion.

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

Join Over 150K+ Linux Users
  1. 100,756
  2. 5,113
  3. 36,418

Enter your email to get latest Linux Howto's