20 Key Linux Commands for Network Monitoring and Configuration

Linux network troubleshooting works best when commands answer a specific question in a defined sequence. An interface can have an address while the default route is wrong; a service can be listening while the firewall blocks it; a DNS lookup can succeed while an application still fails to connect. Treat command output as one piece of evidence rather than a verdict. Capture the interface, destination, protocol, time and source host before changing anything.

Older documentation often emphasizes ifconfig, netstat, route, iptables and iwconfig. These tools are useful when investigating legacy installations, but their presence and recommended use vary by distribution. Modern Linux deployments commonly use ip for interface and route state, ss for sockets, and distribution-managed nftables or firewalld for host firewall policy. The right command depends on the actual host and its network manager.

A repeatable diagnosis begins with observation, tests one hypothesis at a time and records any reversible modification. This is especially important over SSH: a remote interface or firewall change can disconnect the administrator before the configuration can be repaired. The commands below are examples for inspection, not live-tested results or instructions to reconfigure an unknown production system.

Start with interface state and the address actually in use

Run ip -br link to identify interface names and administrative state, then ip -br address to see the assigned IPv4 and IPv6 addresses. An interface being administratively up is not enough: carrier, VLAN tagging, wireless association, bond membership, virtual networking and upstream switch state can still prevent useful communication. On systems using NetworkManager, nmcli device status connects the kernel view with the manager’s own understanding of the device.

Use ip -s link show dev eth0 for packet and error counters, substituting the real interface name. Errors and drops are clues but need context: driver behavior, offloads, virtual interfaces and container namespaces can make totals difficult to interpret. Compare two observations over a known interval rather than concluding that a large lifetime counter proves a current fault. For Linux hosts with several namespaces, collect the evidence inside the namespace where the affected process actually runs.

ifconfig remains relevant when an older runbook requires it or the net-tools package is installed. Do not assume it is present or that its output matches the richer ip command on every system. The troubleshooting goal is to establish the actual address and link state, not to preserve the spelling of a legacy command.

Use route selection to separate local configuration from an upstream problem

Check ip route and ip -6 route, then query a specific destination with ip route get 198.51.100.10 or an appropriate approved address from the incident. Route selection can depend on the source address, policy rules, network namespace, VRF and routing table; simply seeing a default route does not prove the target will use it. ip rule show helps reveal policy routing when ordinary route-table inspection is insufficient.

If the destination is on-link, investigate neighbor discovery or ARP with ip neigh. A stale or incomplete entry can look like a routing failure even though the kernel selected the expected interface. In a cloud or container network, the next hop may be virtual, and a routing decision can be correct on the host while an overlay or security group rejects the traffic.

The older route and arp utilities may appear in historic scripts, but ip route and ip neigh provide a more consistent modern approach. Avoid adding or deleting routes solely to see whether a problem disappears. Record the existing selection, test an approved change through the active network manager, and preserve a remote recovery route.

Test reachability while respecting what probes cannot prove

ping tests whether ICMP echo requests elicit replies. A reply supports reachability for that protocol at that moment; a timeout does not prove the host is down because intermediate devices and hosts can block, rate-limit or deprioritize ICMP. Use numeric addresses when you want to remove DNS from the test. Repeat with a hostname only when it is helpful to include name resolution.

traceroute, tracepath or a distribution-supported equivalent can reveal responding hops and possible path changes. They do not provide a guaranteed map of physical routers, and asterisks often represent lack of reply rather than definite packet loss at a transit hop. The protocol and probes used influence which devices respond. A more focused treatment of Linux traceroute behavior helps separate route evidence from misleading hop assumptions.

If ICMP is unavailable, test the actual application path from an authorized source—for example a TCP connection to the intended service—and compare the result with server-side logging. An application error, a network timeout and a TLS failure are different incident classes. Do not classify all three as packet loss.

Separate DNS answers from application connectivity

getent ahosts example.com reflects name resolution available to many applications on a Linux host, whereas dig queries DNS and can be directed at a specific resolver. Results may differ because applications use local hosts files, cached answers, search domains or resolver libraries. Start by identifying which resolver path the affected process uses. A successful dig query alone does not prove that an application will resolve the same name.

Use dig example.com A and dig example.com AAAA to inspect address families; inspect resolver configuration with the system’s resolver-management tools. dig +trace investigates delegations starting from the root, not the ordinary cached recursive resolution path. The distinction between recursive and iterative DNS matters when a failure affects one resolver but not authoritative data.

A changed DNS answer can reflect caching and TTL behavior rather than a new global routing fault. Compare expected hostnames, target addresses and resolver responses with the application owner’s deployment record. Avoid flushing all caches or editing resolver files until the failure mechanism has been identified.

