It is a matter of personal preference whether you use current or former network device naming convention. I am more accustomed to the latter and will configure the operating system to retain the old behavior.
The new naming scheme is thoroughly described in systemd/src/udev/udev-builtin-net_id.c with many useful examples, so I will skip that part.
As you can see, the interface name is wlp2s0
, thanks to this, we can easily determine the type of this device and where it is located, but it really doesn’t matter (see one-liner at the end of this article). We want to see a good old wlan0
name.
$ ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: wlp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000 link/ether 5c:e0:c5:9d:63:f9 brd ff:ff:ff:ff:ff:ff
Add the net.ifnames=0
(disable policies by which the interface name should be set) to the normal boot options inside /etc/default/grub
file.
$ sudo sed -i -e "/GRUB_CMDLINE_LINUX_DEFAULT/ s/=\"/=\"net.ifnames=0 /" /etc/default/grub
Update the GRUB configuration.
$ sudo update-grub
Update /etc/network/interfaces
configuration file. Do not forget about this step.
Reboot system.
$ sudo reboot
Display network device configuration to verify the used naming convention.
$ ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000 link/ether 5c:e0:c5:9d:63:f9 brd ff:ff:ff:ff:ff:ff
Additional notes
You can compare device names using the following one-liner.
$ udevadm info -e | awk 'BEGIN{RS="\n\n";FS="\n"} {i[2]=p[2]="";for(x=1;x<=NF;x++) {if (match($x,/E: INTERFACE/)) split($x,i,"=");if (match($x,/E: ID_NET_NAME_PATH/)) split($x,p,"=");if (i[2] && p[2]) {print "Interface "i[2] " is named by path as " p[2];i[2]=p[2]="";}}}'
Interface wlan0 is named by path as wlp2s0
Interface eth0 is named by path as enp0s3
Interface eth0 is named by path as enp32s0 Interface eth1 is named by path as enp34s0
Policies by which the interface name should be set are defined in /lib/systemd/network/99-default.link
configuration file using NamedPolicy
option.
$ cat /lib/systemd/network/99-default.link
[Link] NamePolicy=kernel database onboard slot path MACAddressPolicy=persistent