| |

LFCA 121 ๐Ÿง Real-World Scenario โ€” Basic Network Diagnostics

A network problem is a mystery with layers. The user reports that “the internet is down.” The application logs show connection timeouts. The monitoring system fires an alert about packet loss. Each of these symptoms is real, but none of them tells you where the problem actually lives. Is it the cable? The interface? The route? DNS? The firewall? The remote service? Without a systematic approach, you end up restarting things at random, hoping the symptom disappears.

This chapter walks through basic network diagnostics as a structured investigation. You will learn the layered model that guides the diagnostic sequence, the specific commands that test each layer, and how to interpret their output to narrow the problem to a specific point in the path between your machine and the service it is trying to reach. The scenario is a typical production incident: a server that cannot reach an external API, with the cause unknown.

By the end, you will have a repeatable diagnostic procedure that starts at the physical layer and moves upward, testing one assumption at a time until the failure point is isolated.

Key point: Network diagnostics works from the bottom up. Confirm the link is up, then the IP is configured, then the gateway is reachable, then DNS resolves, then the route exists, then the port is open, and finally the application responds. Skipping layers wastes time on the wrong hypothesis.


Why basic network diagnostics matters

The layered model. Network communication is built in layers. The physical layer carries electrical signals. The data link layer frames those signals into packets. The network layer addresses and routes those packets. The transport layer establishes connections between ports. The application layer sends actual data. A failure at any layer produces symptoms that look similar from the user’s perspectiveโ€”the connection does not workโ€”but requires different diagnostic tools . The layered model tells you where to look first: always at the bottom, because a problem at a lower layer makes all higher layers fail regardless of their own health.

The blame problem. When an application cannot reach a service, the instinct is to blame the application. When a website is slow, the instinct is to blame the website. Both instincts are often wrong. The cause may be a saturated interface, a misconfigured route, a DNS server that has stopped responding, or a firewall rule that silently drops packets. Without diagnostics, you cannot distinguish between these causes. You cannot fix what you have not identified.

The escalation problem. When a network problem is escalated to a network team or a cloud provider, the first question is always the same: “What have you already tried?” A structured investigationโ€”even one that has not yet found the answerโ€”demonstrates that you have ruled out the obvious causes. It provides the negative results that narrow the search space for the next person. An escalation that says “the network is down” is useless. An escalation that says “the interface is up, the gateway responds, DNS resolves, but TCP connections to port 443 time out” is actionable.

The intermittent problem. Some network problems are not constant. A link that drops under load. A DNS server that responds slowly. A route that fails over incorrectly. These are the hardest to diagnose because the symptom is absent when you look for it. The diagnostic approach for intermittent problems is different: you set up continuous monitoring that logs state at the moment of failure, then analyze the logs after the fact.


a. Layer one and two: link and interface

The first question is whether the network interface is up and has an IP address. This is the physical and data link layer. If the interface is down, nothing above it can work.

ip link show

The ip link show command lists all network interfaces and their states. The output shows UP or DOWN for each interface, along with the MAC address and other link-layer details. An interface that is DOWN will not carry traffic regardless of its configuration .

ip addr show

The ip addr show command adds IP address information to the interface state. An interface can be UP but have no IP address, which means it cannot participate in IP networking. The output shows the assigned addresses, their subnets, and their scope .

ip -s link show eth0

The -s flag adds statistics: packets received, packets transmitted, errors, and drops. A steadily increasing error or drop count indicates a physical layer problemโ€”a bad cable, a failing NIC, or a switch port that is dropping frames .

ethtool eth0

The ethtool command shows link speed, duplex mode, and whether the link is detected. It also shows whether the interface supports and has negotiated the expected speed. A 1 Gbps interface that has negotiated 100 Mbps indicates a cable or switch port problem .

If the interface is down, the fix depends on the cause. A cable that has been unplugged, a switch port that has been disabled, or an interface that has been administratively shut down all produce the same symptom. The ip link set eth0 up command brings an interface up administratively, but if the physical link is not present, the interface remains DOWN despite the command.


b. Layer three: IP, gateway, and routing

With the interface up and an IP address assigned, the next layer is IP connectivity. The first test is whether the machine can reach its default gateway.

ip route show

The ip route show command lists the routing table. The default via line identifies the gateway. If there is no default route, the machine can only reach hosts on its local subnet .

ping -c 3 192.168.1.1

The ping command sends ICMP echo requests to the gateway. If the gateway responds, the local link and the gateway’s reachability are confirmed. If it does not, the problem is at the link layer or the gateway itself .

ping -c 3 8.8.8.8

