Linux Networking Tools

ip, ss, curl, dig, tcpdump, nmap, traceroute, and nc — the production debugging toolkit.

Overview

Linux network diagnosis follows the layers of the OSI model. You start at the physical and IP layer, prove that it works, and only then move up toward the application layer. A fault low in the stack breaks everything above it, so working upward keeps you from chasing an application error that is really a missing route.

Tools by layer

Each layer has a small set of tools, and the layer you are testing tells you which one to reach for.

  • Layer 3 (IP): ip addr shows interface addresses and ip route shows the routing table. ping tests ICMP reachability, and traceroute or tracepath discovers the path packets take.
  • Layer 4 (TCP/UDP): ss reports socket statistics and is the modern replacement for netstat. nc or ncat opens raw TCP and UDP connections, and tcpdump captures packets.
  • Layer 7 (application): curl speaks HTTP and HTTPS, dig or nslookup queries DNS, and openssl s_client inspects the TLS handshake.

Key concepts

  • ss -tulpn
  • ip route
  • tcpdump
  • dig +trace
  • curl -v

Interview questions

  • A service cannot connect to a remote endpoint. Walk through your network diagnosis steps.
  • How do you capture and analyse packets for an HTTPS connection?

Sign up free to read the full topic

More Linux topics

Start free on Cariara · Coding problems · System design studio