Cambiare nome scheda di rete da enp0s25/wlp4s0 a eth0/wlan0 con Systemd

 

Su un portatile Thinkpad T540P(20BE005YGE), i nomi delle schede di rete non sono le solite a cui io sono abituato, e cioè eth0 e wlan0, ma bensì enp0s25 e wlp4s0. Utilizzando Debian 9 Stretch con Systemd, per poter cambiare i nomi bisogna creare 2 files con i nomi delle interfacce. Quello che serve è il mac address delle schede, che si ottiene con il comando ifconfig o ip link:

Cambiare nome scheda di rete da enp0s25/wlp4s0 a eth0/wlan0 con Systemd

root@DebianBox:/home/edmond# ip link
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: enp0s25: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
    link/ether 54:ee:11:0d:ce:11 brd ff:ff:ff:ff:ff:ff
3: wlp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
    link/ether 7c:7a:22:d9:3b:22 brd ff:ff:ff:ff:ff:ff
4: wwp0s20u10i6: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 02:15:e0:ec:01:00 brd ff:ff:ff:ff:ff:ff
root@DebianBox:/home/edmond# ifconfig
enp0s25: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 54:ee:11:0d:ce:11  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 20  memory 0xf2600000-f2620000  

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 438  bytes 33948 (33.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 438  bytes 33948 (33.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp4s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.41  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::87d4:6da9:153f:ffa4  prefixlen 64  scopeid 0x20<link>
        ether 7c:7a:22:d9:3b:22  txqueuelen 1000  (Ethernet)
        RX packets 16061  bytes 16095320 (15.3 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 12337  bytes 1597446 (1.5 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

quindi creare il file 10-eth.link:

# nano /etc/systemd/network/10-eth.link

ed inserire

[Match]
MACAddress=XX:XX:XX:XX:XX:XX

[Link]
Name=eth0

ed il file 10-wlan.link:

[Match]
MACAddress=XX:XX:XX:XX:XX:XX

[Link]
Name=wlan0

e poi reboot.

Cambiare nome scheda di rete da enp0s25/wlp4s0 a eth0/wlan0 con Systemd

enjoy 😉

Post simili (quasi):

Un commento su “Cambiare nome scheda di rete da enp0s25/wlp4s0 a eth0/wlan0 con Systemd”

  1. Firefox 49.0 Firefox 49.0 GNU/Linux GNU/Linux
    Mozilla/5.0 (X11; Linux i686; rv:49.0) Gecko/20100101 Firefox/49.0

    Ma anche usando un solo file….

    In    /etc/udev/rules.d      creare un file:    10-rename-network.rules     e metterci:

    SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="01:23:45:67:89:01", NAME="eth0"
    SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="ab:cd:ef:gh:ij:kl", NAME="wlan0"

     

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *