从Debian 9版本开始,网络接口命名规则从ethxx更改为ensxx convention,本文介绍在Debian 10/9操作系统上将网络接口名称更改为eth0模式的方法,可参考Linux上使用ifconfig、ip、netstat、nmcli命令查找可用的网络接口。
具体方法 以下是我目前的网络配置: $ ip ad 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: ens5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 52:54:00:6b:b7:3d brd ff:ff:ff:ff:ff:ff inet 192.168.121.52/24 brd 192.168.121.255 scope global dynamic ens5 valid_lft 2747sec preferred_lft 2747sec inet6 fe80::5054:ff:fe6b:b73d/64 scope link valid_lft forever preferred_lft forever 如果你喜爱旧的命名,是可以做出改变的,要切换到旧模式,请将以下内核参数添加到/etc/default/grub文件中的GRUB_CMDLINE_LINUX变量: $ sudo nano /etc/default/grub ...... GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0" 见下面的截图:
你需要更新grub并在进行更改后重新启动系统,运行以下命令: $ sudo update-grub $ sudo reboot 确认你的新网络配置,如下: $ ip ad 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: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 52:54:00:6b:b7:3d brd ff:ff:ff:ff:ff:ff inet 192.168.121.52/24 brd 192.168.121.255 scope global dynamic eth0 valid_lft 3563sec preferred_lft 3563sec inet6 fe80::5054:ff:fe6b:b73d/64 scope link valid_lft forever preferred_lft forever 至此,目的达到,这就是在Debian 10(Buster)/Debian 9(Stretch)上将网络命名改为ethXX的方法,实现起来非常的简单。
相关主题 |