By joek1010
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.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hello, @joek1010
You can edit ``` /etc/network/interfaces.d/50-cloud-init.cfg
Check that your block looks like this:
auto eth0
iface eth0 inet static
address XXX.XXX.XXX.XXX/20
gateway XXX.XXX.XXX.XXX
dns-nameservers 67.207.67.3
# control-alias eth0
iface eth0 inet static
address XXX.XXX.XXX.XXX/16
dns-nameservers 67.207.67.3
$ cat /etc/resolv.conf
# 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 67.207.67.3
Before making any changes, please make sure to create a copy of the file in case the change does not make a difference so you can revert everything back.
The other option will be to edit your interface configuration, which is located in: /etc/network/interfaces as this is something a lot of people use. I personally have two resolv.conf files in order to prevent any issues with the DNS resolution.
Let me know if you have any questions.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.