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
Router internal LANIPv4 address: 192.168.9.1
Primary DNS: 22.214.171.124, Secondary DNS 126.96.36.199
(Also tried 188.8.131.52 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 (184.108.40.206) 56(84) bytes of data. 64 bytes from bom12s18-in-f4.1e100.net (220.127.116.11): icmp_seq=1 ttl=118 time=25.1 ms.
[ramkumarr@RR-W520 ~]$ ping -n www.google.com PING www.google.com (18.104.22.168) 56(84) bytes of data. 64 bytes from 22.214.171.124: 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 [126.96.36.199] with 32 bytes of data: Reply from 188.8.131.52: 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 184.108.40.206 PING 220.127.116.11 (18.104.22.168) 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: 22.214.171.124", 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: 126.96.36.199 ;; 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: 188.8.131.52
Contents of /etc/resolv.conf
# Generated by NetworkManager search Home nameserver 192.168.9.1
C:\Users\ramku>ipconfig /all | find /i "dns servers" DNS Servers . . . . . . . . . . . : 192.168.9.1 C:\Users\ramku>
[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: 184.108.40.206 IP4.DNS: 220.127.116.11
With client at "Automatic" and no DNS specified
[ramkumarr@RR-W520 ~]$ ( nmcli dev list || nmcli dev show ) 2>/dev/null | grep DNS IP4.DNS: 192.168.9.1