Very slow DNS lookup
Solution 1
The problem seems to be that there is a faulty DNS server in the file /etc/resolvconf/resolv.conf.d/head
.
Edit the head
file and delete the line that says nameserver 10.63.240.10
and you should have solved your problem.
Run sudo nano /etc/resolvconf/resolv.conf.d/head
from the Terminal to edit the file and make sure that the only content of the file is:
# 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
Hope this solves your problem.
Solution 2
I had the same problem. To solve it, I changed my DNS server settings and now everything gets resolved really fast (apt update, Firefox startup, git, etc.).
Change DNS server settings:
If you are using a wired network, go to Ubuntu Settings > Network > Wired > Options > IPv4. Make sure IPv4 Method is Automatic (DHCP) and choose your DNS server (I personally use https://1.1.1.1/dns/). You can do the same for IPv6, make sure to put a valid IPv6 to the DNS server.
If you are using a Wireless connection, go to Ubuntu Settings > Wireless > [YourWifi] > Options and follow the same instructions.
Related videos on Youtube
Ghost
Updated on September 18, 2022Comments
-
Ghost over 1 year
I'm on Ubuntu 16.04 LTS, and when I visit a website/curl/wget/ping/etc anything that isn't an IP address, it takes an annoyingly long time (> 5 s), whereas anything directly using an IP address is pretty much instant (< 10 ms, as one would expect).
When I
cat /etc/NetworkManager/NetworkManager.conf
, I get:[main] plugins=ifupdown,keyfile,ofono dns=dnsmasq [ifupdown] managed=false
I've tried changing to
#dns=dnsmasq
, but it didn't have any noticeable effect.cat /etc/network/interfaces
is also quite basic:# interfaces(5) file used by ifup(8) and ifdown(8) auto lo iface lo inet loopback
A bit odd is
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 10.63.240.10 nameserver 127.0.1.1 search $companydomain$.com
The
nameserver 10.63.240.10
is something a colleague doesn't have, and is the only way in which the above 3 files differ for us. I suspect that is the root of the issue, because when I dohost www.stackexchange.com 10.63.240.10
, I get:;; connection timed out; no servers could be reached
Commenting it out and restarting the network-manager fixes the issue temporarily, only to return upon rebooting.
I've also noticed in the Network Connections menu, two (seemingly) auto-generated Bridge entries are listed:
br-8f98800bd128
andbr-bd749c12d64c
. If I delete these, they're back after a reboot. My aforementioned colleague doesn't have these either.I've also tried the suggestions from How do I configure my DNS settings in Ubuntu server? and Extrememly slow DNS lookup, but the issue remains.
Per M. Becerra's suggestion, I ran
sudo updatedb; locate 10.63.240.10
. This didn't give me any output.Mikael Schultz suggested I do
nmcli device show
, which outputs:GENERAL.DEVICE: br-8f98800bd128 GENERAL.TYPE: bridge GENERAL.HWADDR: 02:42:50:5E:58:3B GENERAL.MTU: 1500 GENERAL.STATE: 100 (connected) GENERAL.CONNECTION: br-8f98800bd128 GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/2 IP4.ADDRESS[1]: 172.18.0.1/16 IP4.GATEWAY: IP6.GATEWAY: GENERAL.DEVICE: br-bd749c12d64c GENERAL.TYPE: bridge GENERAL.HWADDR: 02:42:B1:85:6D:E3 GENERAL.MTU: 1500 GENERAL.STATE: 100 (connected) GENERAL.CONNECTION: br-bd749c12d64c GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/3 IP4.ADDRESS[1]: 172.19.0.1/16 IP4.GATEWAY: IP6.GATEWAY: GENERAL.DEVICE: docker0 GENERAL.TYPE: bridge GENERAL.HWADDR: 36:CA:3D:66:B7:03 GENERAL.MTU: 1500 GENERAL.STATE: 100 (connected) GENERAL.CONNECTION: docker0 GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/1 IP4.ADDRESS[1]: 172.17.0.1/16 IP4.GATEWAY: IP6.GATEWAY: GENERAL.DEVICE: wlp3s0 GENERAL.TYPE: wifi GENERAL.HWADDR: 00:28:F8:9C:2A:4D GENERAL.MTU: 0 GENERAL.STATE: 100 (connected) GENERAL.CONNECTION: Crowdynews GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/0 IP4.ADDRESS[1]: 10.0.0.27/24 IP4.GATEWAY: 10.0.0.1 IP4.ROUTE[1]: dst = 169.254.0.0/16, nh = 0.0.0.0, mt = 1000 IP4.DNS[1]: 8.8.8.8 IP4.DNS[2]: 8.8.4.4 IP4.DOMAIN[1]: crowdynews.com IP6.ADDRESS[1]: fe80::9264:b967:1c59:3e50/64 IP6.GATEWAY: GENERAL.DEVICE: enp4s0 GENERAL.TYPE: ethernet GENERAL.HWADDR: C8:5B:76:F1:1C:EC GENERAL.MTU: 1500 GENERAL.STATE: 20 (unavailable) GENERAL.CONNECTION: -- GENERAL.CON-PATH: -- WIRED-PROPERTIES.CARRIER: off GENERAL.DEVICE: lo GENERAL.TYPE: loopback GENERAL.HWADDR: 00:00:00:00:00:00 GENERAL.MTU: 65536 GENERAL.STATE: 10 (unmanaged) GENERAL.CONNECTION: -- GENERAL.CON-PATH: -- IP4.ADDRESS[1]: 127.0.0.1/8 IP4.GATEWAY: IP6.ADDRESS[1]: ::1/128 IP6.GATEWAY:
ip address
prints:1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: enp4s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000 link/ether c8:5b:76:f1:1c:ec brd ff:ff:ff:ff:ff:ff 3: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 00:28:f8:9c:2a:4d brd ff:ff:ff:ff:ff:ff inet 10.0.0.27/24 brd 10.0.0.255 scope global dynamic wlp3s0 valid_lft 1660731sec preferred_lft 1660731sec inet6 fe80::9264:b967:1c59:3e50/64 scope link valid_lft forever preferred_lft forever 4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default link/ether 02:42:f3:cd:08:8c brd ff:ff:ff:ff:ff:ff inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0 valid_lft forever preferred_lft forever 5: br-8f98800bd128: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default link/ether 02:42:50:5e:58:3b brd ff:ff:ff:ff:ff:ff inet 172.18.0.1/16 brd 172.18.255.255 scope global br-8f98800bd128 valid_lft forever preferred_lft forever 6: br-bd749c12d64c: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default link/ether 02:42:b1:85:6d:e3 brd ff:ff:ff:ff:ff:ff inet 172.19.0.1/16 brd 172.19.255.255 scope global br-bd749c12d64c valid_lft forever preferred_lft forever
cat /etc/resolvconf/resolv.conf.d/head
:# 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 10.63.240.10
cat /etc/resolvconf/resolv.conf.d/base
generates no output.How do I fix this?
-
M. Becerra almost 6 yearsTry to change to a name server like
8.8.8.8
- Side note: whois.domaintools.com/10.63.240.10 -
Ghost almost 6 yearsI've tried adding a line with
dns-nameservers 8.8.8.8
in /etc/network/interfaces, but that didn't fix it, because10.63.240.10
was still tried first. -
M. Becerra almost 6 yearsPlease comment out the original name server to let
8.8.8.8
be used -
Ghost almost 6 yearsWhere? Removing
nameserver 10.63.240.10
from/etc/resolv.conf
and then manually restarting the network-manager only works temporarily. It's back after a reboot. I can't find where it keeps coming from, but it always returns. -
Ghost almost 6 yearsDone. It didn't give me any output...
-
M. Becerra almost 6 yearsSorry I meant
sudo grep -r "10.63.240.10" /*
.Also try to comment out the current name server at/etc/resolv.conf
by editing it like this# nameserver 10.63.240.10
and then appendnameserver 8.8.8.8
-
Ghost almost 6 yearsAs mentioned, commenting out
nameserver 10.63.240.10
from/etc/resolv.conf
seems to work, but a reboot reinstates the problem. -
Admin almost 6 yearsCould you edit your answer with the output of the command
nmcli device show
? And also the output of the commandip address
. -
Ghost almost 6 yearsOf course. See above for edits. :)
-
Admin almost 6 yearsNice, but it looks okay to me. Can you also insert the output of
cat /etc/resolvconf/resolv.conf.d/head
andcat /etc/resolvconf/resolv.conf.d/base
? -
Ghost almost 6 yearsI've added both.
resolv.conf.d/base
is empty.
-
-
Ghost almost 6 yearsIt seems your suggestion worked. Should this be a permanent solution? Because it even says in the file any modifications will be overwritten. I've rebooted, but that didn't seem to restore the file to the version with
nameserver 10.63.240.10
, so DNS requests are still quick. :) Do you have any idea where the custom DNS server might've come from? As far as I know, I haven't set it myself, and I'm the only one who's installed anything on this laptop. Could it have been set by some network settings? -
Devin almost 6 yearsI would consider it a permanent solution. If it isn’t I’m sure someone will object :) It should not have been there in the first place and I have no idea how it got there. These (head and base) are the files that will be the source of the file /etc/resolv.conf when it is generated, that is why the text is saying that modifications will be overwritten.
-
Ghost almost 6 yearsAha, so the
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
line is only in the/etc/resolv.conf.d/head
file so it finds its way into the regular/etc/resolv.conf
file? Thanks! -
Devin almost 6 yearsYes that is my understanding. No problem :)
-
Pablo Bianchi over 4 yearsOP seems to like using terminal, the equivalent way is using
nmtui
(NetworkManager TUI)