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.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
To replace or remove the default DigitalOcean name servers with your custom name servers, you can modify the /etc/netplan/50-cloud-init.yaml file. Here’s how:
-
- network:
- ethernets:
- eth0:
- dhcp4: true
- dhcp6: true
- match:
- macaddress: XX:XX:XX:XX:XX:XX
- set-name: eth0
- version: 2
- nameservers:
- addresses: [your.nameserver.ip.1, your.nameserver.ip.2]
Replace your.nameserver.ip.1 and your.nameserver.ip.2 with your custom name servers’ IP addresses. After updating the file, apply the new configuration:
- sudo netplan apply
This method will work without needing a pre-network oneshot systemd service.
Regards
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.