Skip to content
Master Linux Network Troubleshooting: Essential Commands and How to Use Them
Operations 8 min read

Master Linux Network Troubleshooting: Essential Commands and How to Use Them

This guide explains how to use Linux networking commands—including ip, ifconfig, netstat, ping, traceroute, host, dig, systemd-resolve, and dhclient—to inspect interfaces, check connectivity, trace routes, query DNS, and manage DHCP leases for effective troubleshooting.

Liangxu Linux
Liangxu Linux
Liangxu Linux

Interface Information

Use the interface information command to view network interfaces of the logged‑in device.

IP Command

Display all IP addresses with ip a. Filter IPv4 or IPv6 with ip -4 a or ip -6 a. The older ifconfig command provides similar output and also shows basic transmit/receive statistics.

Network Status Commands

The netstat utility shows listening ports and associated services. Combine options such as -tul for TCP/UDP listening ports and -n to display numeric IPs. Add -p (with sudo) to see the owning process ID.

Network Reachability

Use these commands to verify connectivity and diagnose network paths.

Ping

Ping a host or IP address with ping 192.168.1.10. Limit the number of echo requests using -c, e.g., ping -c 3 192.168.1.10. Force IPv4 or IPv6 with -4 or -6. Combine options, for example ping -4 -c 3 192.168.1.10.

Traceroute

Trace the route to a remote host using traceroute 8.8.8.8 or traceroute google.com. IPv4 is default; use -4 or -6 to specify the address family.

Domain Name System

DNS utilities help resolve hostnames and inspect DNS records.

host

Query an IP address for a hostname with host google.com. Specify a DNS server, e.g., host google.com 1.1.1.1.

dig

Retrieve detailed DNS information using dig google.com. Query a specific server with dig @8.8.8.8 google.com. Use any to list all records or mx for mail exchange records. Perform reverse lookups with dig -x 8.8.8.8.

systemd-resolve

Check the current DNS configuration with systemd-resolve --status. Flush the resolver cache after changes using sudo systemd-resolve --flush-caches. This command is available on systems that use systemd.

DHCP

Manage DHCP leases directly from the command line.

dhclient

Release and renew a DHCP lease with sudo dhclient -r followed by sudo dhclient. This is useful after modifying router or switch DHCP settings.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

troubleshootingDNSIPDHCP
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.