Score:1

Ubuntu 18.04 DNS Not Working

lc flag
cjt

I'm having a problem with DNS on Ubuntu 18.04. I think there is a misconfiguration somewhere between netwrok-manager, systemd-resolved and resolvconf.

I can ping IP addresses ok, but not host names:

$ ping -c 3 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=120 time=5.07 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=120 time=4.89 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=120 time=4.33 ms

--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 4.336/4.768/5.072/0.318 ms

$ ping -c 3 www.google.com
ping: www.google.com: Name or service not known

Both systemd-resolved and resolvconf services are running:

There is a symlink /etc/resolv.conf pointing to /run/systemd/resolve/stub-resolv.conf

nameserver 127.0.0.53 
options edns0

If I replace /etc/resolv.conf symlink with a file containing the below, hostnames are resolved

search station
nameserver 127.0.1.1

I'd like to know how to fix it so it works without having to remove the symlink. Can someone please advise on how to fix this issue?

CrazyTux avatar
us flag
try to replace the `127.0.1.1` on the `resolv.conf` to `1.1.1.1` or `8.8.8.8` and save the file, see if that is solving your question.
cjt avatar
lc flag
cjt
Thanks @CrazyTux . Yes, 8.8.8.8 works. But 127.0.1.1 also worked. My issue is if I remove the static file and replace it with the symlink that was originally there then DNS stops working
Score:0
in flag

The problem is that the DNS server you're using to resolve domain names is not able to resolve the requested domain. When you're using localhost as a DNS server, it might not have your requested domain. So you have to either use your router's DNS settings (change IP that is right next to the namespace keyword to 192.168.1.1) or you should use some public ones like Cloud's (1.1.1.1) or Google's (8.8.8.8) DNS servers. You can also find other public DNS servers and you can even pay for some of them. Whichever option you go with, it's up to you. But I would not recommend using your local host (127.0.0.1/8) as a DNS server.

cjt avatar
lc flag
cjt
Thanks @Muhammed Özen . I found there was an underlying issue with a misconfigured virtual network and dnsmasq. Once I removed the virtual network and the dnsmasq entries, it worked as normal
Muhammed Özen avatar
in flag
I'm glad you solved the issue. I couldn't be of much help but you're welcome
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.