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