CentOS7 modify the network card name eth mode

After CentOS7 version of the system default format beginning with the name of the card eno format, in some cases we need to modify this format eth format.

1, [root @ localhost] # vi / etc / sysconfig / grub red add the following fields

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 rd.lvm.lv=centos/swap rd.lvm.lv=centos/usr rhgb quiet net.ifnames=0 biosdevname=0"
GRUB_DISABLE_RECOVERY="true"

2. After modification, execute the following commands:

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

 Note: If you install the operating system is UEFI mode, executing the command error, can not find the file, execute the following command:

-o-Grub2 mkconfig /boot/efi/EFI/centos/grub.cfg

 3, modify udev card file 70-persistent-net.rules file, or delete or rename the file directly, (I deleted directly in the operation, no effects were observed)

[root@localhost ]# vi  /etc/udev/rules.d/70-persistent-net.rules 。

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:13:32:0b:ac:58", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:13:32:0b:ac:59", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:13:32:0b:ac:5a", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:13:32:0b:ac:5b", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"

  Note: MAC address through ifconfig |, grep ether to find this command.

4, revising each corresponding NIC configuration file eth name / etc / sysconfig / network-scripts / ifcfg- *

mv  ifcfg-enp4sp0  ifcfg-eth0

5, modified / etc / sysconfig / network-scripts / Configuration card configuration file corresponding to the content, and the DEVICE NAME parameters can be modified to eth *.

[root@localhost ]# vi  /etc/sysconfig/network-scripts/ifcfg-eth0

TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
NAME=eth0
DEVICE=eth0
ONBOOT=yes
IPADDR=192.168.1.100
PREFIX=24

6, reboot the device reboot

7, the above-described operation is carried out after modifying the operating system is installed, it can be modified directly in the operating system installation process easier:

After the boot into the CD-ROM system selection interface as follows:

 

 Select Install CentOS 7 do the transport , press the Tab key, add the following end of the line parameters net.ifnames = 0 biosdevname = 0 then enter the next step, after installation, the system defaults to the name of the card mode eth

 

Guess you like

Origin www.cnblogs.com/itbox/p/11569554.html