Skip to content

Network Tools

Network troubleshooting is a systematic process of isolating and identifying the root cause of Connectivity, performance, or security issues. This section covers the primary tools used for Network diagnostics on Linux systems and provides a methodology for approaching network problems.

The key principle is start simple and work from layer 1 upward. Do not jump to Wireshark before Verifying that the cable is plugged in and the interface is up.

When faced with a network problem, work through the layers systematically:

graph TD
    L1["Layer 1: Physical<br/>Is the link up? Cable connected?"] --> L2["Layer 2: Data Link<br/>ARP resolving? MAC correct?"]
    L2 --> L3["Layer 3: Network<br/>IP reachable? Routes correct?"]
    L3 --> L4["Layer 4: Transport<br/>Port open? Firewall blocking?"]
    L4 --> L5["Layer 7: Application<br/>Protocol correct? Data valid?"]

    style L1 fill:#4a6fa5,color:#fff
    style L2 fill:#6aa0ca,color:#fff
    style L3 fill:#8ab0d5,color:#fff
    style L4 fill:#a0c0e0,color:#fff
    style L5 fill:#b0d0f0,color:#fff

Layer 1 — Physical:

Terminal window
# Check interface status
ip link show
ethtool eth0
# Check link speed and duplex
ethtool eth0 | grep -E "Speed|Duplex|Link detected"
# Check cable (physical inspection, link lights)
# Replace cable, try different port on switch

Layer 2 — Data Link:

Terminal window
# Check ARP table
ip neigh show
arp -a
# Ping the local gateway
ping -c 3 192.168.1.1
# Check for ARP issues (incomplete entries)
ip neigh show | grep -c incomplete

Layer 3 — Network:

Terminal window
# Check IP configuration
ip addr show
ip route show
# Ping remote host
ping -c 3 8.8.8.8
# Trace route
traceroute 8.8.8.8
# Check DNS resolution
dig example.com
nslookup example.com

Layer 4 — Transport:

Terminal window
# Check if port is open
ss -tlnp | grep :443
nc -zv 192.168.1.100 443
# Check firewall rules
iptables -L -n -v
nft list ruleset

Layer 7 — Application:

Terminal window
# Test HTTP
curl -v https://example.com
# Test specific API endpoint
curl -v -H "Accept: application/json" https://api.example.com/health
# Check application logs
journalctl -u nginx --since "5 minutes ago"

ping sends ICMP Echo Request messages and waits for ICMP Echo Reply messages. It tests basic Reachability and measures round-trip time.

Terminal window
# Standard ping
ping -c 4 example.com
# Ping with specific count and interval
ping -c 10 -i 0.5 8.8.8.8
# Ping with timestamp
ping -c 4 -D example.com
# Flood ping (requires root, sends as fast as possible)
ping -f -c 100 192.168.1.1
# Ping with packet size
ping -c 4 -s 1400 example.com

The TTL field in the IP header is decremented by each router. When TTL reaches 0, the router sends An ICMP Time Exceeded message back to the source. The initial TTL reveals the operating system:

Initial TTLOS
64Linux, macOS, Android, iOS
128Windows
255Cisco IOS, network equipment
254Some Solaris versions
Terminal window
# See TTL in ping output
ping -c 1 8.8.8.8
# Output: ttl=117 (128 - 11 hops = 117, so initial TTL was 128 -> Windows or similar)
# Send with specific TTL
ping -c 1 -t 1 8.8.8.8 # Will fail with "Time to live exceeded"
  1. Request timeout: The host is down, a firewall is blocking ICMP, or the route is broken.
  2. Destination Host Unreachable: The local router cannot reach the destination network.
  3. Permission Denied: Requires root for raw ICMP sockets, or the binary is not installed.