Adding range of IPs via network-scripts not working

Issues related to configuring your network
Post Reply
hendr1
Posts: 1
Joined: 2019/12/05 15:34:33

Adding range of IPs via network-scripts not working

Post by hendr1 » 2019/12/05 15:51:34

Hello everyone,
In centos 7 I was able to create a file "/etc/sysconfig/network-scripts/ifcfg-eth0-range0" and it would allow me to assign multiple ip addresses permanently to the network device. This doesn't seem to work any more...

Start with eth0 output of /sbin/ifconfig

Code: Select all

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet ****removed***  netmask 255.255.255.0  broadcast ****removed***
        inet6 ****removed***  prefixlen 64  scopeid 0x20<link>
        ether ****removed***  txqueuelen 1000  (Ethernet)
        RX packets 469639  bytes 53769807 (51.2 MiB)
        RX errors 0  dropped 60  overruns 0  frame 0
        TX packets 783169  bytes 931699519 (888.5 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device memory 0xdf960000-df97ffff
Sample attempt example :

Code: Select all

IPADDR_START=removed
IPADDR_END=removed
CLONENUM_START=0
I added prefix (warning still always appears), type, device, onboot values (and probably others) without the system assigning the ip addresses. It seems like it is trying to load the file as a connection.

This is network log output

Code: Select all

9879.7394] ifcfg-rh: loading "/etc/sysconfig/network-scripts/ifcfg-eth0-range0" fails: File '/etc/sysconfig/network-scripts/ifcfg-eth0-range0' had neither TYPE nor DEVICE keys.
9879.7398] ifcfg-rh:     missing PREFIX, assuming ****removed***/24
9879.7407] ifcfg-rh: new connection /etc/sysconfig/network-scripts/ifcfg-eth0 (53bc873d-4d0d-4deb-a594-932d03acdfde,"eth0")
9879.7416] ifcfg-rh: new connection /etc/sysconfig/network-scripts/ifcfg-eno1 (2363e204-3ae4-4f0d-a3cb-fa572736e9f1,"eno1")
9879.7423] ifcfg-rh: new connection /etc/sysconfig/network-scripts/ifcfg-eth2 (18a0adc8-2f60-4f71-b98b-b264cc48ff60,"eth2")
9879.7431] ifcfg-rh: new connection /etc/sysconfig/network-scripts/ifcfg-eth3 (d8d81606-ff51-489f-a141-068861176bd8,"eth3")
Another example

Code: Select all

DEVICE=eth0
IPADDR_START=removed
IPADDR_END=removed
PREFIX=32
CLONENUM_START=0

Code: Select all

0911.5365] ifcfg-rh: loading "/etc/sysconfig/network-scripts/ifcfg-eth0-range0" fails: ipv4.addresses: this property cannot be empty for 'method=manual'
0911.5366] ifcfg-rh:     missing PREFIX, assuming ****removed***/24

User avatar
TrevorH
Forum Moderator
Posts: 29112
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Adding range of IPs via network-scripts not working

Post by TrevorH » 2019/12/05 16:51:33

RHEL/CentOS 8 now uses NetworkManager for everything and I am not sure if it supports range files. I think it doesn't...
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

User avatar
jlehtone
Posts: 2931
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Adding range of IPs via network-scripts not working

Post by jlehtone » 2019/12/06 11:22:35

A script?

Code: Select all

for X in <addresses>
do sudo nmcli con mod eth0 +ipv4.addresses "${X}"
done
How you get from <range> to <addresses> ... I'm sure you can come up with something.

Post Reply

Return to “CentOS 8 - Networking Support”