If the gateway responds but an external IP does not, the problem is beyond the local networkโ€”possibly a routing issue at the gateway, an ISP problem, or a firewall blocking ICMP. Using an IP address rather than a hostname removes DNS from the equation at this stage .

traceroute 8.8.8.8

The traceroute command shows the path packets take to reach a destination. It identifies where the path breaks or slows down. The output lists each hop, with the response time for three probes. A hop that shows * * * indicates that the router at that hop is not responding to the probe, which may be normal (some routers block ICMP) or may indicate a problem .

The mtr command combines ping and traceroute. It runs continuously, showing the packet loss and latency for each hop. A hop with 100% loss that is followed by responsive hops is likely a router that blocks ICMP, not a failure. A hop with partial loss that propagates to subsequent hops indicates a problem at that hop.


c. Layers four through seven: DNS, ports, and services

DNS is the first thing to test at the application layer. A hostname that does not resolve produces the same symptom as a server that is down, but the fix is entirely different.

dig example.com

The dig command queries DNS directly. It shows the resolved IP address, the TTL, and the server that provided the answer. If the resolution fails, the problem is in /etc/resolv.conf or the DNS server configuration. If it succeeds, the hostname is resolving correctly .

cat /etc/resolv.conf

The /etc/resolv.conf file lists the DNS servers the system queries. A missing or incorrect nameserver entry causes all hostname resolution to fail. On systemd-based distributions, this file may be managed by systemd-resolved and should not be edited directly .

Once DNS resolves, the next test is whether the port is open and the service is responding.

nc -zv example.com 443

The nc (netcat) command with -z tests whether a TCP port is open. The -v flag produces verbose output. If the connection succeeds, the port is open and the service is listening. If it fails, the service may not be running, or a firewall may be blocking the port .

curl -v https://example.com

The curl -v command performs an HTTP request and shows the full exchange: DNS resolution, TCP connection, TLS handshake, HTTP request, and HTTP response. It identifies the exact point at which the transaction fails. A failure after “Connected to” but before “TLS handshake” indicates a TLS problem. A failure after “TLS handshake” but before the HTTP response indicates an application-level issue .

ss -tulpn | grep :443

On the server side, the ss command shows listening ports and the processes that own them. If the service should be listening on port 443 but is not, the service has not started or is bound to a different port .

tcpdump -i eth0 -n port 443

The tcpdump command captures packets on the interface. It is the most direct way to see whether packets are leaving the machine and whether responses are coming back. A connection attempt with outbound SYN packets but no SYN-ACK responses indicates that the packets are being droppedโ€”by a firewall, a routing issue, or a server that is not listening .


Complete Example Session

# ============================================
# PART 1: INTERFACE STATE
# ============================================
ip link show
# Check: is the interface UP?
# ============================================
# PART 2: IP ADDRESS
# ============================================
ip addr show
# Check: does the interface have an IP?
# ============================================
# PART 3: INTERFACE STATISTICS
# ============================================
ip -s link show eth0
# Check: are errors or drops increasing?
# ============================================
# PART 4: ROUTING TABLE
# ============================================
ip route show
# Check: is there a default route?
# ============================================
# PART 5: GATEWAY REACHABILITY
# ============================================
ping -c 3 $(ip route | grep default | awk '{print $3}')
# Check: does the gateway respond?
# ============================================
# PART 6: EXTERNAL IP REACHABILITY
# ============================================
ping -c 3 8.8.8.8
# Check: can we reach an external IP?
# ============================================
# PART 7: PATH TRACING
# ============================================
traceroute 8.8.8.8
# Check: where does the path break?
# ============================================
# PART 8: DNS RESOLUTION
# ============================================
dig example.com
cat /etc/resolv.conf
# Check: does the hostname resolve?
# ============================================
# PART 9: PORT CONNECTIVITY
# ============================================
nc -zv example.com 443
curl -v https://example.com
# Check: is the port open and the service responding?
# ============================================
# PART 10: PACKET CAPTURE
# ============================================
tcpdump -i eth0 -n port 443 -c 20
# Check: are packets leaving and responses arriving?

The ten parts covered interface state, IP address, interface statistics, routing table, gateway reachability, external IP reachability, path tracing, DNS resolution, port connectivity, and packet capture.


Quick Reference

Diagnostic Layers

LayerTestCommand
LinkInterface up?ip link show
NetworkIP assigned?ip addr show
Link errorsErrors/drops?ip -s link show
RoutingDefault route?ip route show
GatewayReachable?ping gateway
ExternalReachable?ping 8.8.8.8
PathWhere breaks?traceroute
DNSResolves?dig
PortOpen?nc -zv
ServiceResponds?curl -v
PacketsLeaving/arriving?tcpdump

