How do I switch my DNS resolvers away from Google?

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

Temporary fix:

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.

Permanent fix:

So how do you edit that networking configuration? Well the syntax is the same, but the location differs based on your distribution.

Ubuntu/Debian

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.

CentOS/RHEL

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://my.tdwebservices.com

  • 0 Els usuaris han Trobat Això Útil
Ha estat útil la resposta?

Articles Relacionats

How To: Back Up MySQL Databases From The Command Line

While automated backups are important, sometimes you just want to take a quick and dirty snapshot...

How To Install MariaDB on CentOS 6

MariaDB is a drop-in replacement for MySQL. It is easy to install, offers many speed and...

How to Display (List) All Jobs in Cron / Crontab

View Root’s Cron Jobs crontab -l  View a User’s Cron Jobs crontab -u username -l Example with...

How To: Automate Server Scripts With Cron

Servers can automatically perform tasks that you would otherwise have to perform yourself, such...

How to find sending spam emails and enable mail header in php.ini

- In Linux servers if there are a lot of emails in the queue "over 100" emails. you can check if...