Some commands (for example
ss -p or certain ip operations) require root privileges to show process or full interface details. Prefix them with sudo or run as root when necessary.Quick command reference
1) Show interfaces and their status
List interfaces and their administrative/link state:inet or inet6, it cannot exchange IP traffic:
UP but still lack an IP address (no inet/inet6). That interface will not participate in IP networking until an address is assigned.
2) Check the routing table
Display the kernel routing table to find the default gateway and any specific routes:- Look for a line beginning with
default via— that is the system’s default route for outbound traffic. - If the default route is missing, the system likely cannot reach external networks beyond its local subnets.
3) Test connectivity with ping
Useping to test reachability at different layers:
- Ping the local gateway (e.g.,
10.0.2.1) — verifies local network and L2/L3 connectivity. - Ping an external IP (e.g.,
8.8.8.8) — verifies upstream routing and Internet access. - Ping a hostname (e.g.,
google.com) — verifies DNS resolution and downstream reachability.
- If you can ping an IP (e.g.,
8.8.8.8) but not a hostname, DNS is likely the issue. - If you can ping the gateway but not an external IP, check the default route or upstream connectivity.
- Some networks block or rate-limit ICMP. A lack of responses is not definitive proof of total unreachability.
4) Trace the path to a destination
Usetracepath to reveal each hop packets take and identify where packets are delayed or dropped:
tracepath output:
- Each line represents a hop (router) along the path.
- Increasing latencies are expected; repeated
*or timeouts show where responses are blocked or lost. - Use this to narrow the location of failures (local router, ISP, or remote network).
5) Show open ports and listening services
To see which sockets are listening and which processes own them, usess:
-t: TCP sockets-u: UDP sockets-l: only listening sockets-n: numeric addresses and ports (no name resolution)-p: show process using the socket (requires root)
ss -p requires root privileges to display processes. Run as sudo ss -tulnp to see process names/PIDs owning the sockets. Misinterpreting listening addresses can cause services to be bound only to localhost (127.0.0.1) and appear unreachable remotely.6) Show interfaces in a brief, summarized form
For a compact view (one line per interface) with primary addresses:Conclusion and practical workflow A reliable sequence for troubleshooting network issues is:
- Inspect link state and interfaces (
ip link,ip addr, orip -brief address) - Verify routing (
ip route) - Test layer-3 reachability (
pingto gateway, external IP, and hostname) - Trace the path to the destination (
tracepath) - Inspect listening sockets and services (
ss -tulnp)