Skip to content

Networking — cheat sheet

A one-page lookup for the commands used across this course. Grouped by task; the course pages cover the why behind each one — this page is just the what.

Addressing

Task Command
Show this host's assigned addresses ip addr
Show a single interface ip addr show <iface>

Routing

Task Command
Show the routing table ip route
Show which route/gateway a destination would use ip route get <address>
Trace the hop-by-hop path to a destination traceroute <host> (or tracepath <host> / mtr <host> if traceroute isn't installed)

DNS

Task Command
Resolve a name (shows which record type answered) dig <domain>
Query a specific record type dig <domain> <type> (e.g. dig example.com MX)
Simple lookup, alternative to dig nslookup <domain>

Reachability & ports

Task Command
Test network-layer (ICMP) reachability only ping <host>
Test whether a specific TCP port is actually open nc -zv <host> <port>
See what's listening locally ss -tlnp

HTTP(S) & TLS

Task Command
Full request trace — TCP connect, TLS negotiation, request/response headers curl -v <url>
Same, discarding the response body (headers/timing only) curl -vo /dev/null <url>

SSH

Task Command
Open an interactive remote-shell session ssh <user>@<host>
Run a single remote command without a full session ssh <user>@<host> <command>

How this connects

The routing & gateways page covers reading the table above, the DNS page covers the resolution chain each record type answers, and the HTTP/TCP/SSH page covers mapping curl -v's own output to the TCP → TLS → HTTP boundary.