Network Troubleshooting: Diagnose and Fix Connection Issues

Β· 6 min read

A Systematic Approach

When network connectivity fails, the worst thing you can do is start randomly changing settings. Effective troubleshooting follows a systematic, bottom-up approach based on the OSI model. Start with the physical layer and work your way up through network, transport, and application layers.

The key question at each layer is: "Does this layer work?" If yes, move up. If no, you've found your problem area. This methodical approach saves hours of guesswork and gets you to the root cause faster.

Here's the fundamental troubleshooting sequence:

  1. Physical connectivity β€” Are cables connected? Is Wi-Fi associated? Are link lights on?
  2. Local network β€” Do you have an IP address? Can you reach your gateway?
  3. Internet connectivity β€” Can you reach external IP addresses?
  4. DNS resolution β€” Can you resolve domain names?
  5. Application layer β€” Is the specific service or port accessible?

πŸ› οΈ Try it yourself

Ping Tool β†’ Traceroute Tool β†’

Ping: Testing Connectivity

Ping is the most fundamental network diagnostic tool. It sends ICMP Echo Request packets to a target and measures the response time, telling you whether a host is reachable and how fast the connection is.

# Basic ping test
ping google.com

# Ping with specific count (useful for scripts)
ping -c 4 google.com

# Ping with timestamp
ping -D google.com

# Ping with specific packet size (test MTU issues)
ping -s 1472 -M do google.com

# Flood ping for stress testing (requires root)
sudo ping -f -c 1000 192.168.1.1

Reading Ping Results

Understanding ping output is crucial for diagnosis:

Use our online Ping tool to test connectivity from our servers when you want to check if the problem is on your end or the destination's end.

Traceroute: Mapping the Path

While ping tells you if a destination is reachable, traceroute shows you the exact path packets take to get there, revealing every router (hop) along the way. This is invaluable for identifying where in the network a problem occurs.

# Standard traceroute (Linux/Mac)
traceroute example.com

# Windows equivalent
tracert example.com

# Use TCP instead of ICMP (bypasses some firewalls)
sudo traceroute -T -p 443 example.com

# Use specific number of queries per hop
traceroute -q 1 example.com

# MTR: combines ping and traceroute (real-time view)
mtr example.com

# MTR with report mode (10 cycles)
mtr -r -c 10 example.com

Interpreting Traceroute Output

Each line in traceroute output represents a hop (router) along the path. Here's what to look for:

Use our online Traceroute tool to trace routes from our infrastructure, helping you determine whether latency issues are in your local network or further upstream.

DNS Troubleshooting

DNS issues are among the most common causes of "internet is down" complaints. Often, the network itself works fine, but name resolution fails, making it seem like nothing is accessible.

# Quick DNS test: can you reach an IP directly?
ping 8.8.8.8          # If this works but ping google.com doesn't = DNS issue

# Check DNS resolution
nslookup example.com
dig example.com

# Test with alternative DNS server
nslookup example.com 1.1.1.1
dig @8.8.8.8 example.com

# Check your configured DNS servers
cat /etc/resolv.conf              # Linux/Mac
ipconfig /all                      # Windows

# Flush DNS cache
sudo dscacheutil -flushcache       # macOS
sudo systemd-resolve --flush-caches # Linux (systemd)
ipconfig /flushdns                  # Windows

Common DNS Fixes

Common Network Problems

Slow Internet Speeds

Slow speeds can result from many factors. Here's a diagnostic checklist:

# Test actual throughput
speedtest-cli
curl -o /dev/null -w "Speed: %{speed_download}\n" https://speed.cloudflare.com/__down?bytes=100000000

# Check for bandwidth-hogging processes
nethogs          # Linux: shows bandwidth per process
nettop           # macOS: network activity monitor

# Check network interface errors
ifconfig eth0    # Look for errors, dropped packets
ip -s link show  # Detailed interface statistics

# Check for duplex mismatch
ethtool eth0     # Verify speed and duplex settings

Intermittent Connectivity

Connections that drop randomly are often the hardest to diagnose. Common causes include:

Can't Access Specific Websites

When only certain sites are unreachable:

# Is the site actually down?
curl -I https://example.com

# Check from different DNS
dig @1.1.1.1 example.com
dig @8.8.8.8 example.com

# Check if your IP is blocked
curl -x "" https://example.com  # Direct connection
curl https://example.com         # Through proxy (if configured)

# Test specific port
nc -zv example.com 443
telnet example.com 80

Advanced Diagnostics

Packet Capture with tcpdump

When basic tools aren't enough, packet capture lets you see exactly what's happening on the wire:

# Capture all traffic on an interface
sudo tcpdump -i eth0

# Capture only traffic to/from a specific host
sudo tcpdump -i eth0 host 192.168.1.100

# Capture specific port traffic
sudo tcpdump -i eth0 port 443

# Save capture for analysis in Wireshark
sudo tcpdump -i eth0 -w capture.pcap

# Show HTTP requests
sudo tcpdump -i eth0 -A -s 0 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'

Network Socket Analysis

# List all listening ports
ss -tulnp              # Linux
netstat -tulnp         # Linux (legacy)
lsof -i -P -n         # macOS

# Check established connections
ss -tnp state established

# Find which process is using a port
lsof -i :8080
fuser 8080/tcp

Building a Troubleshooting Toolkit

Every network administrator should have these tools ready:

Automation Script

Here's a quick diagnostic script that runs through the fundamental checks:

#!/bin/bash
echo "=== Network Diagnostic Report ==="
echo "Date: $(date)"
echo ""
echo "--- Interface Info ---"
ip addr show | grep "inet "
echo ""
echo "--- Default Gateway ---"
ip route | grep default
echo ""
echo "--- Gateway Ping ---"
GW=$(ip route | grep default | awk '{print $3}')
ping -c 3 $GW
echo ""
echo "--- External Ping ---"
ping -c 3 8.8.8.8
echo ""
echo "--- DNS Resolution ---"
dig +short google.com
echo ""
echo "--- Traceroute ---"
traceroute -m 15 -q 1 8.8.8.8
echo ""
echo "=== Report Complete ==="

Key Takeaways

Related Tools

Ping Tool Traceroute