Linux

How To Configure Additional IPs Using NMCLI

nmcli is a command-line tool used to control NetworkManager and report network status on AlmaLinux, RockyLinux, CentOS and other Red Hat derivatives. NMCLI allows you to manage additional IPs, network connections and devices without needing a graphical interface. Here are some key features and uses of nmcli:

  1. Create, Display, Edit, and Delete Network Connections: You can manage your network connections directly from the command line.
  2. Activate and Deactivate Network Connections: Easily start or stop network connections as needed.
  3. View Network Device Status: Check the status of your network devices and connections.
  4. Script Integration: nmcli supports a terse output format, making it suitable for use in scripts to automate network management tasks.
  5. Headless Machines: Ideal for servers and machines without a graphical user interface, allowing full network management capabilities.

For example, to view the status of all network devices, you can use the command:

nmcli device status

Configure Additional IPs Using NMCLI

NMCLI will also allow you to configure any additional IPv4 and IPv6 IPs assigned to your Cloud VPS or NVMe VPS when using AlmaLinux, RockyLinux or CentOS. First, determine which interface your IPv4 need assigning to.

nmcli connection show

On the First2Host network your interface is usually eth0 as indicated below.

Copy the UUID of the interface and issue the command switching the UUID for your UUID.

nmcli connection edit 5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03

You can see the current assigned IPv4 with the print command. Usually, there will just be your virtual servers main IPv4.

print ipv4.address

Configure Additional IPv4 AlmaLinux 9 / RockyLinux 9

To configure additional IPv4 or IPv6 you can use the set ipv4.address and set ipv6.address commands.

set ipv4.address

In the console specify all of the IPv4 you would like to configure in the server. Ensure each IPv4 is separated by a comma ,.

51.xXx.149.x, 91.xXx.173.172, 137.xx.49.2X2, 198.xXx.4.8

Once you have added all of your IPv4 or IPv6, issue save and quit. Reboot the server to ensure the configuration is applied.

save
quit

You can use NMCLI on AlmaLinux, RockyLinux, CentOS and other Red Hat derivatives to add further IPv4 and IPv6.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button