Inspect listening services and sockets before blaming the firewall

ss -lntup lists listening TCP/UDP sockets with numeric addresses and process information where permissions allow. A service bound to 127.0.0.1 will not automatically accept external connections. A socket may be in a network namespace, or a reverse proxy may be the actual public listener. Compare the expected protocol, destination address and port with the socket shown by the application process.

ss -tan exposes TCP connection states; ss -s summarizes socket counts. A large number of established connections is not inherently malicious, and a time-wait state is often normal. Match the output with process health, client errors and workload load before diagnosing exhaustion or an attack. The older netstat can still explain a historical incident record, but the ss utility is the more natural starting point on modern Linux hosts.

Remote scans have a separate purpose. Authorized nmap testing can check externally observable services, but a scanner result can reflect network filters, middleboxes and endpoint policy as well as the application itself. Restrict scans to systems you are permitted to test, and validate significant findings against on-host observations and service logs.

Read packet captures and firewall rules as evidence, not as instant fixes

tcpdump -ni eth0 host 198.51.100.10 can show whether matching packets appear on an interface, using a real approved interface and test address. Capture on the correct side of a tunnel, NAT boundary or virtual bridge; seeing traffic at one capture point does not prove it reaches its destination. Packet captures can expose authentication material or private data, so scope filters, retention and access controls to the investigation. When deeper protocol interpretation is needed, packet analysis with Wireshark helps explain sequences and retransmissions without relying on a single packet.

Firewall inspection depends on the installed stack. On contemporary Red Hat systems, firewall-cmd --state and firewall-cmd --list-all may be appropriate when firewalld manages policy; nft list ruleset inspects nftables rules. Avoid treating the old iptables command as the universal primary control: Red Hat has deprecated iptables-nft tooling on RHEL 9 and recommends nftables for new complex rule management. Distribution differences matter, and production hosts should not run competing firewall managers against one ruleset without a documented design.

When comparing counters and policy, distinguish an ingress block, missing egress route, asymmetric return path and an application-layer rejection. An apparently correct allow rule may apply to the wrong interface, family, zone or chain. Record the current configuration and permitted rollback before proposing any change. Never flush all firewall rules merely to test a hypothesis on a live remote system.

Measure congestion and wireless conditions with the right time horizon

iftop displays live interface traffic by communicating hosts and can help identify a busy flow, but it does not automatically account for every application-layer source of delay. vnstat tracks interface-traffic history on hosts where it is installed and configured; compare its sampling and interface selection with the operational question before treating a usage total as a billing or capacity measurement.

iperf3 can generate controlled TCP or UDP test traffic between systems for which you have explicit permission. Such tests consume bandwidth and may alter the conditions they measure. The result describes a particular path, server, protocol and time window—not the absolute speed of every application. Use an isolated maintenance window and a known test endpoint rather than generating aggressive traffic against an unrelated host.

For wireless networks, inspect current state using a supported network manager or iw where available. iwconfig belongs mainly to the legacy wireless-tools ecosystem. Verify association, signal, channel conditions, power saving and authentication before assuming that a slow Wi-Fi link is a DNS or firewall problem. Separate the radio layer from the upstream routed path by comparing local-gateway and remote-destination tests.

Close the diagnosis with a decision and reproducible proof

A useful incident note records the symptom, exact source and destination, device or namespace, commands run, observed outputs, the hypothesis tested and the reversible change made. It distinguishes a working DNS answer from a successful service connection and a successful service connection from application correctness. The purpose is to prove which dependency failed and which control restored it, not to collect the largest command list.

Older utilities should remain documented when they explain deployed scripts or legacy distributions, but current runbooks should favor the supported interface, routing, socket and firewall management tools for the environment. For administrators preparing for RHCSA EX200, the relevant transferable skill is to configure and verify networking and name resolution deliberately, then validate that the change survives the system’s intended management lifecycle.

A safe troubleshooting sequence is practical and repeatable: inspect link/address state, resolve the route and destination name, test the transport, inspect the listening service and policy, and use packet or throughput evidence only where the preceding steps leave uncertainty. That sequence is faster than changing firewall rules, DNS and routes simultaneously and then guessing which change mattered.

Leave a Reply

How It Works

img
Step 1. Choose Exam
on ExamLabs
Download IT Exams Questions & Answers
img
Step 2. Open Exam with
Avanset Exam Simulator
Press here to download VCE Exam Simulator that simulates real exam environment
img
Step 3. Study
& Pass
IT Exams Anywhere, Anytime!