文章

Centos7、Centos8网卡命名规则

Centos7、Centos8网卡命名规则

修改方法

https://www.aikaiyuan.com/12535.html

安装依赖

yum install initscripts biosdevname
  1. 修改/etc/default/grub
  2. GRUB_CMDLINE_LINUX后面添加如下参数:
    1. 需要em[id]添加 net.ifnames=1 biosdevname=1
    2. 需要eth[id]添加net.ifnames=0 biosdevname=0
    3. 需要enp0s2 添加 net.ifnames=1 biosdevname=0
  3. 重新生成image grub2-mkconfig -o /boot/grub2/grub.cfg
  4. 重启
GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet net.ifnames=1 biosdevname=1"

自定义固定网卡名称,eth0、ens7

在/etc/udev/rules.d 目录中创建rules文件 vim 70-persistent-net.rules SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="52:54:00:69:4f:09", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0" SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="d6:46:07:6c:2c:ba", ATTR{type}=="1", KERNEL=="ens*", NAME="ens7"
本文由作者按照 CC BY 4.0 进行授权