Changing eth0 on CentOS 7 machines to allow upgrade to AlmaLinux 8
The problem:
Risk Factor: high (inhibitor)
Title: Unsupported network configuration
Summary: Detected multiple physical network interfaces where one or more use kernel naming (e.g. eth0). Upgrade process can not continue because stability of names can not be guaranteed. Please read the article at https://access.redhat.com/solutions/4067471 for more information.
Of course you cannot access the RedHat solution without paying for it.
The solution:
It sounds scary so make a backup.
Find the names of your ethernet cards by running this command:
# ifconfig | grep eth[0-9]
You will get something like this:
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
Most likely they are named ethX if you are reading this.
Since Linux handles device names via the udev system, edit this file:
/etc/udev/rules.d/70-persistent-net.rules
(You can delete that file as well as it gets rewritten on boot).
It looks something like this:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="de:2a:09:26:fb:2e", NAME="eth1"SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="c2:b0:be:9d:49:ad", NAME="eth0"
Change the “eth1” and “eth0” at the end to something else. Does not matter what. For example, I’ll name this after my dogs:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="de:2a:09:26:fb:2e", NAME=“pug123"SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="c2:b0:be:9d:49:ad", NAME=“pug012"
Remember which ones you renamed (or write it down). Then go here:
cd /etc/sysconfig/network-scripts/
Rename the following:
mv ifcfg-eth0 ifcfg-pug012
mv ifcfg-eth1 ifcfg-pug123
Be sure you get them right or you can brick the system on reboot.
Edit both files and change the following:
BOOTPROTO=none DEFROUTE=yes DEVICE=eth0 # change to pug012 or pug123; whatever corresponds to the name you gaveit. GATEWAY=68.183.128.1 HWADDR=c2:b0:be:9d:49:ad IPADDR=68.183.143.91 IPADDR1=10.10.0.51 MTU=1500 NETMASK=255.255.240.0 NETMASK1=255.255.0.0 ONBOOT=yes STARTMODE=auto TYPE=Ethernet USERCTL=no
That’s it! Restart and run this to see the change (remember to change “pug” to whatever you named it):
ifconfig | grep pug[0-9]
pug012: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 pug123: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
Or, if you want to just run a script to change it, here you are. It has NOT been tested so, as always, be careful!
#!/bin/bash sed 's/eth0/wmd10/1' /etc/udev/rules.d/70-persistent-net.rules sed 's/eth1/wmd11/1' /etc/udev/rules.d/70-persistent-net.rules mv /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-wmd10 mv /etc/sysconfig/network-scripts/ifcfg-eth1 /etc/sysconfig/network-scripts/ifcfg-wmd11 sed 's/eth0/wmd10/1' /etc/sysconfig/network-scripts/ifcfg-wmd10 sed 's/eth1/wmd11/1' /etc/sysconfig/network-scripts/ifcfg-wmd11
Now go LeApp some more...