Interfaces, addresses, and neighbors: ip
| Command | What it does |
|---|---|
ip -br link |
list interfaces, state (UP/DOWN), and MAC |
ip -4 -br addr |
brief IPv4 addresses and masks for all interfaces |
ip -6 -br addr |
IPv6 addresses, including fe80:: (IPv6 in practice) |
ip -s link show eth0 |
packet, RX/TX error, and drop counters on a NIC |
ip neigh |
ARP and NDP table: neighbor IP, MAC, and state |
sudo ip neigh flush dev eth0 |
flush the ARP/NDP cache on an interface |
Routes: ip route
| Command | What it does |
|---|---|
ip -4 route |
IPv4 routing table and default gateway |
ip -6 route |
IPv6 routing table |
ip route get 203.0.113.10 |
interface, gateway, and source IP chosen for a target |
sudo ip route flush cache |
clear the route cache and stored Path MTU |
Sockets and ports: ss
| Command | What it does |
|---|---|
sudo ss -tulnp |
all listening TCP/UDP ports, bind addresses, and processes |
ss -s |
summary counts: estab, timewait, orphaned sockets |
ss -tan |
all TCP sockets with numeric ports and states |
sudo ss -tnp 'sport = :443 or dport = :443' |
active TCP connections on port 443 with PIDs |
sudo ss -tnp state close-wait |
stuck CLOSE-WAIT sockets and owning process |
ss -tno state time-wait |
TIME-WAIT sockets and remaining timer |
ss -tin '( dport = :443 )' |
internal TCP metrics: RTT, cwnd, mss, retransmits |
Reachability, path, ports, and MTU
| Command | What it does |
|---|---|
ping -c 4 203.0.113.10 |
4 ICMP Echo packets: check L3 reachability |
ping -M do -c 1 -W 1 -s 1472 203.0.113.10 |
test MTU 1500 without fragmentation (MTU blackhole) |
tracepath -n 203.0.113.10 |
hop path and Path MTU without sudo |
mtr -n -r -c 20 203.0.113.10 |
20 trace cycles: per-router loss and latency |
nc -zv -w 3 203.0.113.10 443 |
test one TCP port with a 3 s timeout |
nc -zvu -w 3 203.0.113.10 53 |
probe a UDP port (detects only explicit ICMP Port Unreachable) |
DNS: dig and resolvectl
| Command | What it does |
|---|---|
dig +short example.org A |
domain’s IPv4 address only |
dig +noall +answer +stats example.org AAAA |
IPv6 record, its TTL, and resolver query time |
dig @1.1.1.1 example.org MX |
query mail records straight from 1.1.1.1 |
dig -x 203.0.113.10 +short |
reverse PTR lookup (hostname from IP) |
dig +trace example.org |
full resolution chain from the root servers |
resolvectl status |
current DNS servers and domains in systemd-resolved |
sudo resolvectl flush-caches |
flush the local DNS cache |
HTTP and TLS: curl and openssl
| Command | What it does |
|---|---|
curl -svI https://example.org |
response headers, TLS steps, SNI, and chosen IP |
curl -4 ifconfig.me |
public IPv4 address the server presents to the internet |
curl --resolve example.org:443:203.0.113.10 -sI https://example.org |
hit a specific IP while keeping Host and SNI |
curl -sS -o /dev/null -w 'dns=%{time_namelookup} tcp=%{time_connect} tls=%{time_appconnect} ttfb=%{time_starttransfer} code=%{http_code}\n' https://example.org |
phase timings for DNS, TCP, TLS, and server response |
openssl s_client -connect example.org:443 -servername example.org </dev/null 2>/dev/null | openssl x509 -noout -subject -issuer -dates |
certificate subject, issuer, and validity window |
Containers, firewall, and packet capture
| Command | What it does |
|---|---|
sudo nsenter -t <PID> -n ss -tulnp |
listening sockets inside a container with no tools in the image |
sudo nsenter -t <PID> -n ip -br addr |
interfaces and IPs inside a container’s netns |
sudo nft list ruleset |
all nftables tables, chains, rules, and counters |
sudo conntrack -L -p tcp --dport 443 |
active connection and NAT entries in conntrack |
sudo tcpdump -nn -i any 'host 203.0.113.10 and tcp port 443' |
live traffic to a host without DNS or port-name lookups |
Replacements for deprecated net-tools commands
Ubuntu no longer installs net-tools by default; its jobs moved to iproute2 and bind9-dnsutils:
| Old command | Modern replacement |
|---|---|
ifconfig |
ip -br addr and ip -s link |
route -n |
ip -4 route |
arp -n |
ip neigh |
netstat -tulnp |
sudo ss -tulnp |
nslookup example.org |
dig +noall +answer example.org |