0

I have been suffering a 5-10 second lag from EVERY connection in a new browser tab, or a curl request. I have found out on the Internet that I should disable IPv6. But when I disabled IPv6 the Chrome tabs started loading instantly but my terminal commands that connect to the internet still suffer from that lag.

I am using Manjaro Linux 23.0.2

Here are the smallest examples I can show you:

curl

$ time curl google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
curl google.com  0,00s user 0,01s system 0% cpu 5,283 total

ping (first line is printed after 5 seconds)

$ time ping -c 5 google.com
PING google.com (142.250.184.142) 56(84) bytes of data.
64 bytes from sof02s43-in-f14.1e100.net (142.250.184.142): icmp_seq=1 ttl=55 time=9.70 ms
64 bytes from sof02s43-in-f14.1e100.net (142.250.184.142): icmp_seq=2 ttl=55 time=12.3 ms
64 bytes from sof02s43-in-f14.1e100.net (142.250.184.142): icmp_seq=3 ttl=55 time=14.4 ms
64 bytes from sof02s43-in-f14.1e100.net (142.250.184.142): icmp_seq=4 ttl=55 time=9.86 ms
64 bytes from sof02s43-in-f14.1e100.net (142.250.184.142): icmp_seq=5 ttl=55 time=11.2 ms

--- google.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4006ms
rtt min/avg/max/mdev = 9.696/11.495/14.419/1.746 ms
ping -c 5 google.com  0,01s user 0,00s system 0% cpu 9,043 total

But this command is very fast:

$ time nslookup google.com
Server:     1.1.1.1
Address:    1.1.1.1#53

Non-authoritative answer:
Name:   google.com
Address: 142.250.184.142
Name:   google.com
Address: 2a00:1450:4017:814::200e

nslookup google.com  0,01s user 0,03s system 22% cpu 0,147 total

Things i have tried:

  • changed my dns servers to cloudflare and google (in Wi-Fi settings)
  • disabled ipv6

The question is how can I diagnose the problem? And if possible, how can I solve it?

1
  • Please edit your Question to include the OS name and version. If macOS, also include the output of scutil --dns.
    – Spiff
    Sep 22 at 14:48

1 Answer 1

1

The question is how can I diagnose the problem?

First I would suggest to un-disable everything that you tried disabling. Diagnose the problem when the system is in its normal state.

Since this looks like a network connection timeout (possibly a DNS query timeout), open a packet capture tool (Wireshark for a start), and watch the packet capture as you try to curl or ping something. Look for outgoing requests that don't seem to have a reply, e.g. a LLMNR or mDNS or NBNS query, or a DNS query sent to the wrong server. Close your browser and other programs that might generate a lot of noise in the capture.

The nslookup tool doesn't work the same way as curl or ping – it is specifically a DNS query tool and will directly talk to one of your configured DNS servers, whereas the other programs don't do that; they use the system-provided "hostname lookup" function, which does a bit more than just DNS. The Linux version has various modules that can be enabled through /etc/nsswitch.conf – in addition to 'files' (/etc/hosts) and 'dns' (/etc/resolv.conf), you might have something like 'resolve' (the systemd-resolved service that acts as a local DNS cache) or 'mdns' (local-subnet name lookup). You should take a look at the nsswitch.conf file as well as try using getent hosts to make queries.

getent hosts google.com
getent -s dns hosts google.com
getent hosts 1.1.1.1
getent -s dns hosts 1.1.1.1

From ping's behavior, it might be either the forward query or the reverse "IP→domain" query that takes a while; test both separately.

With simpler tools (e.g. ping), running the tool under strace might reveal what it's waiting for; e.g. if it seems to pause on recv(5, ..) you scroll up until you find connect(5, <address>).

You must log in to answer this question.

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