Operations 8 min read

Essential Linux Network Commands for Troubleshooting and Management

This guide explains key Linux networking commands—including ip, ifconfig, netstat, ping, traceroute, DNS utilities, and DHCP tools—showing how to view interfaces, check connectivity, trace routes, query DNS records, and manage DHCP leases for effective network troubleshooting.

Open Source Linux
Open Source Linux
Open Source Linux
Essential Linux Network Commands for Troubleshooting and Management

Interface Information

Use the interface information command when you need details about the network interfaces of the device you are logged into.

IP Command

Display all IP addresses: ip a Filter for IPv4 or IPv6 with the -4 or -6 options:

ip -4 a
ip -6 a

Another way to view network information is with ifconfig, which presents the data in a more readable format and includes basic transmission/reception statistics.

ifconfig

Network Status Command

The netstat command helps discover which ports services are listening on. Use -t for TCP, -u for UDP, -l to show listening ports, and -n to display numeric IP addresses. netstat -tul To see the process ID of the service listening on a port, add -p (requires sudo).

sudo netstat -tulp

Network Availability

Network availability commands quickly check whether a host is reachable or powered on.

Ping Command

The most famous network command, ping, verifies connectivity without routing through a router, making it reliable within the same network.

ping 192.168.1.10
ping thehostname

Ping runs continuously until stopped; use -c to specify the number of packets. ping -c 3 192.168.1.10 Specify IPv4 or IPv6 with -4 or -6, and combine options as needed.

ping -4 -c 3 192.168.1.10

Traceroute Command

traceroute

shows the path packets take to reach an external network, useful for diagnosing routing issues.

traceroute 8.8.8.8
traceroute google.com

By default it uses IPv4; you can force IPv4 or IPv6 with -4 or -6.

traceroute -4 google.com
traceroute -6 google.com

Domain Name System

DNS commands are valuable for verifying hostname-to-IP mappings and inspecting DNS records.

Host Command

Lookup the IP address for a domain name: host google.com Specify a DNS server for the query:

host google.com 1.1.1.1

Dig Command

For detailed DNS information, use dig. Basic usage mirrors host: dig google.com Specify a DNS server with @: dig @8.8.8.8 google.com Retrieve all DNS records with the any option, or query specific types such as MX:

dig google.com any
dig google.com mx

Perform a reverse DNS lookup with -x:

dig -x 8.8.8.8

Systemd-Resolve Command

Check the current DNS server configuration: systemd-resolve --status Flush the DNS resolver cache after changing settings:

sudo systemd-resolve --flush-caches

DHCP

DHCP commands are useful for manually releasing and renewing leases after network changes.

Dhclient Command

Release and renew the DHCP lease on a device (requires sudo):

sudo dhclient -r
sudo dhclient
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.

networktroubleshootingDHCP
Open Source Linux
Written by

Open Source Linux

Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.

0 followers
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.