Restart network automatically

I'm running Pihole on Ubuntu. DHCP is provided by the router, and DHCP points to the Pihole for DNS with dnsmasq. Sometimes the Ubuntu server loses its DNS, which means all computers on the network lose DNS. I haven't yet figured out what causes this situation, but I think it has something to do with a power outage. Maybe the server boots up faster than the internet modem.

Anyway, the solution I came up with is to run systemctl restart systemd-networkd on the server. If I don't do this, then it never recovers. I am looking for a way to make this happen automatically. Any ideas?

You can add a cron script to run that restart command at boot or shortly after boot.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.