4

I'm hoping this will be an interesting problem for Linux networking aficionados. In summary, I have a new broadband modem/router connected to an ISP offering a 40Mbit/s bandwidth. However, the initial connect to any website using a browser on a Linux distro takes a good 20s whereas on an Android phone or Windows the website opens as quickly as you might expect. A ping command (with domain name) too takes 20s to show ANY output at all (even the ip address). Let's focus on ping:

  • When pinging by ip address there is no issue. A 20s delay only when pinging by domain name

  • the ping delay of 20s shows up even when I try it from a live linux USB - whether it is Manjaro or Linux Mint

  • the delay is seen even if I try on another computer with live-booted Linux

  • ping from the same laptop(s) running Windows returns results practically instantly - even with domains I have never visited before.

  • ping from a terminal on a Pixel 2XL phone running Android returns results instantly

  • the problem exists whether I connect my laptop via wifi or via ethernet cable to the router

  • the same Linux distro on the same laptop, when connected to my mobile hotspot does not have the issue

  • Ping -4 to force IPv4 does not help - the delay is still 20s

  • As suggested by a senior member of the Manjaro forum I tried moving from openresolv to systemd-resolved but that increased the delay to over 2 minutes and I had to roll back the change.

  • Having described ping, let me describe how Firefox works on Linux. The first access to any website takes 20 seconds, but thereafter even if I access a website I have never accessed earlier it opens up as expected - in less than a couple of seconds, However if I close Firefox and open a fresh instance I again have to wait for 20 seconds for the first website I access - even if it is Google.

This is as you realize not a "fun" question but a rather perplexing one and almost a showstopper for me. The problem is specifically with the combination of Linux and this new router and I have no idea where to look for a solution.I have of course had a long discussion on the Manjaro forum where I hit a dead end.

Thanks very much for reading! Best - Ram

Network Info

Router internal LANIPv4 address: 192.168.9.1

Primary DNS: 125.22.47.125, Secondary DNS 203.145.160.4

(Also tried 8.8.8.8 as primary DNS)

My laptop: 192.168.9.6

*Examples and Test outputs:

The response starting with "PING" appears 20-30s after I type the following command:

[ramkumarr@RR-W520 ~]$ ping www.google.com
PING www.google.com (142.250.192.132) 56(84) bytes of data.
64 bytes from bom12s18-in-f4.1e100.net (142.250.192.132): icmp_seq=1 ttl=118 time=25.1 ms. 
[ramkumarr@RR-W520 ~]$ ping -n www.google.com
PING www.google.com (142.250.192.100) 56(84) bytes of data.
64 bytes from 142.250.192.100: icmp_seq=1 ttl=59 time=29.4 m
---> Again a 20s delay before any output appears.

On Windows the response is almost instantaneous (less than half a second)

Pinging www.google.com [142.250.182.36] with 32 bytes of data:
Reply from 142.250.182.36: bytes=32 time=11ms TTL=118

And instantaneous on Linux with ip address below but not with domain name such as www.google.com:

[ramkumarr@RR-W520 ~]$ ping -W 0.001 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.

Contents of /etc/nsswitch.conf

# Name Service Switch configuration file.
# See nsswitch.conf(5) for details.

passwd: files mymachines systemd
group: files [SUCCESS=merge] mymachines systemd
shadow: files

publickey: files

hosts: files mymachines mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dns mdns4 myhostname
networks: files

protocols: files
services: files
ethers: files
rpc: files

netgroup: files

Output of nslookup www.google.com - ends with a timeout on both Linux as well as Windows. On Linux the output is instantaneous upto the line "Address: 142.250.192.132", then a delay, then the timeout message.

[ramkumarr@RR-W520 ~]$ nslookup www.google.com
Server:         192.168.9.1
Address:        192.168.9.1#53

Non-authoritative answer:
Name:   www.google.com
Address: 142.250.192.132
;; connection timed out; no servers could be reached

[ramkumarr@RR-W520 ~]$ 

...and on Windows

C:\Users\ramku>nslookup www.google.com
Server:  TJ2100N.Home
Address:  192.168.9.1

