参考: 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
grub2-mkconfig –o /boot/grub2/grub.cfg
网友评论