Skip to main content

Multiple IPs on the Same Interface

Hands-On Lab

 

Photo of Michael Christian

Michael Christian

Course Development Director in Content

Length

01:00:00

Difficulty

Intermediate

In this learning activity, you're being tasked with adding two more IPs to the the existing environment. There is currently a private IP of 10.0.1.10. You must add 10.0.1.15 and 10.0.1.20.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Multiple IPs on the Same Interface

The Scenario

In preparation for migrating additional services to a new host, we must provision two more IP addresses on it. These IP addresses are 10.0.1.15 and 10.0.1.20, on the same subnet as the existing IP.

Get logged in

Use the credentials and server IP in the hands-on lab overview page to log into our lab server. Once we're in, we can get moving.

Add the Additional IP Address Configuration

First, let's see how things are currently sitting, and get our IP address at the moment:

[cloud_user@host]$ nmcli c
[cloud_user@host]$ nmcli d show eth0

The command we can use to add the additional addresses is:

[cloud_user@host]$ sudo nmcli c mod System eth0 ipv4.addresses 10.0.1.15/24,10.0.1.20/24

To check where things stand now, run:

[cloud_user@host]$ nmcli c show System eth0 | grep ipv4

Restart Networking

Once we're confident in the configuration, we can restart networking using:

[cloud_user@host]$ sudo systemctl restart network

Now we can run:

[cloud_user@host]$ nmcli

This should show that we have the three IP addresses.

Conclusion

That was it. We just needed to add a couple of IP addresses to our interface, and we're done. Congratulations!