DNS request timed out.
    timeout was 2 seconds.
Non-authoritative answer:
DNS request timed out.
    timeout was 2 seconds.
Name:    www.google.com
Address:  142.250.195.100

Contents of /etc/resolv.conf

# Generated by NetworkManager
search Home
nameserver 192.168.9.1

On Windows

C:\Users\ramku>ipconfig /all | find /i "dns servers"
   DNS Servers . . . . . . . . . . . : 192.168.9.1

C:\Users\ramku>

On Linux:

[ramkumarr@RR-W520 ~]$ sudo iptables -nvL
[sudo] password for ramkumarr: 
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
[ramkumarr@RR-W520 ~]$ 
[ramkumarr@RR-W520 ~]$ ip route get 192.168.9.1
192.168.9.1 dev wlp3s0 src 192.168.9.10 uid 1000 
    cache 
[ramkumarr@RR-W520 ~]$
--> 192.168.9.10 is my laptop ip address

Workaround/solution? As suggested in one of the answers below, setting the DNS on the client side in the wifi preferences tab forced the laptop to access the Google DNS, but without that the laptop reported 192.168.9.1 as the DNS as shown below:

With DNS set in wifi prefs with "Automatic (Addresses only)"

[ramkumarr@RR-W520 ~]$ ( nmcli dev list || nmcli dev show ) 2>/dev/null | grep DNS
IP4.DNS[1]:                             8.8.8.8
IP4.DNS[2]:                             8.8.4.4

With client at "Automatic" and no DNS specified

[ramkumarr@RR-W520 ~]$ ( nmcli dev list || nmcli dev show ) 2>/dev/null | grep DNS
IP4.DNS[1]:                             192.168.9.1
11
  • This is the key: "When pinging by ip address there is no issue. A 20s delay only when pinging by domain name". Your DNS resolution is the issue: that's what you need to investigate Sep 16, 2021 at 18:50
  • 1
    Thank you @LinuxSecurityFreak - nslookup times out on Windows as well as Linux. Could that be the real clue?
    – Ram
    Sep 17, 2021 at 1:44
  • 1
    HI @roaima, yes the delay in pinging by name would certainly point to DNS resolution. However at the same time the nslookup gets the ip address in a flash and then hangs for some time before timing out. Does this give us a better picture of what could be happening?
    – Ram
    Sep 17, 2021 at 5:02
  • 1
    Done. Lots of blessings and beer await you, @roaima
    – Ram
    Sep 17, 2021 at 16:26
  • 1
    Don't know what that means but please note that whatever it is, both linux distros I tried from the live USB must have it then because both exhibited the problem out of the box!
    – Ram
    Sep 17, 2021 at 16:31

3 Answers 3

3

For an ordinary testing scenario, we will try to force your Linux Mint to use Google Public DNS:

  • Primary DNS resolver: 8.8.8.8 (IPv4)
  • Secondary DNS resolver: 8.8.4.4 (IPv4)

You can do that relatively simple, like this:

  1. Left click on your Wifi/LAN icon:

    enter image description here

  2. From the menu click on Network Connections:

    enter image description here

  3. Double click on the corresponding WiFi/LAN:

    enter image description here

  4. In the connection settings, go to the IPv4 Settings tab:

    enter image description here

  5. Change the Method to DHCP Addresses only, and fill in the mentioned DNS servers:

    enter image description here

  6. Hit Save, and turn off/on your WiFi/LAN link.


Finally, just to confirm our little experiment has been completed successfully, copy-paste to your terminal:

( nmcli dev list || nmcli dev show ) 2>/dev/null | grep DNS

to show which DNS you are using now:

IP4.DNS[1]:                             8.8.8.8
IP4.DNS[2]:                             8.8.4.4

Now try to ping some domain name.


Disclaimer

I hereby directly recommended the use of a Google product, which I do not use myself or recommend to others.

This answer is only for testing purposes. I do not recommend these DNS resolvers to my colleagues. If need be said one example for all, I would recommend 1.1.1.1 Cloudflare DNS service with addresses:

IPv4

  • Primary:

    1.1.1.1
    
  • Secondary:

    1.0.0.1
    

