Linux – binding range of IPs in Centos, not working

bindcentosifconfiglinuxnetworking

I'm trying to bind 8 x /24 subnets in Centos. I set up the usual primary in /etc/sysconfig/network-scripts/ifcg-eth0 for the default /29 assigned to the box. All good, I'm in ssh fine.

Now, I'm trying to add the additional 8 C classes of IPs using this method

cp -p ifcfg-eth0 ifcfg-eth0-range0
cp -p ifcfg-eth0 ifcfg-eth0-range1
cp -p ifcfg-eth0 ifcfg-eth0-range2

etc...

all the way through range7

I restart the network, first C class (range0) works fine, but range1-7 give off similar errors all the way through like this

error in ifcfg-eth0-range7: already seen device eth0:182 in ifcfg-eth0-range6

In network-scripts I have them as

fcfg-eth0-range0
ifcfg-eth0-range1
ifcfg-eth0-range2
ifcfg-eth0-range3
ifcfg-eth0-range4
ifcfg-eth0-range5
ifcfg-eth0-range6
ifcfg-eth0-range7

I even tried

Each range file loos like this…

[root@login-third network-scripts]# cat ifcfg-eth0-range0
DEVICE=eth0
TYPE="Ethernet"
IPADDR_START=xxx.xxx.38.2
IPADDR_END=xxx.xxx.254

range1 example…

[root@login-third network-scripts]# cat ifcfg-eth0-range1
DEVICE=eth0:1
TYPE="Ethernet"
IPADDR_START=xxx.xxx.39.2
IPADDR_END=xxx.xxx.39.254

I originally tried without the DEVICE line too, same errors.

What am I doing wrong here?

Best Answer

There shouldn't be a DEVICE in the range files.
But there should be a CLONENUM_START.
Setting that will correctly map the addresses to the virtual NICs without assigning the same device twice.

Example: in ifcfg-eth0-range0 you set CLONENUM_START=0.
xxx.xxx.38.2 => eth0:0
xxx.xxx.38.3 => eth0:1
...

In ifcfg-eth0-range0 you set CLONENUM_START=255.
xxx.xxx.39.2 => eth0:255
xxx.xxx.39.3 => eth0:256
...

See also:
https://wiki.centos.org/VladislavRastrusny/OneNICManyIPs

Related Topic