Multiple IP-addresses on one interface

neil neilcuk at aol.com
Fri May 7 10:24:52 UTC 2004



alexander.dalloz at uni-bielefeld.de wrote:

>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
>
>
>  
>
Just curious - what if you appended your address in 
/etc/sysconfig/network-scripts/ifcfg-eth0 to

IPADDR=128.21.220.101-126

or

IPADDR=128.21.220.101-128.21.220.126

worth a go :-)

neil





More information about the users mailing list