Revert Networking in CentOS 7/8

This is under construction. I do not use CentOS as much as Ubuntu. Tested with CentOS 7.9

I've seen warnings from Red Hat saying the legacy network service and "network-scripts" package is deprecated and will be removed in a future release, so some of the old guides may not work in the future.

I am still using NetworkManager, but I at least get my legacy "eth0" naming back.


1) update the /etc/default/grub file, and add net.ifnames=0 biosdevname=0 to the GRUB_CMDLINE_LINUX line.

Your line may look something like this:

GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet net.ifnames=0 biosdevname=0"

2) Update your grub configuration.

For Legacy/BIOS/MBR systems, run "grub2-mkconfig -o /boot/grub2/grub.cfg" to rebuild your grub configuration.

For EFI systems, run "grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg" to rebuild your grub configuration.

3) Create your /etc/sysconfig/network-scripts/ifcfg-eth0 file. For example:

#
# /etc/sysconfig/network-scripts/ifcfg-eth0
#

# enable on boot
ONBOOT=yes

TYPE=Ethernet
NAME=eth0
DEVICE=eth0

# ip configuration
IPADDR=192.168.1.10
PREFIX=24
GATEWAY=192.168.1.254

# dns servers
DNS1=8.8.8.8
DNS2=1.1.1.1

# search domains
DOMAIN="localhost localhost.example.com"

4) Optional, if you don't use the GUI, disable NetworkManager.

systemctl disable NetworkManager

5) Reboot.