Common Commands

CommandPurpose
ip link showInterface state
ip addr showIP addresses
ip route showRouting table
ip -s link showInterface statistics
ethtool eth0Link speed and duplex
pingICMP reachability
traceroutePath to destination
mtrContinuous path monitoring
digDNS resolution
nc -zvPort connectivity
curl -vFull HTTP exchange
ss -tulpnListening ports
tcpdumpPacket capture

Interpreting Results

SymptomLikely Layer
Interface DOWNPhysical or link
No IP addressConfiguration
Gateway unreachableLink or local network
External IP unreachableRouting or gateway
Hostname fails, IP worksDNS
Port closedService or firewall
SYN sent, no SYN-ACKFirewall or server
TLS handshake failsCertificate or TLS config

Best Practices

โœ… Do This:

# Start at the bottom of the stack
ip link show && ip addr show                                 # โœ…

# Test by IP before testing by hostname
ping 8.8.8.8 && dig example.com                              # โœ…

# Use traceroute to find the break
traceroute 8.8.8.8                                           # โœ…

# Test the specific port
nc -zv example.com 443                                       # โœ…

# Use curl -v for HTTP diagnostics
curl -v https://example.com                                  # โœ…

# Check packet flow with tcpdump
tcpdump -i eth0 -n port 443                                  # โœ…

# Document findings for escalation
# (interface up, gateway responds, DNS fails)                # โœ…

โŒ Don’t Do This:

# Don't restart the network stack first
systemctl restart networking                                 # โŒ

# Don't test by hostname before testing by IP
ping example.com                                             # โš ๏ธ (DNS may fail)

# Don't assume the application is at fault
# (check the network layer first)                            # โŒ

# Don't ignore interface statistics
# (errors indicate physical problems)                        # โŒ

# Don't use ping alone to diagnose
# (ICMP may be blocked while TCP works)                      # โš ๏ธ

# Don't skip the firewall check
ss -tulpn && iptables -L -n                                  # โœ…

Common Pitfalls

PitfallWhy It HappensFix
Testing hostname before IPDNS failure masquerades as network failureTest IP first
Ignoring interface statisticsErrors indicate physical issuesCheck ip -s link
Assuming ping worksICMP may be blockedTest TCP ports directly
Missing default routeNo gateway configuredCheck ip route
Wrong DNS server/etc/resolv.conf misconfiguredVerify nameservers
Firewall blocking silentlyPackets dropped, no responseCheck firewall rules
Testing wrong portService on different portVerify with ss -tulpn

Real-World Examples

1. Interface Down

ip link show
# eth0: <BROADCAST,MULTICAST> state DOWN
sudo ip link set eth0 up

2. No IP Address

ip addr show
# eth0: no inet address
sudo dhclient eth0

3. Gateway Unreachable

ping -c 3 192.168.1.1
# Request timeout
ip route show

4. DNS Failure

dig example.com
# connection timed out
cat /etc/resolv.conf

5. Port Closed

nc -zv example.com 443
# Connection refused
ss -tulpn | grep :443

6. Firewall Blocking

tcpdump -i eth0 -n port 443
# SYN sent, no SYN-ACK
sudo iptables -L -n | grep 443

7. Route Missing

ip route show
# no default route
sudo ip route add default via 192.168.1.1

8. Interface Errors

ip -s link show eth0
# RX errors: 1234
ethtool eth0

9. TLS Failure

curl -v https://example.com
# SSL certificate problem
openssl s_client -connect example.com:443

10. Packet Capture

tcpdump -i eth0 -n host 8.8.8.8
# Observe request/response

Visual

