ubuntu¢ 网卡名固定以及网卡名抖动问题

2020-08-25  本文已影响0人  cloudFans

参考: https://rdp2.esecuredata.com/index.php?/knowledgebase/article/126/ubuntu-lts-switching-nic-problem/

Method 1
Create a file at /etc/udev/rules.d/70-persistent-net.rules and list both devices with new name Example, NAME="" can be anything you want, eth1, enp5, whatever. ATTR{address}=="" has to be the NIC's MAC address, you can see it by using ifconfig and checking out HWaddr label

This file was automatically generated by the /lib/udev/write_net_rules

program, run by the persistent-net-generator.rules rules file.

You can modify it, as long as you keep each rule on a single

line, and change only the value of the NAME= key.

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?", ATTR{address}=="00:1e:67:46:3f:ef", ATTR{dev_id}=="0x0", ATTR{type}=="1", NAME="eno1"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?
", ATTR{address}=="00:1e:67:46:3f:ee", ATTR{dev_id}=="0x0", ATTR{type}=="1", NAME="eth0"
Reboot and check if the NICs have names you specified above.
Proceed normally as you would with editing interfaces file with the name you chose above.

Method 2
Edit your /etc/default/grub changing the line to
GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"
From
GRUB_CMDLINE_LINUX=""
Do
sudo update-grub Then reboot. Now it should use old convention for naming NICs, eth0, eth1, etc. For CentOS7 use: grub2-mkconfig –o /boot/grub2/grub.cfg

上一篇 下一篇

猜你喜欢

热点阅读