English
+370 5 205 5502 sales@monovm.com

How to Add Extra IPs to Ubuntu OS?

In this article, we are going to show you how to add the extra IP on one NIC (Network Interface Controller) in Ubuntu.

12 Mar, 21 by Sophia H 4 min Read

List of content you will read in this article:

A VPS, or virtual private server, is a very multifunctional tool that can be used for a large variety of things. Sometimes you need to have multiple IP addresses to do the thing you want, however, without decent technical knowledge, it could turn into quite a complex task.

Worry not! In this article, we will show you how to add extra IPs on Ubuntu-based systems as well as delve a little into what an IP address actually is. If you wish to do the same with a CentOS system, check out our article on how to add Extra IP to CentOS.

 

IP stands for Internet Protocol and is the addressing system computers and all other internet-connected devices use to communicate with one another. To explain it better, it is easiest to compare it to a phone number. To reach a friend by phone, you need to dial his or her phone number, without it you will not be able to connect with them. An IP address is like a computer’s phone number, it allows other computers to know where to send data in order to reach it. This is how a standard IP address looks like:

127.0.0.1

There are two versions of the internet protocol that are being used nowadays: IPv4 and IPv6. Both carry out the same function but are written in different formats. IPv4, or Internet Protocol version 4, is an 8-bit number that uses the decimal system. IPv6, or Internet Protocol version 6, on the other hand, is a 16-bit value that uses the hexadecimal system, meaning it can have numbers from 0 to 9 and letters A through F.

If you wish to learn more about the IP addressing system and what types of IPs there are, check out our informative blog on the types of IP addresses.

 

If you want to add an extra IP on one NIC (Network Interface Controller) in Ubuntu Linux, you have two options. Either use a temporary IP or a permanent one.

 

Adding a temporary extra IP:

Temporary IPs are valid until the system is rebooted.

Step 1: Enter the Ubuntu terminal

Step 2: Enter the following command to add the temporary extra IP

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

An example is shown below

ifconfig eth0:0 192.168.1.2 netmask 255.255.255.0 up

 

Adding Permanent extra IP:

This IP won’t be deleted if you reboot the system.

Step 1: Enter the Ubuntu terminal

Step 2: Open the ‘/etc/network/interfaces’ file with the editor of your choice, we are using the nano editor for this example.

nano /etc/network/interfaces

Step 3: Insert the following code at the end of the file:   

auto [NIC]:[n]

iface [NIC]:[n]

inet staticaddress [ip add]

gateway [gate way]

netmask [net mask]

For example:

auto eth0:1

iface eth0:1

inet staticaddress 192.168.0.1

gateway 192.168.0.254

netmask 255.255.255.0

 

And that’s it, now you know how to add extra IPs. To add more IPs simply follow the above steps. Just change eth0:1 to eth0:2 and so on.

In order to add extra IPs to your Linux VPS server, you can easily order extra IP in your Monovm client control panel, and it will be automatically will be added to your OS network interface.

 

Now you should have a general understanding of how the internet protocol addressing system works. By following the simple steps outlined in this blog, you should also be able to add both temporary and permanent IP addresses to your Ubuntu system. If you have any questions or suggestions please leave them in the comment section below.

Sophia H

My name is Sophia H. My degree is MS in Information Technology Engineering. I have been working for 5 years on Java developing (j2ee), Computer Networking (Optical Networks), Virtualization and Hosting.