[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Réseau : inversion nom d'interfaces



bonjour

J'ai un serveur Debian domestique (Debian amd64 stable) munie de 2 interfaces réseaux qui ont gardé l'ancienne dénomination "eth0" et "eth1".
Anciennement gérées dans /etc/network/interfaces, elles sont gérées par systemd.

Tout allait bien jusqu'à ce que Debian "décide" lors d'un reboot impromptu (arrêt ordonné par l'onduleur suite coupure électrique) d'inverser les noms "eth0" et "eth1". De là on comprend que rien ne fonctionne car les services écoutent soit sur "eth0", soit sur "eth1".

Ma configuration :

# cat /etc/systemd/network/10-eth0.network 
[Match]
Name=eth0
MACAddress=00:50:bf:d8:b9:1f
[Link]
#MACAddress=Changer l'adresse MAC
#MTUBytes=Changer la valeur du MTU
[Network]
Address=192.168.2.1/24
DNS=192.168.2.1 127.0.0.1
Domains=vets.in
IPv6PrivacyExtensions=false


#cat /etc/systemd/network/10-eth1.network 
[Match]
Name=eth1
MACAddress=00:1a:92:90:41:58 
[Network]
DHCP=ipv4

(j'ai rajouté le paramètre "Name=" dans chacun des fichiers, sans résultat)


# cat /etc/udev/rules.d/70-persistent-net.rules 
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

    
SUBSYSTEM=="net", ACTION="" DRIVERS=="?*", ATTR{address}=="00:1a:92:90:41:58", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
SUBSYSTEM=="net", ACTION="" DRIVERS=="?*", ATTR{address}=="00:50:bf:d8:b9:1f", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"


(le fichier a été créé à la main)



Situation :

# systemctl status systemd-networkd
● systemd-networkd.service - Network Configuration
     Loaded: loaded (/lib/systemd/system/systemd-networkd.service; enabled; preset: enabled)
     Active: active (running) since Sat 2024-08-03 12:34:51 CEST; 1h 48min ago
TriggeredBy: ● systemd-networkd.socket
       Docs: man:systemd-networkd.service(8)
             man:org.freedesktop.network1(5)
   Main PID: 2432 (systemd-network)
     Status: "Processing requests..."
      Tasks: 1 (limit: 6480)
     Memory: 1.5M
        CPU: 139ms
     CGroup: /system.slice/systemd-networkd.service
             └─2432 /lib/systemd/systemd-networkd
août 03 12:34:51 quietty systemd-networkd[2432]: lo: Link UP
août 03 12:34:51 quietty systemd-networkd[2432]: lo: Gained carrier
août 03 12:34:51 quietty systemd-networkd[2432]: Enumeration completed
août 03 12:34:51 quietty systemd[1]: Started systemd-networkd.service - Network Configuration.
août 03 12:37:11 quietty systemd-networkd[2432]: eth1: Link UP
août 03 12:37:11 quietty systemd-networkd[2432]: eth1: Gained carrier
août 03 12:37:16 quietty systemd-networkd[2432]: eth0: Link UP
août 03 12:37:18 quietty systemd-networkd[2432]: eth0: Gained carrier
août 03 14:13:36 quietty systemd-networkd[2432]: eth1: Link DOWN
août 03 14:13:36 quietty systemd-networkd[2432]: eth1: Lost carrier
# networkctl list
IDX LINK TYPE     OPERATIONAL SETUP    
  1 lo   loopback carrier     unmanaged
  2 eth0 ether    routable    pending
  3 eth1 ether    carrier     pending
  4 tun0 none     routable    unmanaged
4 links listed.
# networkctl status
●        State: routable           
  Online state: unknown
       Address: 192.168.1.1 on eth0
                192.168.3.1 on tun0
août 03 12:34:51 quietty systemd-networkd[2432]: tun0: Link UP
août 03 12:34:51 quietty systemd-networkd[2432]: tun0: Gained carrier
août 03 12:34:51 quietty systemd-networkd[2432]: lo: Link UP
août 03 12:34:51 quietty systemd-networkd[2432]: lo: Gained carrier
août 03 12:34:51 quietty systemd-networkd[2432]: Enumeration completed
août 03 12:34:51 quietty systemd[1]: Started systemd-networkd.service - Network Configuration.
août 03 12:37:11 quietty systemd-networkd[2432]: eth1: Link UP
août 03 12:37:11 quietty systemd-networkd[2432]: eth1: Gained carrier
août 03 12:37:16 quietty systemd-networkd[2432]: eth0: Link UP
août 03 12:37:18 quietty systemd-networkd[2432]: eth0: Gained carrier
root@quietty:~# networkctl status eth0
● 2: eth0                                                                
                     Link File: n/a
                  Network File: n/a
                         State: routable (pending)
                  Online state: unknown
                          Type: ether
             Alternative Names: enp2s0
              Hardware Address: 00:1a:92:90:41:58 (ASUSTek COMPUTER INC.)
                           MTU: 1500 (min: 68, max: 4074)
                         QDisc: fq_codel
  IPv6 Address Generation Mode: eui64
      Number of Queues (Tx/Rx): 1/1
              Auto negotiation: yes
                         Speed: 1Gbps
                        Duplex: full
                          Port: tp
                       Address: 192.168.1.1
août 03 12:16:41 quietty (udev-worker)[318]: eth0: Failed to rename network interface 3 from 'eth1' to 'eth0': Le fichier existe
août 03 12:16:41 quietty (udev-worker)[318]: eth0: Failed to process device, ignoring: Le fichier existe
août 03 12:37:16 quietty systemd-networkd[2432]: eth0: Link UP
août 03 12:37:18 quietty systemd-networkd[2432]: eth0: Gained carrier
root@quietty:~# networkctl status eth1
● 3: eth1                                                                        
                     Link File: n/a
                  Network File: n/a
                         State: carrier (pending)
                  Online state: unknown
                          Type: ether
             Alternative Names: enp5s3
              Hardware Address: 00:50:bf:d8:b9:1f (Metalligence Technology Corp.)
                           MTU: 1500 (min: 68, max: 1770)
                         QDisc: fq_codel
  IPv6 Address Generation Mode: eui64
      Number of Queues (Tx/Rx): 1/1
              Auto negotiation: yes
                         Speed: 100Mbps
                        Duplex: full
                          Port: mii
août 03 12:16:41 quietty (udev-worker)[320]: eth1: Failed to rename network interface 2 from 'eth0' to 'eth1': Le fichier existe
août 03 12:16:41 quietty (udev-worker)[320]: eth1: Failed to process device, ignoring: Le fichier existe
août 03 12:37:11 quietty systemd-networkd[2432]: eth1: Link UP
août 03 12:37:11 quietty systemd-networkd[2432]: eth1: Gained carrier


(j'ai forcé eth0 à la main pour qu'il puisse obtenir une IP de la Freebox et  donc pouvoir y accéder)

extrait de la syslog (grep eth syslog), puis filtré

2024-08-03T12:17:02.162959+02:00 quietty (udev-worker)[318]: eth0: Failed to rename network interface 3 from 'eth1' to 'eth0': Le fichier existe
2024-08-03T12:17:02.162970+02:00 quietty (udev-worker)[318]: eth0: Failed to process device, ignoring: Le fichier existe
2024-08-03T12:17:02.162987+02:00 quietty (udev-worker)[320]: eth1: Failed to rename network interface 2 from 'eth0' to 'eth1': Le fichier existe
2024-08-03T12:17:02.162998+02:00 quietty (udev-worker)[320]: eth1: Failed to process device, ignoring: Le fichier existe
2024-08-03T12:17:02.166188+02:00 quietty kernel: [   16.685250] r8169 0000:02:00.0 eth0: RTL8168b/8111b, 00:1a:92:90:41:58, XID 380, IRQ 17
2024-08-03T12:17:02.166191+02:00 quietty kernel: [   16.685261] r8169 0000:02:00.0 eth0: jumbo features [frames: 4074 bytes, tx checksumming: ko]
2024-08-03T12:17:02.166216+02:00 quietty kernel: [   16.773937] 8139too 0000:05:03.0 eth1: RealTek RTL8139 at 0x000000008c73e2a6, 00:50:bf:d8:b9:1f, IRQ 16
2024-08-03T12:37:11.883673+02:00 quietty kernel: [ 1249.164501] 8139too 0000:05:03.0 eth1: link up, 100Mbps, full-duplex, lpa 0xC5E1
2024-08-03T12:37:11.883283+02:00 quietty systemd-networkd[2432]: eth1: Link UP
2024-08-03T12:37:11.884671+02:00 quietty systemd-networkd[2432]: eth1: Gained carrier
2024-08-03T12:37:16.141797+02:00 quietty systemd-networkd[2432]: eth0: Link UP
2024-08-03T12:37:16.143669+02:00 quietty kernel: [ 1253.425217] r8169 0000:02:00.0 eth0: Link is Down
2024-08-03T12:37:18.810345+02:00 quietty systemd-networkd[2432]: eth0: Gained carrier
2024-08-03T12:37:18.811683+02:00 quietty kernel: [ 1256.091726] r8169 0000:02:00.0 eth0: Link is Up - 1Gbps/Full - flow control rx/tx
2024-08-03T12:43:40.578099+02:00 quietty avahi-daemon[844]: Joining mDNS multicast group on interface eth0.IPv4 with address 192.168.1.1.
2024-08-03T12:43:40.580205+02:00 quietty avahi-daemon[844]: New relevant interface eth0.IPv4 for mDNS.
2024-08-03T12:43:40.580374+02:00 quietty avahi-daemon[844]: Registering new address record for 192.168.1.1 on eth0.IPv4.

extrait syslog concernant l'interface 8139too

2024-08-03T12:17:02.166175+02:00 quietty kernel: [   16.676339] r8169 0000:02:00.0: can't disable ASPM; OS doesn't have ASPM control
2024-08-03T12:17:02.166188+02:00 quietty kernel: [   16.685250] r8169 0000:02:00.0 eth0: RTL8168b/8111b, 00:1a:92:90:41:58, XID 380, IRQ 17
2024-08-03T12:17:02.166191+02:00 quietty kernel: [   16.685261] r8169 0000:02:00.0 eth0: jumbo features [frames: 4074 bytes, tx checksumming: ko]
2024-08-03T12:37:16.099733+02:00 quietty kernel: [ 1253.380972] RTL8211B Gigabit Ethernet r8169-0-200:00: attached PHY driver (mii_bus:phy_addr=r8169-0-200:00, irq=MAC)
2024-08-03T12:37:16.143669+02:00 quietty kernel: [ 1253.425217] r8169 0000:02:00.0 eth0: Link is Down
2024-08-03T12:37:18.811683+02:00 quietty kernel: [ 1256.091726] r8169 0000:02:00.0 eth0: Link is Up - 1Gbps/Full - flow control rx/tx

J'ai compris que les interfaces étaient démarrées et nommées sans tenir compte des fichiers de configuration dans /etc/systemd/network

et que la règle udev du coup n'était pas appliquée car les noms existent déjà.

Je pense soit à une fausse manipulation de ma part (mais rien trouvé de pertinent en cherchant les noms d'interface ou MAC dans /etc) ou à un changement de comportement lié à un nouveau noyau (les paquets mis à jour s'installent sans reboot) ou un paramétrage du noyau mal maîtrisé.

j'ai noté aussi que les interfaces étaient au status "pending" au lieu de "configured"

Merci d'avance de vos idées

amitiés

Erwann





Reply to: