I have a dedicated server with one network card in it. I however got two IP addresses. When I use the simple command sudo ip addr add dev eth0 it fails to see it as a separate IP. I've googled along trying to find a fix, but I can't really find out what packages I need to set up a switch, and how to do it.

My dedicated server runs with the following specifications:

  • 16GB DDR3 RAM ( intel i7 )
  • OS: ubuntu 14.01

These are the two most important ones, I believe; I've got no idea what network card my dedicated server has, but I know it supports IEEE 802.1q, which I found out on the Ubuntu website.

  • What does ip addr show say after running that command and what does "it fails to see it as a separate IP" mean? Jan 13, 2015 at 3:06
  • I found that ip addr was temporary. I've re-routed the NIC and now it works. I have forgotten to bind my processes too.
    – Sam
    Jan 13, 2015 at 23:11
  • I also need that and i found a best answer "How to Assigning multiple Virtual IPs to a NIC" on this site linuxinpakistan.com/assigning-multiple-virtual-ips-nic
    – Mari Criss
    Sep 23, 2017 at 8:04

3 Answers 3


I'm not quite sure exactly what you're trying to accomplish. I am assuming that your question could be re-titled "How to set up two IPs on a single network interface."

Each network interface on your machine is given an identifier. Typically, you start with eth0 and work your way up (eth1, eth2, eth3). These are all physically different network cards.

You can also have virtual cards on top of each of your physical cards. This is how you would set up multiple IPs on the same NIC.

To set this up, you can use the following example, changing the addresses to suit your needs (/etc/network/interfaces):

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0 eth0:0
allow-hotplug eth0 eth0:0

iface eth0 inet static

#eth0:0 (LAN)
iface eth0:0 inet static

The tricky part could be the netmask. Try if you aren't sure.


If you set a secondary IP for eth0, it should be set to eth0:0:

sudo ip addr add dev eth0:0
  • 3
    Please explain your answer more clearly. How would the OP set the IP? Using which command? Editing what file? Could you provide an example? Perhaps explain what eth0:0 means? We expect answers here to be comprehensive.
    – terdon
    Jan 8, 2015 at 11:48
  • The command is exactly the same as the OP is using to add an IP to begin with, just use eth0:0 instead of eth0.
    – Elias
    Jan 8, 2015 at 11:53
  • 1
    Please edit your answer to add extra information, it is hard to read and easy to miss in the comments. Just add an extra line showing the command the OP would need to run.
    – terdon
    Jan 8, 2015 at 12:04
  • This has not done the trick. It instead gives priority to the second port I open up ( same ports ), but it does not seperate those.
    – Sam
    Jan 8, 2015 at 16:44
  • What are you actually trying to accomplish and how is your routing set up?
    – Elias
    Jan 8, 2015 at 17:04

On Ubuntu you could try this:

If you have two IP adresses configured on your server, to see them you could run a simple ifconfig:

# ifconfig

eth1  Link encap:Ethernet  HWaddr 00:aB:cD:eF:Gh:Ij  
      inet addr:X.X.X.X  Bcast:X.X.X.X  Mask: # IP address ONE
      inet6 addr: fe80::230:48ff:fe34:1c17/64 Scope:Link

eth1:0 Link encap:Ethernet  HWaddr 00:aB:cD:eF:Gh:Ij  
      inet addr:X.X.X.X  Bcast:X.X.X.X  Mask: # IP address TWO

If you want to configure your second IP address in the same NIC you must specify your NIC interface & create a virtual IP:

# ifconfig eth1:0 X.X.X.X netmask # Setting up IP address TWO

If you want to reach a specific address through your virtual or secondary IP, you could make a route.

# ip route add <target> via <network IP> dev <NIC interface [eth1]> [SECOND IP]

Not the answer you're looking for? Browse other questions tagged .