Linux & ServersNetworking

Linux Network Troubleshooting: From “The Site Won’t Load” to the Culprit

A layer-by-layer method using ss, curl, dig, mtr and tcpdump, so you know exactly whether the problem is the service, DNS, the firewall, the path or MTU.

Linux Network Troubleshooting: From “The Site Won’t Load” to the Culprit
Table of contents
  1. 1. Is the service listening at all?
  2. 2. Does it answer from the server itself?
  3. 3. Is DNS answering correctly?
  4. 4. Is the path to the server healthy?
  5. 5. Is the port open from outside?
  6. 6. Which part of the request is slow?
  7. 7. Looking at the packets with tcpdump
  8. 8. MTU problems: the error that looks like nothing else
  9. Summary: a quick decision table

“The site won’t load” can have ten different causes, and the most common mistake is jumping to fixes before finding the layer the problem lives in: restarting Nginx, changing DNS, opening ports in the hope that something sticks. The method below starts inside the server and works its way outwards; each step confirms or rules out one hypothesis.

1. Is the service listening at all?

sudo ss -tulpn

The Local Address column matters: 127.0.0.1:8080 means reachable only from inside the server, while 0.0.0.0:443 or *:443 means every interface. If the port you expect isn’t listed, it isn’t a network problem; the service didn’t start, so look at systemctl status or docker logs.

2. Does it answer from the server itself?

curl -sv http://127.0.0.1:8080/ -o /dev/null
curl -sv https://example.com/ --resolve example.com:443:127.0.0.1 -o /dev/null

--resolve sends the request with the real domain name (so SNI and the virtual host are right) but directly to the server itself, taking DNS and the outside network out of the equation. If this fails, the problem is in Nginx or the application, not the network.

3. Is DNS answering correctly?

dig +short example.com
dig +short example.com @1.1.1.1
dig +short example.com @8.8.8.8
resolvectl status            # the resolvers the server itself uses

If different resolvers give different answers, either a record change hasn’t propagated yet (look at the old record’s TTL) or one resolver is returning something else. For the authoritative answer, ask the domain’s own name server directly: dig example.com @ns1.your-dns-provider.com.

4. Is the path to the server healthy?

ping -c 10 SERVER_IP
mtr -rwzc 100 SERVER_IP

mtr combines ping and traceroute and shows loss and latency for every hop. One important rule for reading it: loss that appears at a single intermediate hop and doesn’t continue to the destination is usually not real; routers give ICMP aimed at themselves low priority. Only loss that starts at a hop and carries on to the last line matters.

Many servers and firewalls block ICMP; if ping gets no reply but the service works, don’t worry. With --tcp -P 443, mtr probes the path with TCP packets on the service’s own port.

5. Is the port open from outside?

Run this test from outside the server:

nc -zv -w 5 SERVER_IP 443
curl -v --connect-timeout 5 https://example.com/
Result Meaning
Connection refused The packet reached the server, but nothing is listening on that port (or a firewall answered with REJECT).
Timeout The packet was silently dropped on the way or by a firewall (on the server, at the data centre, or along the path).
Connects, but TLS hangs Suspect MTU (step 8) or SNI-based filtering.

If you suspect the server’s own firewall:

sudo ufw status verbose
sudo nft list ruleset | less
sudo iptables -L -n -v --line-numbers

The packet counter column (pkts) in iptables -v output is very helpful: send the request again and watch which DROP rule’s counter goes up. If the port belongs to a Docker container, also consider how UFW and Docker interact.

6. Which part of the request is slow?

When the site loads but slowly, curl can report the time of each phase separately:

curl -o /dev/null -s -w 'dns: %{time_namelookup}s\nconnect: %{time_connect}s\ntls: %{time_appconnect}s\nfirst byte: %{time_starttransfer}s\ntotal: %{time_total}s\n' https://example.com/

The numbers are cumulative, each measured from the start of the request:

  • A large dns: the resolver is slow.
  • A big gap between dns and connect: high network latency (RTT) to the server.
  • A big gap between tls and first byte: the server or application is slow to build the response; it is not the network.

7. Looking at the packets with tcpdump

When every test is confusing, tcpdump shows the truth: does the packet reach the server at all? Does the server reply?

sudo tcpdump -ni eth0 tcp port 443 and host CLIENT_IP
sudo tcpdump -ni any 'tcp[tcpflags] & (tcp-syn|tcp-rst) != 0' -c 50

If you see the client’s SYN but no SYN-ACK goes back, the problem is on the server (firewall or service). If the SYN never shows up, the packet was dropped before it reached the server, so look at the data centre firewall or the path.

8. MTU problems: the error that looks like nothing else

The classic symptoms: SSH connects but hangs on the first long output; small pages load but large ones don’t; the TLS handshake stalls half way. The cause: somewhere on the path (a tunnel, PPPoE, a VPN) the MTU is below 1500 and the ICMP “Fragmentation needed” messages are blocked too. Test it:

ping -M do -s 1472 -c 3 SERVER_IP    # 1472 + 28 bytes of headers = 1500
ping -M do -s 1400 -c 3 SERVER_IP

If 1472 fails and 1400 works, the path’s real MTU is somewhere in between. Fixes: lower the MTU of the interface or tunnel, enable net.ipv4.tcp_mtu_probing=1, or clamp the MSS on the intermediate server that forwards the traffic:

sudo iptables -t mangle -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu

Summary: a quick decision table

Symptom Run this first
Nothing answers ss -tulpn and systemctl status
Works from inside, not from outside Firewall: ufw status and iptables -L -n -v
Works for some people, not others dig against several resolvers, and mtr from the user’s side
Slow curl -w with per-phase timings
Connects, then hangs ping -M do for MTU

If all this shows the problem is the inherent slowness of long paths, try enabling BBR.

About the author

Arash Karimian

Network and infrastructure engineer with years of day-to-day work on Linux servers, firewalls and network tuning. Writes about networking, security and server troubleshooting.

All articles by Arash Karimian

Comments

No comments yet. For technical questions, include the details (OS version, the exact error and the command you ran) to get a precise answer.

Leave a comment