Am Fr, den 24.06.2005 schrieb Thom van der Boon um 0:34:
You need to issue two commands:
/sbin/ifconfig eth0:0 xxx.xxx.xxx.xxx /sbin/route add -host xxx.xxx.xxx.xxx dev eth0
For example:
/sbin/ifconfig eth0:0 172.16.1.199 /sbin/route add -host 172.16.1.199 dev eth0
No route setting needed. The aliased device is anyway handled over the real device.
You can even assign multiple aliases to one NIC (One of my servers has about 10 ip addresses):
For example:
/sbin/ifconfig eth0:0 172.16.1.199 /sbin/route add -host 172.16.1.199 dev eth0
/sbin/ifconfig eth0:1 172.16.1.198 /sbin/route add -host 172.16.1.198 dev eth0
/sbin/ifconfig eth0:2 172.16.1.197 /sbin/route add -host 172.16.1.197 dev eth0
and so on.....
You should write an startup script to execute these commands at boot time, because after a reboot the aliases are forgotten.
This isn't recommended this way.
Thom van der Boon
CentOS has native configuration ways to handle aliased devices. Either by running redhat-config-network (3.5) or system-config-network (4.1) and then choosing an aliased device or by hand: copying /etc/sysconfig/network-scripts/ifcfg-eth1 as ifcfg-eth1:0 ... ifcfg-eth1:1 ... and then changing the content of the ifcfg-eth0:X file regarding DEVICE name, IP data and HWADDR (MAC). A "service network restart" will bring up the new aliased device(s) together with the real ones. "ifconfig" shows eth0:X (X0number) and "ip addr ls" will show the additional IP(s) as part of the real device.
Alexander