Multiple IP-addresses on one interface

Ow Mun Heng ow.mun.heng at wdc.com
Fri May 7 10:17:16 UTC 2004



> -----Original Message-----
> From: Alexander Dalloz [mailto:alexander.dalloz at uni-bielefeld.de]
> Sent: Friday, May 07, 2004 6:11 PM
> To: For users of Fedora Core releases
> Subject: Re: Multiple IP-addresses on one interface
> 
> 
> Am Fr, den 07.05.2004 schrieb Ola Thoresen um 11:10:
> 
> > What is the _right_ way to set multiple ip addresses on a single
> > interface.
> > 
> > I know I could either use ifcfg-eth0:0, ifcfg-eth0:1 and so on but I
> > would prefer not to have these "old" aliases.
> 
> Me too.
> 
> > The problem with adding the addresses in rc.local 
> > (IE /sbin/ip addr add xx.xx.xx.xx/xx dev eth0) is that if 
> services are
> > configured to listen to different addresses they will not 
> start, unless
> > I also add 'service xxxx start' to the bottom of rc.local.
> 
> Correct, not that good.
> 
> > This is not a huge problem, but there should be a better way than
> > repeating the whole init after the addresses are set in rc.local.
> 
> > Rgds.
> > 
> > Ola Thoresen
> 
> I had exactly the same problem with my FC1 server too, handling a /27
> net. Unfortunately the system is only prepared for aliased 
> device range
> handling. I asked on the devel list but did not fill in an RFE with
> bugzilla.
> 
> So finally I "hacked" it into the system script that sets up the
> devices. Though it works proper without any complications it 
> is far from
> best because it is a modification of a system script.
> 
> Go to /etc/sysconfig/network-scripts/ifup line 360. Below 
> that line add
> following:
> 
>     if [ ${DEVICE} = "eth0" ]; then
>          for i in `seq 101 126`; do
>             ip addr add 128.21.220.$i/27 brd 128.21.220.127 dev eth0
> label eth0
>          done
>     fi
> 
> (that is a 5 liner; the line starting with "ip addr" ends with "label
> eth0" is single, probably wrapped in mail)
> 
> That will add IPs 128.21.220.101 - 128.21.220.126 to the eth0 device,
> given that all IPs are in the same net (have same netmask). 
> You can list
> assigned IPs using "ip addr list". "ifconfig" is limited and will not
> show you the additional IPs.

Interesting configuration.
Stupid Q: Why are there up to 25 address aliased to 1 single NIC?
	    Are you using it as a router or something? Virtual IP based
(web)Servers? 





More information about the fedora-list mailing list