Adding a secondary IP address allows your server to respond to multiple IPs on the same network card. The method varies slightly depending on your Linux distribution and whether you’re using the old ifcfg
system or the newer ip
/nmcli
tools.
Temporary Method (until reboot)
Use the ip
command to add a secondary IP immediately:
-
192.168.1.50/24
→ the secondary IP with subnet mask -
eth0
→ your network interface name
This change lasts until the next reboot.
Persistent Method (AlmaLinux / CentOS / RHEL with ifcfg)
Create a new configuration file such as:
With content like:
Then restart networking:
Persistent Method (with NetworkManager / nmcli)
Verification
Check that the secondary IP is active:
✅ Tip: Always ensure your hosting provider or upstream network has routed the new IPs to your server, otherwise they won’t function correctly.