The Diagnostic Funnel

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  NETWORK DIAGNOSTIC FUNNEL                                  โ”‚
โ”‚                                                             โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚
โ”‚  โ”‚  LAYER 1-2: LINK AND INTERFACE                      โ”‚    โ”‚
โ”‚  โ”‚  ip link show, ip addr show, ip -s link show        โ”‚    โ”‚
โ”‚  โ”‚  โ†’ Is the interface UP with an IP?                  โ”‚    โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚
โ”‚                        โ–ผ                                    โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚
โ”‚  โ”‚  LAYER 3: IP AND ROUTING                            โ”‚    โ”‚
โ”‚  โ”‚  ip route show, ping gateway, ping 8.8.8.8          โ”‚    โ”‚
โ”‚  โ”‚  โ†’ Can we reach the gateway and external IPs?       โ”‚    โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚
โ”‚                        โ–ผ                                    โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚
โ”‚  โ”‚  LAYER 3.5: PATH                                    โ”‚    โ”‚
โ”‚  โ”‚  traceroute, mtr                                    โ”‚    โ”‚
โ”‚  โ”‚  โ†’ Where does the path break?                       โ”‚    โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚
โ”‚                        โ–ผ                                    โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚
โ”‚  โ”‚  LAYER 7: DNS                                       โ”‚    โ”‚
โ”‚  โ”‚  dig, cat /etc/resolv.conf                          โ”‚    โ”‚
โ”‚  โ”‚  โ†’ Does the hostname resolve?                       โ”‚    โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚
โ”‚                        โ–ผ                                    โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚
โ”‚  โ”‚  LAYER 4: PORTS                                     โ”‚    โ”‚
โ”‚  โ”‚  nc -zv, ss -tulpn                                  โ”‚    โ”‚
โ”‚  โ”‚  โ†’ Is the port open?                                โ”‚    โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚
โ”‚                        โ–ผ                                    โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚
โ”‚  โ”‚  LAYER 7: APPLICATION                               โ”‚    โ”‚
โ”‚  โ”‚  curl -v, tcpdump                                   โ”‚    โ”‚
โ”‚  โ”‚  โ†’ Does the service respond?                        โ”‚    โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚
โ”‚                                                             โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Layer-by-Layer Decision Tree

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  CONNECTION FAILS โ€” WHERE IS THE PROBLEM?                   โ”‚
โ”‚                                                             โ”‚
โ”‚  ip link show โ†’ interface DOWN?                             โ”‚
โ”‚    โ”œโ”€โ”€ YES โ”€โ”€โ–ถ Physical layer problem                       โ”‚
โ”‚    โ”‚           Check cable, switch port, NIC                โ”‚
โ”‚    โ””โ”€โ”€ NO                                                   โ”‚
โ”‚          โ”‚                                                  โ”‚
โ”‚          โ–ผ                                                  โ”‚
โ”‚  ip addr show โ†’ no IP?                                      โ”‚
โ”‚    โ”œโ”€โ”€ YES โ”€โ”€โ–ถ Configuration problem                        โ”‚
โ”‚    โ”‚           Check DHCP, static config                    โ”‚
โ”‚    โ””โ”€โ”€ NO                                                   โ”‚
โ”‚          โ”‚                                                  โ”‚
โ”‚          โ–ผ                                                  โ”‚
โ”‚  ping gateway โ†’ no response?                                โ”‚
โ”‚    โ”œโ”€โ”€ YES โ”€โ”€โ–ถ Link or gateway problem                      โ”‚
โ”‚    โ””โ”€โ”€ NO                                                   โ”‚
โ”‚          โ”‚                                                  โ”‚
โ”‚          โ–ผ                                                  โ”‚
โ”‚  ping 8.8.8.8 โ†’ no response?                                โ”‚
โ”‚    โ”œโ”€โ”€ YES โ”€โ”€โ–ถ Routing or upstream problem                  โ”‚
โ”‚    โ””โ”€โ”€ NO                                                   โ”‚
โ”‚          โ”‚                                                  โ”‚
โ”‚          โ–ผ                                                  โ”‚
โ”‚  dig hostname โ†’ fails?                                      โ”‚
โ”‚    โ”œโ”€โ”€ YES โ”€โ”€โ–ถ DNS problem                                  โ”‚
โ”‚    โ”‚           Check /etc/resolv.conf                       โ”‚
โ”‚    โ””โ”€โ”€ NO                                                   โ”‚
โ”‚          โ”‚                                                  โ”‚
โ”‚          โ–ผ                                                  โ”‚
โ”‚  nc -zv host port โ†’ fails?                                  โ”‚
โ”‚    โ”œโ”€โ”€ YES โ”€โ”€โ–ถ Service or firewall problem                  โ”‚
โ”‚    โ””โ”€โ”€ NO โ”€โ”€โ–ถ Service responds, check application           โ”‚
โ”‚                                                             โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Packet Flow Analysis

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  TCP CONNECTION IN Tcpdump                                  โ”‚
โ”‚                                                             โ”‚
โ”‚  Successful connection:                                     โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚
โ”‚  โ”‚  10:00:01  client โ†’ server  SYN                     โ”‚    โ”‚
โ”‚  โ”‚  10:00:02  server โ†’ client  SYN-ACK                 โ”‚    โ”‚
โ”‚  โ”‚  10:00:02  client โ†’ server  ACK                     โ”‚    โ”‚
โ”‚  โ”‚  10:00:02  client โ†’ server  TLS ClientHello         โ”‚    โ”‚
โ”‚  โ”‚  ...                                                โ”‚    โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚
โ”‚                                                             โ”‚
โ”‚  Firewall blocking:                                         โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚
โ”‚  โ”‚  10:00:01  client โ†’ server  SYN                     โ”‚    โ”‚
โ”‚  โ”‚  10:00:03  client โ†’ server  SYN (retransmit)        โ”‚    โ”‚
โ”‚  โ”‚  10:00:07  client โ†’ server  SYN (retransmit)        โ”‚    โ”‚
โ”‚  โ”‚  (no SYN-ACK from server)                           โ”‚    โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚
โ”‚                                                             โ”‚
โ”‚  Service not listening:                                     โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚
โ”‚  โ”‚  10:00:01  client โ†’ server  SYN                     โ”‚    โ”‚
โ”‚  โ”‚  10:00:01  server โ†’ client  RST                     โ”‚    โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚
โ”‚                                                             โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Diagnostic Commands by Layer

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  LAYER 2                                                    โ”‚
โ”‚  ip link show, ip -s link show, ethtool                     โ”‚
โ”‚                                                             โ”‚
โ”‚  LAYER 3                                                    โ”‚
โ”‚  ip addr show, ip route show, ping, traceroute, mtr         โ”‚
โ”‚                                                             โ”‚
โ”‚  LAYER 4                                                    โ”‚
โ”‚  ss -tulpn, nc -zv, tcpdump                                 โ”‚
โ”‚                                                             โ”‚
โ”‚  LAYER 7                                                    โ”‚
โ”‚  dig, curl -v, openssl s_client                             โ”‚
โ”‚                                                             โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Summary

