How to add a second IP to Ubuntu

How to add a second IP to Ubuntu

It is very usual for network users, need to add multiple IPs to the operating system’s network card. So you would learn How to add a second IP to Ubuntu today. Previously we said about set IP static on Ubuntu, and in this tutorial, we will review and teach the desired Linux commands. Adding a second IP to Ubuntu requires entering several commands.

 

How to add a second IP to Ubuntu

You can add a second IP to Ubuntu in two ways.

1– Temporary

2– Permanent

How to add a second temporary IP

1– Enter your Linux Ubuntu terminal environment.
2. Enter the following command to add the second IP.

sudo ifconfig eth0:0 192.168.1.2 netmask 255.255.255.0 up

In the above example, you should add the address 192.168.1.2 to Ubuntu as the second IP.

Note: The above IP command is valid until the foot system is rebooted and will be removed after the operating system reboots.

Do you need your own Ubuntu VPS? Join us here

How to add a second permanent IP

1– Enter your Linux Ubuntu terminal environment.

2– Open /etc/network/interfaces file with an editor.

nano /etc/network/interfaces

3– Enter the following phrase at the end of the opened file.

auto eth0:0
iface eth0:0 inet static
address 192.168.1.2 network 192.168.1.0
netmask 255.255.255.0

Instead of the written IP address, enter your desired IP.

Note: The key point in this section is to add the eth0:0 option, which must be followed, and the rest of the lines are like setting the first IP.

4– Save the file and exit.

5– Turn off / on the added virtual card once, with the following commands.

ifdown eth0:0 ifup eth 0:0

In this section, the additional IP  is completed. Watch to not lose our future related articles.

 

Dear user, we hope you would enjoy this tutorial, you can ask questions about this training in the comments section, or to solve other problems in the field of Eldernode training, refer to the Ask page section and raise your problems in it.

 

Use of this Site is subject to express terms of use. By using this site, you signify that you agree to be bound by these