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

Joao Medeiros joao.c.medeiros at gmail.com
Fri Jun 24 12:19:26 UTC 2005


I found what the problem is... I have Firestarter installed and If I turn it
off I can access the web site with the ip alias. I wouldn't like to have to
turn the firewall off. Any thoughts?

TIA,
--JM

-----Original Message-----
From: centos-bounces at centos.org [mailto:centos-bounces at centos.org] On Behalf
Of Alexander Dalloz
Sent: 23 June 2005 23:56
To: CentOS mailing list
Subject: Re: Betr.: [CentOS] Multiple IP Addresses in a single NIC

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 




More information about the CentOS mailing list