Recently many users have had issues with Google’s DNS resolution, which have really highlighted the need for a distributed internet! With that in mind, I wanted to write up a guide on how to update your DNS resolvers to a custom DNS provider. We’ll use OpenDNS for this guide, but you can find several options here:
https://www.lifewire.com/free-and-public-dns-servers-2626062
Don’t know if you want to switch away from Google, but need to get back up and running? There’s a file on your server called:
/etc/resolv.conf
Which should look something like this:
nameserver 8.8.8.8
nameserver 8.8.4.4
If you change those lines to the OpenDNS resolver IPs:
nameserver 208.67.222.222
nameserver 208.67.220.220
Then you’re done! That will direct all of your DNS resolution requests to OpenDNS until your next reboot, when resolv.conf is regenerated based on your networking configuration.
So how do you edit that networking configuration? Well the syntax is the same, but the location differs based on your distribution.
First check for this file and make changes here:
/etc/network/interfaces.d/50-cloud-init.cfg
But on some older versions that won’t exist, so you can just make changes here:
/etc/network/interfaces
The current settings should look something like this:
dns-nameservers 8.8.8.8 8.8.4.4
You can update them with the OpenDNS resolvers to look like this:
dns-nameservers 208.67.222.222 208.67.220.220
Then restart networking with:
sudo systemctl restart network.service
Or simply reboot your Droplet to have those changes take effect.
This can all be managed at:
/etc/sysconfig/network-scripts/ifcfg-eth0
The current settings should look something like this:
DNS1=8.8.8.8
DNS2=8.8.4.4
You can update them with the OpenDNS resolvers to look like this:
DNS1=208.67.222.222
DNS2=208.67.220.220
Then restart networking with:
sudo systemctl restart network.service
Or simply reboot your Droplet to have those changes take effect.
I hope that’s helpful! If you’re having a DNS issue that changing your resolvers doesn’t… ahem… resolve… Then please feel free to open a ticket so we can take a look:
https://cloud.digitalocean.com/support/tickets/new
And don’t hesitate to post your questions below :)
Regards, Darian Platform Support Advocate
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
My
/etc/network/interfaces.d/50-cloud-init.cfg
file uses IPv6 addresses in the DNS settings:Does OpenDNS support these types of addresses as an alternative to Google?
This worked for my droplet, thank you very much!
@dwilkin
Since the DigitalOcean Team has a presence here in the community and posts such as this, as well as those previous, apply to such a large base, it might be worth having them stick out a little more.
To those of us who like to help others in the community, they simply look like every other question. If there was a tag next to the post title, some color variation (different link color), or separation (such as making the thread sticky for X or XX days / week(s)) – or a combination of all three – I think that’d be far more helpful in ensuring that others are able to identify such posts.
I know there’s a search function, but even when searching, it still looks like every other thread :-).
Considering linux/Ubuntu recent development and Digitalocean setup changes to cope with them:
link that answered the question of how to simply change DNS servers on a DO Ubuntu server:
https://www.digitalocean.com/community/questions/how-to-permanently-change-dns-nameservers-in-ubuntu-18-04-3-wiki-article-is-not-working
Summary: DO cloudinit systems give a simpler option; -Adjust the DNS servers in 50-cloud-init.yaml in /etc/netplan -Make it permanent by adding a file named 99-disable-network-config.cfg to /etc/cloud/cloud.cfg.d/ with the following: network: {config: disabled}
Now I am trying to Intergrate magneto and word press I have run a REST API and the error message cURL error 28: Connection timed out after 10001 milliseconds showed up. I am trying to follow your steps but doesnt seem i have the etc/resolv.conf file
Is there a way, for ubuntu-based hosts, to set nameservers in the cloud-init data at droplet creation time?