Centos7 change the network card name

After centos7 is installed, the system usually has a name similar to ensXXXXX, and if we want to use the name eth0, we need to modify it. The modification method is also very simple. Here is a brief list of steps.

Modify configuration file##

cd /etc/sysconfig/network-scripts
cat ifcfg-ens1770 
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
NAME=eth0
DEVICE=eth0
ONBOOT=yes
IPADDR=172.20.1.8
NETMASK=255.255.254.0
GATEWAY=172.20.1.1
DNS1=114.114.114.114
DNS2=8.8.8.8

Change network card name##

mv ifcfg-ens1770 ifcfg-eth0

Disable predictable naming rules##

vim /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root "net.ifnames=0 biosdevname=0" rd.lvm.lv=centos/swap rhgb quiet"   #Modify the content of this paragraph and add"net.ifnames=0 biosdevname=0"
GRUB_DISABLE_RECOVERY="true"

Regenerate grub and update kernel parameters##

grub2-mkconfig -o /boot/grub2/grub.cfg

Restart the system##

init 6

Recommended Posts

Centos7 change the network card name
CentOS7 modify the network card name
CentOS7 modify network card name and network repair
CentOS8 network card configuration file
Set the network card to bridge mode under CentOS6.3 KVM
centos7 cannot connect to the external network
CentOS7.0 network configuration
CentOS 7.0 network configuration
CentOS6.5 network settings
How to change the CentOS server time to Beijing time
VMware Fusion install CentOS7 and configure the network
Linux Network Foundation (CentOS7)
Ubuntu 18.04 network card configuration
Tencent cloud centos 8.0 single network card configuration multiple IP
CentOS 7 network settings --- connectivity
How to support TL-WDN7200H wireless USB network card in CentOS8?
Centos6.5 desktop version network settings
Implementation of CentOS8.0 Network Configuration
Centos network settings in virtualbox
The difference between CentOS 7 and CentOS 6