查看当前网卡名是 ens33
:
$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:0c:29:e5:00:e4 brd ff:ff:ff:ff:ff:ff
inet 172.20.0.20/24 brd 172.20.0.255 scope global ens33
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fee5:e4/64 scope link
valid_lft forever preferred_lft forever
修改 grub 配置:
$ vim /etc/default/grub
# 仅修改此参数
GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"
更新 grub 配置:
$ update-grub
Sourcing file `/etc/default/grub'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.15.0-156-generic
Found initrd image: /boot/initrd.img-4.15.0-156-generic
done
重启系统:
$ reboot
评论区