When I connect a USB-to-Ethernet adapter (that has been previously used), I receive a MAC address, and then if there's something connected on the other end I receive also an IP address (192.168.1.1 in my case, configured in static in NetworkManager). On the other end there are various instruments that wait for the DHCP server running on that PC to give them an IP.
The problem is that the DHCP server refuses to start if the subnet is not found, so it cannot be launched before the connection is up. How can I do systemctl restart isc-dhcp-server.service
after I receive the IP 192.168.1.1 from NetworkManager ?
I thought of using a udev rule with ATTR{address}=="f0:1f:af:3d:6c:e7" RUN+="systemctl restart isc-dhcp-server.service"
but it runs before the IP is assigned. Is there a udev option I can use or do I have to use another method via systemd or NetworkManager or other ?