Change the name of the network card on RHEL7 or CentOS 7
This document describes how to change the name of RHEL7 or CentOS 7 network card, according to the following steps to operate can be achieved. 1. Rename the NIC configuration file name to eth0 (it can also be changed to other names)[root@Jaking11 ~]#ifconfigurs33: flags=4163mtu 1500 inet 192.168.10.11 netmask 255.255.255.0 broadcast 192.168.10.255 inet6 fe80::250:56ff:fe29:eae prefixlen 64 scopeid 0x20 ether 00:50:56:29:0e:ae txqueuelen 1000 (Ethernet) RX packets 132 bytes 14492 (14.1 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 115 bytes 13105 (12.7 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0lo: flags=73mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10loop txqueuelen 1000 (Local Loopback) RX packets 140 bytes 11204 (10.9 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 140 bytes 11204 (10.9 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0[root@Jaking11 ~]# [root@Jaking11 ~]# cd /etc/sysconfig/network-scripts/[root@Jaking11 network-scripts]# lsifcfg-ens33 ifdown-ppp ifup-eth ifup-sitifcfg-lo ifdown-routes ifup-ippp ifup-Teamifdown ifdown-sit ifup-ipv6 ifup-TeamPortifdown-bnep ifdown-Team ifup-isdn ifup-tunnelifdown-eth ifdown-TeamPort ifup-plip ifup-wirelessifdown-ippp ifdown-tunnel ifup-plusb init.ipv6-globalifdown-ipv6 ifup ifup-post network-functionsifdown-isdn ifup-aliases ifup-ppp network-functions-ipv6ifdown-post ifup-bnep ifup-routes[root@Jaking11 network-scripts]# mv ifcfg-ens33 ifcfg-eth0[root@Jaking11 network-scripts]# vim ifcfg-eth0 TYPE=EthernetPROXY_METHOD=noneBROWSER_ONLY=noBOOTPROTO= staticDEROUTE =yesIPV4_FAILURE_FATAL=noNAME=eth0DEVICE= eth0ONBOOT=yesIPADDR=192.168.10.11GATEWAY=192.168.10.2NETMASK= 255.255.0
This function is implemented through
/etc/default/grub
file, to disable this feature, add
"net.ifnames=0 biosdevname=0"
can
[root@Jaking11 network-scripts]# vim /etc/default/grub GRUB_TIMEOUT=5GRUB_DISTRIBUTOR="$(sed 's, release .*$,, g' /etc/system-release)"GRUB_DEFAULT=savedGRUB_DISABLE_SUBMENU=trueGRUB_TERMINAL_OUTPUT="console"GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv =centos/root rd.lvm.lv=centos/swap rhgb quiet net.ifnames=0 biosdevname=0"GRUB_DISABLE_RECOVERY="true"
Create a NIC rule 70-persistent-net.rules file in the/etc/udev/rules.d directory and write the following parameters to the file:
SUBSYSTEM=="net",ACTION=="add",DRIVERS=="?* ",ATTR{address}==" MAC address of NIC whose name needs to be modified ",ATTR{type}=="1" ,KERNEL=="eth*",NAME="eth0"
Reference Configuration:
[root@Jaking11 rules.d]# vim 70-persistent-net.rulesSUBSYSTEM=="net",ACTION=="add",DRIVERS=="?* ",ATTR{address}=="00:50:56:29:0e:ae",ATTR{type}=="1" ,KERNEL=="eth*",NAME="eth0"Execute grub2-mkconfig -o/boot/grub2/grub.cfg command to generate update grub configuration parameters [root@Jaking11 rules.d]#grub2-mkconfig -o /boot/grub2/grub.cfgGenerating grub configuration file... Found linux image: /boot/vmlinuz-3.10.0-957.el7.x86_64Found initrd image: /boot/initramfs-3.10.0-957.el7.x86_64.imgFound linux image: /boot/vmlinuz-0-rescue-fe49b659ccb940fa8d260a5897c0b08aFound initrd image: /boot/initramfs-0-rescue-fe49b659ccb940fa8d260a5897c0b08a.imgdone Verify that the NIC name changes successfully after restarting Linux [root@Jaking11 ~]#ifconfigureth 0: flags=4163mtu 1500 inet 192.168.10.11 netmask 255.255.255.0 broadcast 192.168.10.255 inet6 fe80::250:56ff:fe29:eae prefixlen 64 scopeid 0x20 ether 00:50:56:29:0e:ae txqueuelen 1000 (Ethernet) RX packets 86 bytes 10889 (10.6 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 95 bytes 10828 (10.5 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0lo: flags=73mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10loop txqueuelen 1000 (Local Loopback) 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 Summary
The above is how to change the name of RHEL7 or CentOS 7 network card, and finally see eth0 indicating that the name of the network card has been changed successfully!
Original address of this article: https://www.linuxprobe.com/rhel7-centos7-network.html