Operations 15 min read

Master Network Connectivity Checks: Essential Linux Tools & Commands

Learn how to verify physical link status, test network reachability, trace routes, and diagnose TCP/UDP ports using Linux utilities such as ethtool, ping, tracepath, wget, curl, netcat, telnet, nmap, netstat, and ss, with practical command examples and interpretation tips.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Master Network Connectivity Checks: Essential Linux Tools & Commands

Physical Connection Check

ethtool

Network interface physical connection can be checked with ethtool.

ethtool device_name

Check the "Link detected" field; "Link detected: yes" indicates a normal physical link.

Network Connectivity Check

ping

Use ping to test connectivity between the current host and another host.

icmp_seq – sequence number of the sent packet.

ttl – Time To Live; decremented by each router, packet discarded at 0.

time – round‑trip time; <100 ms is acceptable, <50 ms is excellent.

rtt – round‑trip time.

min – minimum RTT.

avg – average RTT.

max – maximum RTT.

mdev – standard deviation of RTT, reflecting stability.

Note:

On Linux, use the -I option to specify the outgoing interface.

On Windows, use the -S option to specify the source address, indirectly selecting the interface.

tracepath

tracepath works like traceroute, showing each hop a packet traverses from source to destination.

It helps locate the hop where a host or service becomes unreachable.

Example: view the path to 192.168.1.241

tracepath -n 192.168.1.241

Note:

"[LOCALHOST] pmtu 1500" indicates the first detection point (local machine).

Multiple packets are sent for accuracy; you may see two packets to 192.168.12.1.

"no reply" means no response at that hop, often due to security settings on the device.

HTTP/HTTPS Connectivity Check

wget

Use wget with --spider to test a URL without downloading content; -S shows response headers.

wget and curl

Both tools are used to verify HTTP/HTTPS connectivity.

curl

Use curl -I to request only the HTTP headers. Adding -f suppresses the body and returns a concise error message on failure.

TCP/UDP Connectivity Check

Check TCP/UDP ports using nc, telnet, or nmap.

nc (Netcat)

nc

checks TCP or UDP connectivity.

TCP check: use -z for scan mode (no data sent) and -v for verbose output.

nc -zv remote_host port

UDP check: add -u to use UDP. Because UDP is connectionless, lack of a response indicates failure.

echo test | nc -uv remote_host port

Note:

No response means UDP is not reachable.

UDP has no built‑in session termination; you must interrupt nc manually (Ctrl+C).

telnet

Telnet can quickly test whether a TCP port is open.

telnet remote_host port

nmap

nmap provides powerful port scanning, OS detection, and more; it may need manual installation.

Example scanning the 1000 most common TCP ports on 192.168.0.104:

nmap 192.168.0.104

Status meanings:

open – a service is listening on the port.

Closed – no service is listening.

Filtered – the scanner cannot determine the state because packets are blocked.

To scan specific ports, use -p (lowercase).

nmap -p port1,port2,... remote_host

Some ports may be filtered by firewall rules; use -sA for an ACK scan to detect firewalls.

Example ACK scan on 192.168.0.104:

Note:

"nfiltered" means the scanner received an RST packet, indicating the port is either open or closed, not filtered.

"filtered" means no response was received, typically due to a firewall.

Local Network Connection Check

netstat and ss

Both commands display local network connections and listening sockets.

Examples:

netstat -a
netstat -tn
netstat -un
netstat -ln
# -tul shows all TCP and UDP connections
netstat -tulnp

ss uses the same options.

Parameter explanation:

State – current connection state.

Recv‑Q – bytes waiting to be read.

Send‑Q – bytes waiting to be sent.

Local Address:Port – local endpoint.

Peer Address:Port – remote endpoint.

Process – owning process information.

Difference between netstat -an and netstat -tuln : -a shows all active connections (TCP and UDP) and listening sockets. -tuln shows only listening TCP/UDP sockets.

TCP Connection States

LISTEN – service waiting for connections.

ESTABLISHED – connection successfully established.

SYN_SENT, SYN_RECV – intermediate handshake states.

FIN_WAIT_1, FIN_WAIT_2, TIME_WAIT, CLOSE_WAIT, LAST_ACK, CLOSED – termination states.

Three‑Way Handshake Process

SYN and ACK flags in the TCP header coordinate the handshake.

Client sends SYN with its initial sequence number.

Server replies with SYN+ACK, acknowledging the client and providing its own sequence number.

Client sends ACK, confirming the server’s sequence number; the connection is now ESTABLISHED.

State Changes

Client:

Starts in CLOSED; after sending SYN becomes SYN_SENT.

After receiving SYN+ACK and sending ACK becomes ESTABLISHED.

Server:

Starts in LISTEN; upon receiving SYN replies with SYN+ACK and moves to SYN_RECV.

After receiving the final ACK moves to ESTABLISHED.

Why Three‑Way Handshake?

It guarantees both sides are ready for data transfer and prevents stale connection requests from causing errors, ensuring reliable communication.

DNS Availability Check

Tools such as dig, host, and nslookup verify DNS functionality.

Example: resolve www.baidu.com locally. dig www.baidu.com Specify a DNS server with @:

dig www.baidu.com @180.76.76.76
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.

network troubleshootingpinglinux-commandsnetstatethtoolnmapconnectivity testing
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

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.