Linux Networking Commands: Diagnose the Layer Before Editing Configuration
Use networking commands to answer one layer-specific question at a time: interface, address, route, socket, DNS or connection manager.
Short answer
A small networking command set can usually tell you whether the problem is the interface, address, route, socket, DNS resolver or NetworkManager connection. Start with inspection commands and only change configuration after you know which layer is wrong.
Core networking questions and commands
| Question | Command or tool | What to inspect |
|---|---|---|
| What interfaces and addresses exist? | ip addr | Interface state and assigned IPv4/IPv6 addresses. |
| Where will traffic be routed? | ip route | Default route and destination-specific routes. |
| What is listening locally? | ss -lntup | Listening TCP/UDP sockets and process context where permissions allow. |
| Can I reach a known IP? | ping ADDRESS where ICMP is permitted | Basic path/reachability signal, not proof that an application works. |
| What does NetworkManager think? | nmcli device status | Managed device and connection state on NetworkManager systems. |
| What resolver state exists? | Use the resolver tool for the system, such as resolvectl when systemd-resolved is active. | DNS servers, domains and resolver status. |
Do not diagnose from ping alone
Some networks or hosts block ICMP while web traffic works normally. Conversely, a successful ping to an IP address does not prove DNS, TLS, a proxy or the target application is working. Match the test to the failed layer.
ip replaces many old net-tools workflows
Older tutorials often use ifconfig, route and netstat. Current Linux systems commonly use iproute2 tools such as ip and ss. If an old command is missing, do not install legacy tools automatically; use the distribution’s current networking documentation.
Save the output before changing the network
Remote administration can disconnect you from the machine. When working over SSH, record the existing addresses, routes and connection profile before applying a network change, and have an out-of-band or local recovery path for important systems.
Useful gear for this task
Official references
For current behavior and version-specific details, use the relevant upstream documentation alongside this guide.
Frequently asked questions
Which Linux networking commands should I learn first?
Start with ip for interfaces and routes, ss for sockets, ping where appropriate, resolvectl or the distribution’s resolver tooling for DNS context, and NetworkManager tools such as nmcli when NetworkManager manages the connection.
Why is ifconfig missing?
ifconfig belongs to the older net-tools suite and is not installed by default on many current distributions. Modern Linux networking documentation commonly uses the ip command from iproute2 instead.