编程知识 cdmana.com

Centos7 / 8 disable consistent network device naming

1. Create your own manual naming scheme . for example : Name the interface “eth0”. To create your own udev Rules file , And set up... For those devices NAME attribute . Be sure to use the default policy file before using it .

# vi /etc/udev/rules.d/60-net.rules

ACTION=="add", SUBSYSTEM=="net", DRIVERS=="?*", ATTR{address}=="00:13:32:0b:ac:58", ATTR{type}=="1", PROGRAM="/lib/udev/rename_device", RESULT=="eth*", NAME="eth0"

ACTION=="add", SUBSYSTEM=="net", DRIVERS=="?*", ATTR{address}=="00:13:32:0b:ac:59", ATTR{type}=="1", PROGRAM="/lib/udev/rename_device", RESULT=="eth*", NAME="eth1"

2. open /etc/default/grub file , And then find GRUB_CMDLINE_LINUX Variable

       take net.ifnames = 0 and biosdevname = 0 Add as kernel parameter value to GRUB_CMDLINE_LINUX Variable :

# cat /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=cl/root rhgb quiet net.ifnames=0 biosdevname=0"
GRUB_DISABLE_RECOVERY="true"

       By running grub2-mkconfig Command to rebuild /boot/grub2/grub.cfg file :

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

       For the use of UEFI Guided system :

      # grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg

3. View the current device name

# nmcli connection show
NAME                UUID                                  TYPE      DEVICE 
Wired connection 1  837fb53e-71a8-31c8-a938-710cca80b94f  ethernet  eth0

版权声明
本文为[lang13002]所创,转载请带上原文链接,感谢

Scroll to Top