Betr.: [CentOS] Multiple IP Addresses in a single NIC

Alexander Dalloz ad+lists at uni-x.org
Thu Jun 23 22:55:52 UTC 2005


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


-- 
Alexander Dalloz | Enger, Germany | GPG http://pgp.mit.edu 0xB366A773
legal statement: http://www.uni-x.org/legal.html
Fedora Core 2 GNU/Linux on Athlon with kernel 2.6.11-1.27_FC2smp 
Serendipity 00:40:31 up 2 days, 8:54, load average: 0.44, 0.45, 0.35 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
URL: <http://lists.centos.org/pipermail/centos/attachments/20050624/19160b44/attachment.sig>


More information about the CentOS mailing list