USD ($)
$
United States Dollar
Euro Member Countries
India Rupee
د.إ
United Arab Emirates dirham
ر.س
Saudi Arabia Riyal

Network Troubleshooting

Lesson 18/40 | Study Time: 20 Min

Network troubleshooting is a vital skill for maintaining and diagnosing Linux system connectivity and performance issues. Administrators use an array of command-line tools to test reachability, analyze network paths, inspect active connections, capture packets, resolve DNS issues, and assess open ports and services. 

Connectivity Testing

To diagnose network problems effectively, it is important to understand connectivity testing tools. The list below introduces commands that test reachability and path tracing.


1. ping: Sends ICMP echo requests to a target to test connectivity and measure response time.


Example:

bash
ping -c 4 google.com

The -c option specifies the number of packets.


2. traceroute: Maps the route packets take to a destination, revealing intermediate hops and delays.


Example:

bash
traceroute google.com

Network Diagnostics

To troubleshoot networking issues effectively, it is important to understand network diagnostic tools in Linux. The list below introduces commands that inspect sockets and connections.


1. netstat: Legacy tool showing active network connections, listening ports, routing tables, and interface stats.


Common options:

netstat -tuln: List listening TCP/UDP ports numerically.

netstat -rn: Display routing table.


2. ss: Modern netstat replacement offering faster and more detailed socket information.

Example:

bash
ss -tuln


3. lsof: Lists open files, including network sockets, helping identify processes using specific ports.

Example:

bash
sudo lsof -i :80

Packet Analysis

Packet analysis allows administrators to inspect network traffic at a granular level. The points below describe tools used to capture and filter packets.


1. tcpdump: Packet analyzer capturing live traffic on interfaces, invaluable for deep troubleshooting.


Basic usage:

bash
sudo tcpdump -i eth0


2. Filters can specify protocols, ports, or hosts for precise captures.

DNS Troubleshooting Tools

Linux provides several utilities to verify DNS resolution and inspect DNS responses. The list below highlights tools used for quick and detailed DNS checks.


1. dig: Queries DNS servers directly to retrieve DNS records, useful for debugging DNS issues.


Example:

bash
dig example.com


2. nslookup: Alternate DNS query tool for interactive or non-interactive DNS lookups.


Example:

bash
nslookup example.com


3. host: Simple tool to perform DNS lookups and format output succinctly.


Example:

bash
host example.com

Port Scanning

Port scanning helps determine which services are running and accessible on a network host. 

nmap: Network exploration tool to scan hosts, discover open ports, and identify services and versions.

Example:

bash
nmap -sV 192.168.1.1