How to Configure Additional IP Addresses on AlmaLinux Rocky Linux CentOS
Additional IP addresses refer to extra network addresses assigned to a device or network interface beyond its primary or default IP address. IP addresses are unique numerical labels assigned to each device connected to a computer network that uses the Internet Protocol for communication.
If you wish to configure Static IPv4 as well, checkout this guide How to Configure Static IPv4 Address on AlmaLinux RockyLinux and CentOS
- If you wish to configure IPv6 as well, checkout this guide How to Configure IPv6 Address on AlmaLinux RockyLinux and CentOS
Identify the Network Interface
Determine the name of your network interface. You can use the ip a
or ifconfig
command to list available interfaces.
Common names for interface include ens3, eth0, enp3s0 and many more,
ip a
Output:
root@vps ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 1.2.3.4 brd ff:ff:ff:ff:ff:ff
altname enp0s3
inet 192.168.0.24/24 brd 192.169.6.255 scope global noprefixroute ens3
valid_lft forever preferred_lft forever
inet6 2604:0456:0145::1/64 scope link noprefixroute
valid_lft forever preferred_lft forever
[root@vps ~]#
from the above output, the network interface is ens3.
also, you can find the IP address information from CrownPanel, Refer to our wiki on How to View Network Information in CrownPanel.
Modify the Connection
Run the following command to modify the connection and add additional IP addresses,
nmcli connection modify "ens3" +ipv4.addresses "192.168.1.10/24" +ipv4.gateway "192.168.1.1" +ipv4.dns "8.8.8.8,8.8.4.4"
The same command for another range of additional IP Addresses,
nmcli connection modify "ens3" +ipv4.addresses "104.200.67.17/24" +ipv4.gateway "104.200.67.1" +ipv4.dns "8.8.8.8,8.8.4.4"
Note: Replace "interface" ens3 with the actual interface name that is on your server. Replace "address" 192.168.0.10/24 with the actual IP address that is assigned to your server. Replace "gateway" 192.168.0.1 with the actual Gateway address assigned to the server.
Restart Network Service
Once the modification for network interface has been updated with the additional IPs information, we will go onto restart the NetworkManager for the changes to take effect.
systemctl restart NetworkManager
This concludes our topic of configuring Additional IP Addresses on the AlmaLinux, Rocky Linux, and CentOS Stream 9 using NetworkManager.
CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME
for 10% off!
1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month
Available Locations: LAX | MIA | ATL | FRA | AMS