How to override default DNS servers?

Our system uses an internally managed DNS powerdns-recursor with a bunch of forwarded zones for our split-horizon DNS. We’re using Ubuntu 18.04 images, which by default configure /etc/netplan/50-cloud-init.yaml with DO’s name servers, which then systemd-resolv picks up on.

Is there a ‘proper’ way to remove the name servers, or simply replace them with our custom servers? The only way I can think of doing this would involve a pre-network oneshot systemd service to re-write the file after cloud-init does it’s thing.


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!