Avatar of mickt
mickt
Flag for Ireland asked on

I have disabled CNDN but cannot define the order of ethX

I need to restore "eth" naming on my CentOS7 servers so that I can continue using various scripts.  I have disabled Consistent Network Device Naming by adding net.ifnames=0 to grub and have renamed and edited the ifcfg files and also created a persistent-net.rules file.  I did not install the biosdevname RPM hence no reference in grub.

Let's follow MAC, d8:d3:85:c4:a2:f0, which should be eth0.

# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
BOOTPROTO=none
HWADDR=d8:d3:85:c4:a2:f0
ONBOOT=yes
NETBOOT=yes
IPADDR0=10.10.12.9
NETMASK0=255.255.255.0
GATEWAY0=10.10.12.1
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes

# cat /etc/udev/rules.d/70-persistent-net.rules
"SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="d8:d3:85:c4:a2:f0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
"SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="d8:d3:85:c4:a2:f4", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
"SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="9c:8e:99:29:45:48", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
"SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="9c:8e:99:29:45:4a", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"
"SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="68:b5:99:cb:4e:18", ATTR{type}=="1", KERNEL=="eth*", NAME="eth4"
"SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="68:b5:99:cb:4e:1a", ATTR{type}=="1", KERNEL=="eth*", NAME="eth5"

# ifconfig eth0
eth0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 9c:8e:99:29:45:48  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

# ifconfig eth4
eth4: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.10.12.9  netmask 255.255.255.0  broadcast 10.10.12.255
        inet6 fe80::dad3:85ff:fec4:a2f0  prefixlen 64  scopeid 0x20<link>
        ether d8:d3:85:c4:a2:f0  txqueuelen 1000  (Ethernet)
        RX packets 10640  bytes 724244 (707.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 42762  bytes 11489169 (10.9 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 28  memory 0xf1000000-f17fffff

Did I miss something during the configuration?
Linux DistributionsLinux Networking

Avatar of undefined
Last Comment
mickt

8/22/2022 - Mon
mickt

ASKER
I just noticed that the UUID is missing from the ifcfg files.  I'll add it and see how it goes.


Another thing is that not every interface has an ifcfg file (before disabling CNDN).  Anyone know why this might be?
Stampel

Can you still disable NetworkManager service and enable network service ?
gheist

You dont need UUID, MAC is alrady globally unique.
MAC in your ifcfg is from ETH3, so you need to rename that ifcfg file ifcfg-eth3 and make sure interface is eth3, otherwise networking scripts will ignore that file.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
mickt

ASKER
When I disable NetworkManager and enable network service only lo come up.  messages indicates incorrect MAC for eth0.
mickt

ASKER
gheist:
Why do you say eth3?  I set MAC d8:d3:85:c4:a2:f0 in both ifcfg-eth0 and 70-persistent-net.rules.  It is coming up as eth4 despite this configuration.
mickt

ASKER
The ifconfig eth0 command above shows MAC (9c:8e:99:29:45:48) from eth2 as per ifcfg-eth2 and 70-persistent-net.rules files, not the one for eth0 as expected.

The 70-persistent-net.rules entries shown above directly correlate with the new ifcfg-ethX files.

If I create ifcfg files and 70-persistent-net.rules file with specific correlated MAC addresses, why do they not come up as so but appear with different ones when checked with ifconfig?

Where does ifconfig get it's information from?
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
gheist

remove udev persistent rules and reboot to re-generate them
then adjust ifcfg-eth* files to match the new world.
then "service network restart"

I think you missed wiping udev dynamic rules when dumping the "biosdevnames"
mickt

ASKER
There was no rules file after initial boot.  I created it in the hope that it would associate MAC with interface etc. but it seems that it doesn't.

An important thing of note here is that this was a fully working server on CentOS6 with this NIC as eth0 (the physical network is connected to this NIC).

I have multiple servers and require specific interfaces on specific NICs due to NIC speeds etc.
mickt

ASKER
Here are the interfaces before I make changes.  The 1st is what I want as eth0.  It is one of two interfaces on the embedded NIC.  The remaining interfaces are on two mezz cards.  Basically all I'm trying to do is make enp2s0f0 eth0.  The contents of ifcfg-eth0 is what was ifcfg-enp2s0f0 with appropriate changes.

Who'd have thought it would be so difficult?! :)

# ifconfig
enp2s0f0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.10.12.9  netmask 255.255.255.0  broadcast 10.10.12.255
        inet6 fe80::dad3:85ff:fec4:a2f0  prefixlen 64  scopeid 0x20<link>
        ether d8:d3:85:c4:a2:f0  txqueuelen 1000  (Ethernet)
        RX packets 421  bytes 30447 (29.7 KiB)
        RX errors 0  dropped 4  overruns 0  frame 0
        TX packets 84  bytes 12849 (12.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 28  memory 0xf1000000-f17fffff

enp2s0f1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::dad3:85ff:fec4:a2f4  prefixlen 64  scopeid 0x20<link>
        ether d8:d3:85:c4:a2:f4  txqueuelen 1000  (Ethernet)
        RX packets 5  bytes 700 (700.0 B)
        RX errors 0  dropped 2  overruns 0  frame 0
        TX packets 14  bytes 2268 (2.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 40  memory 0xf0000000-f07fffff

ens1f0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 9c:8e:99:29:45:48  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens1f1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 9c:8e:99:29:45:4a  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens2f0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::6ab5:99ff:fecb:4e18  prefixlen 64  scopeid 0x20<link>
        ether 68:b5:99:cb:4e:18  txqueuelen 1000  (Ethernet)
        RX packets 432  bytes 29084 (28.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 17  bytes 2490 (2.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens2f1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 68:b5:99:cb:4e:1a  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 6  bytes 560 (560.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 6  bytes 560 (560.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
Your help has saved me hundreds of hours of internet surfing.
fblack61
gheist

Boot, let it create default udev rules
then adjust udev rules, reboot again and check ifconfig if MACs are correct.
mickt

ASKER
It is not creating the files.
gheist

It is not the udev we are used to, it is another thing:
http://www.freedesktop.org/software/systemd/man/systemd-udevd.service.html
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
mickt

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
mickt

ASKER
configured bond0 on each server