First of all, why do we need to change the name of the network card, because we need to automate operation and maintenance. Since we need automated operation and maintenance, we need to have the same name for all server network cards. This is the origin of this document.
There are two ways to modify the network card name:
1. Modify when the system is installed for the first time;
2. After the system has been installed, it will be modified;
Let's look at the first one: (the first time the system is installed)
When choosing to install the centos system, use the arrow keys to lock install centos 7 and then press the Tab key
A line of code will be displayed at the bottom of the same page. We add parameters at the end of this line of code to achieve the effect of permanently modifying the network card name:
Enter the space first, enter net.ifnames=0 biosdevname=0 and press Enter
Modification is complete
================================================== ================================================== ====================
The second type: (The system has been installed, how to modify the name of the network card)
First enter the network card configuration file, first change the name in the file
vim /etc/sysconfig/network-scripts/ifcfg-eno32
Save and exit, change the name of the network card configuration file
cd /etc/sysconfig/network-scripts/
mv ifcfg-eno32 ifcfg-eth0
Modify the grub configuration file /etc/grub2.cfg, add the net.ifnames=0 biosdevname=0 parameter to the specified location
The position to be added before menuentry under linux 16 rhgb quiet
vim /etc/default/grub
Run the command grub2-mkconfig -o /boot/grub2/grub.cfg to regenerate the GRUB configuration and update the kernel parameters.
reboot reboot
Finish
User-defined network card name
Centos7 custom king card name
vim /etc/sysconfig/grub
Add net.ifnames=0 biosdevname=0 as follows:
(GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=cl/root rd.lvm.lv=cl/swap rhgb quiet net.ifnames=0 biosdevname=0")
grub2-mkconfig -o /boot/grub2/grub.cfg or restart
cat /etc/udev/rules.d/70-persistent-net.rules (create a new one if you don't have one)
Edit this file without using \, otherwise it will be invalid, modify the network card name corresponding to the mac address
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="? Star", ATTR{address}=="52:54:00:22:3f:1a", ATTR{type}=="1 ", KERNEL=="ethstar", NAME="fan"
cd /etc/sysconfig/network-scripts/
mv ifcfg-eth1 ifcfg-fan
reboot
udevadm info -a -p /sys/class/net/fan
Network card error
1.Bringing up interface eth0: Device eth0 does not seem to be present, delaying initialization.
2. CentOS5: Device eth0 has different MAC address than expected
3.e1000: eth0 NIC Link is Down
e1000: eth0 NIC Link is Up 1000 Mbps Full duplex,flow control: none
When net.ifnames=0 biosdevname=0 is changed, this error is likely to occur, then cent7 is needed. At this time, you need to create a new 70-persistent-net.rules file and edit it, pay special attention to a few asterisks
The above three problems have been solved through /etc/udev/rules.d/70-persistent.rules.