ItemValue
First checkip link show
Second checkip addr show
Third checkip route show
Gateway testping gateway
External testping 8.8.8.8
Path testtraceroute, mtr
DNS testdig, cat /etc/resolv.conf
Port testnc -zv, ss -tulpn
Service testcurl -v
Packet capturetcpdump
PrincipleBottom up, one layer at a time

Key takeaways:

  • Network diagnostics works from the bottom up. Start at the link layer and move upward. A problem at a lower layer makes all higher layers fail regardless of their own health. Testing the application first wastes time on the wrong hypothesis.
  • The interface must be up and have an IP. ip link show confirms the link state. ip addr show confirms IP configuration. Both are prerequisites for any higher-layer connectivity.
  • The gateway must be reachable before external hosts are. ping the default gateway first. If the gateway does not respond, the problem is local. If it does, the problem is beyond it.
  • Test by IP before testing by hostname. A DNS failure and a network failure produce similar symptoms. Using an IP address removes DNS from the equation and isolates the layer.
  • DNS is a separate layer. dig queries DNS directly. If DNS fails, the problem is in /etc/resolv.conf or the DNS server, not in the network path.
  • Port connectivity is a separate test. nc -zv tests whether a specific TCP port is open. A service that is not listening and a firewall that is blocking both produce connection failures, but the diagnostic path differs.
  • tcpdump shows what is actually on the wire. It is the most direct way to see whether packets are leaving and whether responses are arriving. A SYN with no SYN-ACK indicates that packets are being dropped or the server is not responding.
  • Document findings at each layer. An escalation that reports which layers passed and which failed is actionable. An escalation that reports only the symptom is not.

Remember: Network diagnostics is not guessing. It is a systematic process of elimination. Start at the bottom, confirm each layer, and move upward. Each test either confirms that a layer is healthyโ€”so the problem is above itโ€”or identifies the layer where the failure occurs. The commands are simple. The discipline is in the order. Check the interface before the IP, the IP before the gateway, the gateway before the external host, the external host before DNS, and DNS before the port. When the failure is found, the fix is usually obvious. The hard part is finding it, and the method is what makes finding it possible.



Stop using slow, ad-bloated tool sites! ๐Ÿคฎ

๐Ÿ”Ž Search “KandZ Tools” on Google to use many professional utilities for free.

KandZ.me is the ultimate minimalist hub for:
โœ… Finance (Mortgage, Interest, Inflation)
โœ… Tech (Base64, JSON, Dev Suite, IP)
โœ… Health (BMI, BMR, TDEE)
โœ… Productivity (Timer, Workspace, QR)

โšก๏ธ Fast & Private
๐Ÿ”’ No data leaves your device
๐Ÿ’Ž 100% Free

๐Ÿ”— Use it now: https://tools.kandz.me
๐Ÿ”– Bookmark itโ€”youโ€™ll need it later!