20 июня 2011 г.

Adding an IP-alias to CentOS server

In order to add an IP-alias to CentOS-powered server, go to /etc/sysconfig/network-scripts and create a new file eth0:X where X is the last existing interface's number incremented by 1.
Type this to see all enabled interfaces:
ifconfig

Result example:
eth0 Link encap:Ethernet HWaddr ...
eth0:1 Link encap:Ethernet HWaddr ...
lo Link encap:Local Loopback ...

This means X would be 2 in our case. So let's create a new file named eth0:2 with the following contents:
# Intel Corporation 82540EM Gigabit Ethernet Controller
DEVICE=eth0:2
BOOTPROTO=static
IPADDR=%IP_ALIAS%
NETMASK=255.255.255.0
NETWORK=%GATEWAY_IP%
ONBOOT=yes


Start:
ifup eth0:2

Комментариев нет: