You are not logged in.

#1 2023-11-15 15:29:05

skizorutabaga
Member
Registered: 2016-09-01
Posts: 4

Dynamic ethernet interface

Hello,

my new laptop has no ethernet interface unless some is plugged through the usb3 plug (typically with a dock).
Furthermore, the name of the interface changes whith the dock.

Therefore, netctl-ifplugd@interface.service is useless :

- if the interface does not exist, boot process hangs for 1:30 minutes
- if I set it to one interface, it will only work in one context, and I would rather not start several netctl-ifplugd services for each bizare interface name that pops up (will it make the boot process wait for 1:30 minutes for each interface?)

Is there any other way to automatically run a dhcp request on dynamic interface name ? I could not find it in netctl documentation, nor in ifplugd.

Do you have any advice ?

Cheers

Offline

#2 2023-11-15 15:44:16

seth
Member
Registered: 2012-09-03
Posts: 53,250

Re: Dynamic ethernet interface

ifplug != ethernet dongle

You can use a udev rule to start/stop the ifplug service or just switch the profile when the device appears.
https://wiki.archlinux.org/title/Udev#About_udev_rules

As for the interface names: https://wiki.archlinux.org/title/Networ … face_names

Offline

#3 2023-11-16 13:23:28

skizorutabaga
Member
Registered: 2016-09-01
Posts: 4

Re: Dynamic ethernet interface

Thank you for the hints. It makes sense smile

I switched to classical network interface naming, and it now appears as eth0, great.

I tried to edit a new udev rule, but it does not work, and I don't know what's wrong.

These are the relevant udev events reported by `udev monitor`:

KERNEL[12548.273374] add      /devices/pci0000:00/0000:00:0d.0/usb2/2-4/2-4.2/2-4.2:1.0/net/eth0 (net)
KERNEL[12548.273390] add      /devices/pci0000:00/0000:00:0d.0/usb2/2-4/2-4.2/2-4.2:1.0/net/eth0/queues/rx-0 (queues)
KERNEL[12548.273396] add      /devices/pci0000:00/0000:00:0d.0/usb2/2-4/2-4.2/2-4.2:1.0/net/eth0/queues/tx-0 (queues)
UDEV  [12548.287451] add      /devices/pci0000:00/0000:00:0d.0/usb2/2-4/2-4.2/2-4.2:1.0/net/eth0 (net)
UDEV  [12548.287956] add      /devices/pci0000:00/0000:00:0d.0/usb2/2-4/2-4.2/2-4.2:1.0/net/eth0/queues/rx-0 (queues)
UDEV  [12548.288182] add      /devices/pci0000:00/0000:00:0d.0/usb2/2-4/2-4.2/2-4.2:1.0/net/eth0/queues/tx-0 (queues)

This is the output with properties:

UDEV  [12971.718627] add      /devices/pci0000:00/0000:00:0d.0/usb2/2-4/2-4.2/2-4.2:1.0/net/eth0 (net)
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:0d.0/usb2/2-4/2-4.2/2-4.2:1.0/net/eth0
SUBSYSTEM=net
INTERFACE=eth0
IFINDEX=18
SEQNUM=8885
USEC_INITIALIZED=12971699353
ID_NET_NAMING_SCHEME=v253
ID_NET_NAME_MAC=enxac91a1d78b7e
ID_OUI_FROM_DATABASE=Dell Inc.
ID_NET_NAME_PATH=enp0s13f0u4u2
ID_BUS=usb
ID_MODEL=USB_10_100_1000_LAN
ID_MODEL_ENC=USB\x2010\x2f100\x2f1000\x20LAN
ID_MODEL_ID=8153
ID_SERIAL=Realtek_USB_10_100_1000_LAN_000001000000
ID_SERIAL_SHORT=000001000000
ID_VENDOR=Realtek
ID_VENDOR_ENC=Realtek
ID_VENDOR_ID=0bda
ID_REVISION=3001
ID_TYPE=generic
ID_USB_MODEL=USB_10_100_1000_LAN
ID_USB_MODEL_ENC=USB\x2010\x2f100\x2f1000\x20LAN
ID_USB_MODEL_ID=8153
ID_USB_SERIAL=Realtek_USB_10_100_1000_LAN_000001000000
ID_USB_SERIAL_SHORT=000001000000
ID_USB_VENDOR=Realtek
ID_USB_VENDOR_ENC=Realtek
ID_USB_VENDOR_ID=0bda
ID_USB_REVISION=3001
ID_USB_TYPE=generic
ID_USB_INTERFACES=:ffff00:020600:0a0000:
ID_USB_INTERFACE_NUM=00
ID_USB_DRIVER=r8152
ID_VENDOR_FROM_DATABASE=Realtek Semiconductor Corp.
ID_MODEL_FROM_DATABASE=RTL8153 Gigabit Ethernet Adapter
ID_PATH_WITH_USB_REVISION=pci-0000:00:0d.0-usbv3-0:4.2:1.0
ID_PATH=pci-0000:00:0d.0-usb-0:4.2:1.0
ID_PATH_TAG=pci-0000_00_0d_0-usb-0_4_2_1_0
ID_NET_DRIVER=r8152
ID_NET_LINK_FILE=/usr/lib/systemd/network/99-default.link
ID_NET_NAME=eth0
ID_NET_LINK_FILE_DROPINS=/etc/systemd/network/99-default.link.d/traditional-naming.conf
SYSTEMD_ALIAS=/sys/subsystem/net/devices/eth0
TAGS=:systemd:
CURRENT_TAGS=:systemd:

And my 2 rules:

SUBSYSTEM=="net", ACTION=="add", ENV{ID_NET_NAME}=="eth0", RUN{program}+="netctl start ethernet-dhcp"
SUBSYSTEM=="net", ACTION=="remove", ENV{ID_NET_NAME}=="eth0", RUN{program}+="netctl stop ethernet-dhcp"

Any help is warmly welcome smile

Last edited by skizorutabaga (2023-11-16 13:25:41)

Offline

#4 2023-11-16 15:31:55

seth
Member
Registered: 2012-09-03
Posts: 53,250

Re: Dynamic ethernet interface

Did you reload the rules or reboot and did you try whether the rule fires at all (eg. by "touch /tmp/foo"/"touch /tmp/bar")?

Offline

#5 2023-11-17 08:19:27

skizorutabaga
Member
Registered: 2016-09-01
Posts: 4

Re: Dynamic ethernet interface

Yes I did reboot, reload the rules with udevadm.
I'm not realy sure where to look for logs. I will insist on this later.

Thank you for your support smile

Offline

#6 2023-11-17 14:01:30

seth
Member
Registered: 2012-09-03
Posts: 53,250

Re: Dynamic ethernet interface

"sudo journalctl -b", but really just make sure that the rule fires at all before anything else.

Offline

Board footer

Powered by FluxBB