Configure IP Aliases in Red Hat / CentOS
IP aliasing is a term for assigning multiple IP addresses to a single network interface. It is quite useful in a shared web hosting for instance, particularly if the domains have SSL certificates. You can setup each domain to resolve to different IP address, even if they are all sharing the same network interface.
You have to be root to perform this tasks.
1. Disable Network Manager
# service NetworkManager stop # chkconfig NetworkManager off
2. Add IP alias from cli
# ip addr addr add 192.168.0.11/24 dev eth0 label eth0:1 # ip addr show eth0
3. Persistently add lias
Create the file /etc/sysconfig/network-scripts/ifcfg-eth0:1
# cat /etc/sysconfig/network-scripts/ifcfg-eth0:1 DEVICE=eth0:1 IPADDR=192.168.0.11 PREFIX=24 ONPARENT=yes
4. Restart network service
# service network restart # ip addr show eth0