Changing the domain resolution settings

To use a DNS server of our choosing, we should use nmcli.

In the following code, we're setting our own DNS server value (1.1.1.1) and we're flipping the truth value of ipv4.ignore-auto-dns from no to yes:

$ sudo nmcli connection modify System\ eth0 ipv4.dns "1.1.1.1" ipv4.ignore-auto-dns "yes"

Note how both of these fields can be modified on one line.

Reload the interface configuration using the following:

$ sudo nmcli connection up System\ eth0

Look in /etc/resolv.conf for good measure, just to check:

$ cat /etc/resolv.conf 
# Generated by NetworkManager
nameserver 1.1.1.1

Then, run dig:

$ dig bbc.co.uk

; <<>> DiG 9.9.4-RedHat-9.9.4-61.el7 <<>> bbc.co.uk
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 10132
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1452
;; QUESTION SECTION:
;bbc.co.uk. IN A

;; ANSWER SECTION:
bbc.co.uk. 210 IN A 151.101.0.81
bbc.co.uk. 210 IN A 151.101.64.81
bbc.co.uk. 210 IN A 151.101.128.81
bbc.co.uk. 210 IN A 151.101.192.81

;; Query time: 23 msec
;; SERVER: 1.1.1.1#53(1.1.1.1)
;; WHEN: Sun Aug 12 14:46:05 UTC 2018
;; MSG SIZE rcvd: 102
1.1.1.1 is a new and trendy DNS service from Cloudflare and APNIC. This isn't an endorsement, it's just really easy to remember.