How To Add Multiple IP Addresses On Linux / Fedora Core / Fedora

By Angsuman Chakraborty, Gaea News Network
Tuesday, September 11, 2007

Most guide to adding multiple IP addresses on Linux starts with the Microsoft-like solution of using ifconfig. While the solution is correct it doesn’t survive a reboot or even a network restart. Here’s how you can easily and permanently add multiple IP addresses to the same (or different) network interface on your Linux machine. I just successfully configured dozens of IP addresses on our new dedicated server using this method. First I will explain how you can add using the Fedora user interface and then from the Linux command line.

How to set multiple IP addresses using the Fedora user interface

Linux supports multiple IP adresses on the same network interface. Adding multiple IP addresses from the user interface in Fedora is simple.
1. Select menu item System->Administration->Network.
2. Click on New to add a new IP address
3. Select Ethernet connection
4. Select the Ethernet card (in my case it is Intel Corp 82566DC Gigabit Network Connection)
5. Specify your chosen IP address
6. Specify subnet mask (if in doubt use; better yet ask your system admin)
7. Specify your gateway, if you have one configured
8. Click Next and then click on Apply.

Repeat the procedure for all your IP addresses.

Restart the network:
/sbin/service network restart

You are done!

How to set multiple IP addresses using Linux command line

Go to /etc/sysconfig/network-scripts
Make multiple copies of ifcfg-eth0 and name them as ifcfg-eth0:0, ifcfg-eth0:1 etc.
Open each of them and at least change the IPADDR to your chosen IP address and the NETMASK to the subnet mask for that IP address.
A sample entry would look like this:


Restart the network:
/sbin/service network restart

You are done!


Ajay Kumar Mahato
May 3, 2010: 9:38 pm

In Linux How many IP Address can we assing in a Single Ethernet Port

December 15, 2009: 1:33 am

What stupid article is this???? Luckily there is a comment from Anthony Cartmell that atleast tries to add the most important line… to add ALSO modify the filename in DEVICE=….

without it, like in my case, the server and all IPs will go down and not respond to any pings…

stupid author, how can you forget to mention something that important!!! total shame!!!!!

August 4, 2008: 9:50 pm

Do you have the script that does it automatically? I mean an sh file?

April 21, 2008: 10:47 am

Cool guide, but I need multi DNS (already know about the ip addresses tips) :)

thanks anyway

April 18, 2008: 11:19 am

OK, panic over, found the problem - I was still binding with INADDR_ANY instead of the specific address, which had the dual effect of taking up all the IP addresses, and accepting incoming connections on all of them!



April 18, 2008: 10:29 am


I have a problem setting up multiple IP addresses under Fedora 8: I can configure the addresses fine as detailed on this website, and I can ping them no trouble. The problem is when I come to actually use them with a client-server program I am developing:

The server program opens up a socket and binds it to one of the addresses, but when it tries to bind a second socket to one of the other address, I get the error “Address in use” - so it seems that I can’t actually set up concurrent servers on the different addresses.

Further, when the client program tries to connect with the one open server socket, it will quite happily connect with the server irrespective of the address used by the server, so long as it is connecting to one of those I have configured, or is the primary address.

I hope I have explained this clearly enough …

I am programming in C.


Keith Moore

Anthony Cartmell
November 14, 2007: 8:42 am

Don’t forget to add the :0, :1, etc as in the filename to the DEVICE= lines in each file!

will not be displayed