You are not logged in.
The ifplugd for laptops has a note that
dhcpcd provides the same feature out of the box.
With the immediate description that ifplugd automatically configures/unconfigures for plugin/unplug events, the note makes it seem as if ifplugd is duplicative/unnecessary.
However, the dhcpcd wiki page says
...it does not support hot-plugging of a wired connection and will fail if the network cable is not connected.
My assumption is that, if I want hot-plugging, I need to use ifplugd@interface.service, and if I will only ever have a cable always plugged in, then I can reduce dependencies by only using dhcpcd@interface.service, in the case of, say, a desktop.
Please let me know if I am correct, or missing something. Thanks!
Last edited by bbus (2021-03-03 16:35:41)
Offline
To avoid it, enable dhcpcd per interface it should bind to as described in #Running. The downside of the template unit is, however, that it does not support hot-plugging of a wired connection and will fail if the network cable is not connected.
The omitted context makes clear that this limitation only (and rather quite obviosly) applies for NIC specific services like dhcpcd@interface.service
The global dhcpcd.service however manages all and should™ be capable of juggling your NICs (if it doesn't: rant about it - rsmarples is active on this forum, he'll certainly like to hear ;-)
Offline
So I need to clarify, I believe I am restricted to the NIC specific service file, because I am using iwd for my wireless control, and I am using iwd's own built-in DHCP client for that.
Maybe this question needs a new topic: If I enable a NIC specific ifplugd, (e.g. ifplugd@interface.service) will that start dhcpcd on a global scale, conflicting with my iwd configuration, or does it only start the NIC specific dhcpcd service?
Offline
You can configure which devices to handle and there's also the interface daemon.
On top of that ifplugd will do nothing by itself, but run a script that you have to provide when the status changes.
You can eg. lookup /etc/ifplugd/netctl.action from the netctl package for a pattern. At this point you will decide whether and how to invoke a dhcp client like dhcpcd or dhclient.
Offline
Got it, thank you for the help. I've configured /etc/ifplugd/ifplugd.conf such that INTERFACES="enp_my_wired_port_0 enp_my_wired_port_1" and I created a very basic ifplugd.action file. It seems to be working, but do you have any input on whether there are any blaring issues with it?
/etc/ifplugd/ifplugd.action
#!/bin/sh
case $2 in
up)
systemctl start dhcpcd@$1.service
exit 0
;;
down)
systemctl stop dhcpcd@$1.service
exit 0
;;
*)
echo "There has been an error"
;;
esac
exit 1Last edited by bbus (2021-03-01 22:28:40)
Offline
Do you need to deactivate the wifi connection as well?
An alternative approach could be to add an iwd hook to dhcpcd, https://wiki.archlinux.org/index.php/Dhcpcd#Hooks
Offline
No, I don't think my use case needs to turn off my wifi connection. Maybe I will need to at some point if my ip tables get messed up. I could easily add "systemctl {stop/start} iwd.service" at the beginning and end, I suppose.
Ah, now with more context, that section makes more sense, thank you for bringing up dhcpcd hooks. I'll mark this as solved, and look into hooks when I get some more time. Thanks!
Offline