Question
DNS resolution has stopped working on my Ubuntu 16.04 droplet
Having some issues with dns resolution on my Ubuntu 16.04 droplet with dns.
$ dig google.com
; <<>> DiG 9.10.3-P4-Ubuntu <<>> google.com
;; global options: +cmd
;; connection timed out; no servers could be reached
No changes were made to network configuration before I tried to troubleshoot this issue. I’ve tried changing the nameservers in /etc/network/interfaces.d/50-cloud-init.cfg to no avail.
/etc/resolv.conf is empty (except for some comments). If I manually add a nameserver to /etc/resolv.conf, it does work. Of course this doesn’t solve the issue because changes won’t be persisted over reboot.
$ cat /etc/resolv.conf && dig google.com
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 1.1.1.1
; <<>> DiG 9.10.3-P4-Ubuntu <<>> google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 39462
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1452
;; QUESTION SECTION:
;google.com. IN A
;; ANSWER SECTION:
google.com. 221 IN A 216.58.195.78
;; Query time: 1 msec
;; SERVER: 1.1.1.1#53(1.1.1.1)
;; WHEN: Sun Sep 29 19:31:00 UTC 2019
;; MSG SIZE rcvd: 55
Anyone have similar issues?
EDIT
50-cloud-init.cfg contents (ip’s redacted):
$ cat /etc/network/interfaces.d/50-cloud-init.cfg
# This file is generated from information provided by
# the datasource. Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
auto lo
iface lo inet loopback
dns-nameservers 67.207.67.3
auto eth0
iface eth0 inet static
address XXX.XXX.XXX.XXX/20
gateway XXX.XXX.XXX.XXX
# control-alias eth0
iface eth0 inet static
address XXX.XXX.XXX.XXX/16
Originally there was a second nameserver defined (next to 67.207.67.3) but I deleted it when messing around and now don’t remember what it was.
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.
×