Network connectivity issues can manifest as slow responses, packet loss, or complete connection failures. This guide covers the essential diagnostic tools.
Step 1 — Test Basic Connectivity
$ping -c 4 8.8.8.8PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=118 time=1.23 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=118 time=1.19 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=118 time=1.21 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=118 time=1.18 ms
--- 8.8.8.8 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 1.18/1.20/1.23/0.018 msIf ping fails, the issue is at the network level (firewall, routing, or the server's network interface).
Step 2 — Trace the Network Path
$traceroute 8.8.8.8traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets
1 gateway (10.0.0.1) 0.456 ms 0.423 ms 0.412 ms
2 203.0.113.1 (203.0.113.1) 1.234 ms 1.198 ms 1.187 ms
3 * * *
4 8.8.8.8 (8.8.8.8) 1.567 ms 1.543 ms 1.521 ms* * * at a hop means that router does not respond to ICMP — this is normal and not necessarily an error.
Step 3 — Check DNS Resolution
$dig google.com A +short142.250.x.xIf DNS fails:
$cat /etc/resolv.confnameserver 8.8.8.8
nameserver 8.8.4.4If /etc/resolv.conf is empty or missing, add DNS servers:
$echo "nameserver 8.8.8.8" > /etc/resolv.conf$echo "nameserver 1.1.1.1" >> /etc/resolv.confStep 4 — Check Listening Ports
$ss -tulnpNetid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
tcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:* sshd
tcp LISTEN 0 511 0.0.0.0:80 0.0.0.0:* nginx
tcp LISTEN 0 511 0.0.0.0:443 0.0.0.0:* nginx
tcp LISTEN 0 70 127.0.0.1:3306 0.0.0.0:* mysqldStep 5 — Check Active Connections
$ss -tnp | grep ESTABLISHEDStep 6 — Test a Specific Port
$nc -zv YOUR_SERVER_IP 443Connection to 45.77.x.x 443 port [tcp/https] succeeded!Step 7 — Check Bandwidth Usage
$apt install -y nethogs$nethogs eth0nethogs shows per-process bandwidth usage in real time, helping identify processes consuming excessive bandwidth.
[!NOTE] If you suspect a DDoS attack, check your LightYear control panel for traffic graphs and consider enabling DDoS protection or using a CDN to absorb traffic.
