Multiple IP-addresses on one interface

Alexander Dalloz alexander.dalloz at uni-bielefeld.de
Fri May 7 10:10:40 UTC 2004


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.

Alexander


-- 
Alexander Dalloz | Enger, Germany | GPG key 1024D/ED695653 1999-07-13
Fedora GNU/Linux Core 1 (Yarrow) on Athlon CPU kernel 2.4.22-1.2188.nptl
Sirendipity 11:53:48 up 10 days, 10:42, load average: 0.04, 0.11, 0.09 
                   [ Γνωθι σ'αυτον - gnothi seauton ]
             my life is a planetarium - and you are the stars
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://lists.fedoraproject.org/pipermail/users/attachments/20040507/00c0d13c/attachment-0002.bin 


More information about the users mailing list