Networking Ubuntu

Add additional IP’s to Ubuntu Server

Here is how to add additional IP’s to your Ubuntu server

Add it to the server just on a temporary basis. A reboot will erase the changes.

Using ifconfig

If you want to add a secondary IP address to a NIC already in use in Linux, and have that change only temporary. Enter this command:

# ifconfig [nic]:0 [IP-Address] netmask [mask] up


#ifconfig eth0:0 netmask up

If you prefer to use the ip command instead of ifconfig

# ip address add [ip]/[mask-digits] dev [nic]

IP command example

#ip address add dev eth0

With this command you can add more ip address to the same NIC, the second is considered as secondary.

Add a permanent IP address to the Server

For Ubuntu systems, edit the /etc/network/interfaces file

# nano /etc/network/interfaces


auto eth0:1
iface eth0:1 inet static

The restart networking for the changes to take effect

~# service networking restart
 * Reconfiguring network interfaces... 

Check to see if the IP’s re enabled

# ifconfig

You should see the additional IP’s here

You can add What you need. Just change eth0:1 for eth0:2, eth0:3 etc. This can also be done for any other network cards like eth1, eth2, etc.

If the network show this:

# nano /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

auto em1
iface em1 inet static
address 162.xx.xx.xx
gateway 162.xx.xx.1
broadcast 162.xx.xx.255

Add this

auto em2
iface em1 inet static