Operations 6 min read

Master Linux Network Troubleshooting: Essential Commands and Step‑by‑Step Guide

Learn how to configure and diagnose Linux network issues using essential commands such as ifconfig, ping, traceroute, netstat, ss, dig, nslookup, route, ethtool, and arp, with practical examples and a systematic troubleshooting workflow to quickly identify and resolve connectivity problems.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Master Linux Network Troubleshooting: Essential Commands and Step‑by‑Step Guide

ifconfig – Network Interface Configuration and Inspection

The ifconfig command displays interface status, configures IP addresses and netmask, and enables or disables interfaces.

Show all interfaces: ifconfig -a Assign an IP address and netmask to an interface (e.g., eth0):

ifconfig eth0 192.168.1.110 netmask 255.255.255.0

Enable or disable a specific interface:

ifup eth0   # enable
ifdown eth0 # disable

Changes made with ifconfig are not persistent across reboots; edit the appropriate network configuration files for permanent settings.

ping – Test Network Connectivity

ping

sends ICMP echo requests to verify that a host is reachable and measures round‑trip latency.

Ping the local loopback address: ping 127.0.0.1 Ping a remote host with a limited packet count (e.g., 5 packets):

ping -c 5 www.example.com

traceroute – Trace Packet Path

traceroute

shows each hop a packet takes to reach its destination, which helps locate routing problems.

traceroute 8.8.8.8
traceroute output
traceroute output

netstat and ss – View Network Connections

Both commands list active sockets and listening ports. ss is generally faster.

Show all listening TCP and UDP ports:

netstat -tuln
ss -tuln

Display the routing table:

netstat -r

dig and nslookup – DNS Queries

Use dig or nslookup to inspect DNS records.

dig www.google.com
nslookup google.com
dig/nslookup output
dig/nslookup output

route – Manipulate Routing Table

The route command displays or modifies the system’s routing information.

Show current routes: route Add a default gateway (replace with your gateway address):

route add default gw 192.168.1.1
route output
route output

ethtool – Ethernet Interface Settings

ethtool

queries or changes Ethernet driver parameters, useful for hardware‑level diagnostics.

ethtool eth0

arp – Manage ARP Cache

arp

displays or modifies the ARP table, helping resolve MAC address conflicts.

arp -e

Practical Troubleshooting Workflow

When a website is unreachable, follow these steps to isolate the problem:

Check interface status: ifconfig Verify local loopback connectivity: ping 127.0.0.1 Test reachability of the default gateway (replace with your gateway address): ping <code>gateway_IP</code> Query DNS records for the target host:

dig www.example.com
nslookup www.example.com

Inspect the routing table to ensure a valid route exists: netstat -r Combining these commands enables rapid identification of connectivity, DNS, or routing issues, allowing efficient resolution.

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.

networkpingLinuxtroubleshootingcommandsifconfig
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

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.