Site icon GetPageSpeed

Setup CloudFlare DNS resolution in CentOS/RHEL 7 servers

CloudFlare 1.1.1.1

Reliable and fast DNS resolution is essential for running any networked device. Web servers are no exclusion.

How servers benefit from fast DNS?

Improving the DNS resolution speed, will also improve all the server functions which use DNS. This applies to:

Enable CloudFlare 1.1.1.1 DNS resolution in CentOS 7

Since CentOS 7 uses NetworkManager by default, we can easily enable the great new 1.1.1.1 DNS service by CloudFlare with a few commands only.

We assume that your main network interface is eth0. Let’s start with making sure that the DNS servers sent by DHCP are not used:

nmcli connection modify eth0 ipv4.ignore-auto-dns yes

Now, adjust configuration profile to use CloudFlare fast DNS servers. For IPv4, run:

nmcli connection modify eth0 ipv4.dns 1.1.1.1,1.0.0.1

And for IPv6, you may want to additionally run:

nmcli connection modify eth0 ipv6.dns 2606:4700:4700::1111,2606:4700:4700::1001

Now we have configured our network settings, but they are not yet live. Let’s bring up the use of CloudFlare DNS nameservers:

nmcli connection up eth0 

Wasn’t that easy? Now your server uses the fastest DNS nameservers. And if you don’t trust my word, you can use dnsperftest from our repository to confirm.

Exit mobile version