2

I'd like to take advantage of the recent Cloudflare 1.1.1.1 DNS service on my Ubuntu 16.04 based server. Any ideas how can I implement it permanently?

The reason is that

/etc/resolv.conf

changes automatically and as the file states we shouldn't edit it manually.

What the best way to do so, for both ipv4 and ipv6?

fosslinux
  • 3,831

1 Answers1

2

This is more or less "how do I set a static IP"

Follow this answer for a similar question on Ubuntu 12.04 which is more or less identical in application.

The relevant bit is your Name server

How do I configure my DNS settings in Ubuntu server?

Though in keeping with many concerns of links relevant info from that question, the correct file your looking for is

/etc/network/interfaces

and the part to modify should look similar to this

The primary network interface
auto eth0
iface eth0 inet static
address 192.168.X.X
netmask 255.255.255.0
gateway 192.168.X.X
dns-nameservers 1.1.1.1 

This is the officially suggested method for changing/adding name servers from Ubuntu main help guides.

https://help.ubuntu.com/lts/serverguide/network-configuration.html#name-resolution

To configure the resolver, add the IP addresses of the nameservers that are appropriate for your network in the file /etc/network/interfaces.

Daniel
  • 21