IPv6

  • Primary:

    2606:4700:4700::1111
    
  • Secondary:

    2606:4700:4700::1001
    

Cloudflare DNS resolvers are privacy-focused and even more secure in a sense. More information here.

I further decline that there would be any affiliation between me and mentioned companies.

5
  • I'd suggest clearing the router's DNS addresses for time being. If this works, you can try replacing google DNS with ISP:s servers on the client, but one at a time. Troubleshooting by babysteps is a bit slow, but usually very effective :-) I'd still use static IPs as well while testing DNS - shouldn't make a difference... but the operative words in IT are "should" and "shouldn't", so I usually lock down everything I can. Sep 17, 2021 at 18:14
  • Thank you @LinuxSecurityFreak - adding Google DNSes on the client laptop in the wifi config tab WORKED. pings are instant, websites open in a flash. Is this the "Final Solution" (ugh - no ref to Eichmann)? Or only a means to arrive at it? Let me know so I can appropriately tick off your answer.
    – Ram
    Sep 18, 2021 at 3:41
  • It's a confirmation :-) Can you please try what I suggested above; replace both google DNS:s with one of the ISPs and test; then replace that with the other one and test again, and let us know the result? We know now that the prob is between your modem and ISP, this will tell whether their DNS servers are responding correctly. Sep 18, 2021 at 6:21
  • @LinuxSecurityFreak - did I miss a step? It's between Ram's router and ISP:s servers for certain, but were those already at some point confirmed doing their job correctly? Sep 18, 2021 at 6:28
  • LinuxSecurityFreak and Peregrino69 - I have updated the problem description with additional details right on top so those in conjunction with the 2 answers provided by LinuxSecurityFreak and @roaima complete the entire picture. Note that armed with all this tech info I was indeed able to make a case and get the router replaced today by a better Nokia optical router also offered by the same ISP whose tech person confessed he had indeed encountered similar issues with other non-Windoze users with that particular rogue router :-)
    – Ram
    Sep 18, 2021 at 11:30
3

Your DNS server 192.168.9.1 is not serving DNS requests. This can be seen from your Windows and Linux systems (I'm ignoring the Android one):

Windows:

nslookup www.google.com
Server:  TJ2100N.Home
Address:  192.168.9.1

DNS request timed out.
    timeout was 2 seconds.
Non-authoritative answer:
DNS request timed out.
    timeout was 2 seconds.
Name:    www.google.com
Address:  142.250.195.100

Linux:

nslookup www.google.com
Server:         192.168.9.1
Address:        192.168.9.1#53

Non-authoritative answer:
Name:   www.google.com
Address: 142.250.192.132
;; connection timed out; no servers could be reached

In both cases you can see a timeout followed a non-authoritative response. This will have come from each system's local DNS cache, quite possibly from a record that has exceeded its validity lifetime (TTL).

If you were to try and look up a host that you had never before referenced, my expectation is that both Windows and Linux-based systems would fail to resolve the name to an address.

You need to investigate the server at 192.168.9.1 and find out why it's not serving DNS requests, as that is where the problem lies.

1
  • Comments are not for extended discussion; this conversation has been moved to chat.
    – Jeff Schaller
    Sep 18, 2021 at 22:54
2

Thanks to all the learning from the incredibly useful inputs here and on the Manjaro forums I was able to take it up with the ISP and have my router changed. The notes in this answer supplement what the other answers describe.

The issue appears to be related to how the firmware of my router at 192.168.9.1 was handling DNS requests made to 192.168.9.1. Once Windows got the DNS addresses it appears it would cache it in the DNS Resolver Cache (I believe) and therefore there was apparently no problem with Windows. However it appears that Linux does not do OS level DNS caching as described here https://stackoverflow.com/questions/11020027/dns-caching-in-linux 1 and therefore each ping request would, because it treated 192.168.9.1 as the DNS server, cause the router to exhibit that 20s hang. Where exactly the router firmware was behaving rogue is not known, however it is clear that adding Google DNS servers on the client side was effectively bypassing that rogue piece of firmware. A change of router solved the problem.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .