On most GNU/Linux distributions, network interfaces often have names that are difficult to remember or associate. In this tutorial we will see how to rename network interfaces with any name we want on Debian systems.
Note : This has been tested on Debian 11
Let's say we have two network interfaces, one used on a 192.168.1.0/24 network, and this is the one we want to rename.
root@host:~# ip addr sh
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: enp3s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 18:1f:64:24:0b:ba brd ff:ff:ff:ff:ff:ff
3: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether a7:15:ca:4c:1a:13 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.10/24 brd 192.168.1.255 scope global dynamic enp2s0
valid_lft 28998sec preferred_lft 28998sec
inet6 fe80::6a05:caff:fe39:c153/64 scope link
valid_lft forever preferred_lft forever
We identified our network interface. Its current name is enp2s0 and we will rename it with lan.
Now that we have the mac address of the network interface we want to rename we can create our configuration file.
[Match]
MACAddress=a7:15:ca:4c:1a:13
[Link]
Name=lan
root@host:~# reboot
root@host:~# ip addr sh
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: enp3s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 18:1f:64:24:0b:ba brd ff:ff:ff:ff:ff:ff
3: lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether a7:15:ca:4c:1a:13 brd ff:ff:ff:ff:ff:ff
altname enp2s0
inet 192.168.1.10/24 brd 192.168.1.255 scope global dynamic enp2s0
valid_lft 28998sec preferred_lft 28998sec
inet6 fe80::6a05:caff:fe39:c153/64 scope link
valid_lft forever preferred_lft forever
Contact :