Linux networking cheatsheet

Linux networking: Testing connectivity

6 common Linux networking tasks.

Check that a host answers

Send four echo requests and report replies.

ping -c 4 example.com

Trace the path to a host

Show each hop on the way to a destination.

traceroute example.com

Trace with live statistics

Combine ping and traceroute into a continuously updated report.

mtr --report --report-cycles 10 example.com

Test whether a port is open

Try to connect to a TCP port. -z checks without sending data.

nc -zv example.com 443

Time each phase of a request

Show how long DNS, connecting, TLS and the first byte took.

curl -s -o /dev/null -w "dns %{time_namelookup}s connect %{time_connect}s tls %{time_appconnect}s ttfb %{time_starttransfer}s total %{time_total}s\n" https://example.com

Find the path MTU

Send a packet that must not be fragmented. 1472 bytes plus headers makes 1500. Reduce the size until it succeeds.

ping -c 3 -M do -s 1472 example.com

Was this page helpful?