Linucate
~ Linucate_

109.3 Basic Network Troubleshooting

All Levels

Introduction

This lesson is about diagnosing common network problems without panicking.

The main question is:

When networking does not work, how do you check the interface, address, route, name resolution, and listening services in a sensible order?

What you should be able to do after this lesson:

  • Use ip, ss, ping, tracepath, traceroute, nc, and hostname.
  • Inspect interfaces, addresses, routes, and listening sockets.
  • Separate routing problems from DNS problems.
  • Test whether a port is reachable.
  • Recognize legacy tools such as ifconfig, route, and netstat.

Big Idea: Troubleshoot Layer by Layer

Do not start with random commands. Use a repeatable order:

  1. is the interface up?
  2. does it have an address?
  3. is there a route?
  4. does name resolution work?
  5. is the remote host reachable?
  6. is the service listening on the expected port?

That order turns a vague "the network is broken" complaint into a manageable checklist.

Interface and Address Checks

Start with the local machine.

Show interfaces briefly:

ip -br link
ip -br address

Show more detail:

ip address show

What you are checking:

  • interface name
  • UP or DOWN
  • IPv4 or IPv6 addresses
  • whether loopback looks normal

Routing

If the interface is fine but remote networks do not work, check routes.

Show routes:

ip route
ip -6 route

Simple beginner questions:

  • is there a default route?
  • is the gateway correct?
  • is traffic for this subnet being sent the right way?

Basic Reachability with ping

Examples:

ping 127.0.0.1
ping <gateway>
ping 8.8.8.8
ping example.com

This sequence helps isolate problems:

  • 127.0.0.1 tests local IP stack
  • gateway tests local network reachability
  • public IP tests routing without DNS
  • hostname tests routing plus DNS

If ping 8.8.8.8 works but ping example.com fails, the problem is probably DNS, not raw connectivity.

Path Problems with tracepath or traceroute

Sometimes packets leave your machine but fail somewhere along the path.

Useful commands:

tracepath example.com
traceroute example.com

You do not need deep routing theory here. Just understand that these tools show where traffic stops or changes path.

Listening Services with ss

Modern Linux uses ss to inspect sockets.

Show listening TCP and UDP sockets:

ss -tuln

Show the owning process when allowed:

sudo ss -tulpn

This helps answer:

  • is the service actually listening?
  • on which port?
  • on which address?

Testing a Port with nc

To test whether a TCP port is reachable:

nc -zv example.com 22

Simple meaning:

  • -z = check without sending data
  • -v = verbose output

This is a quick way to separate:

  • host reachable but service closed
  • host unreachable
  • service open

Host Identity

Sometimes a machine is not using the hostname you expect.

Useful commands:

hostname
hostname -f

This helps when applications depend on the system's own hostname.

Practice Step by Step

1) Inspect the local machine
  1. Run: ip -br link
  2. Then: ip -br address
  3. Then: ip route
  4. Explain in plain words:
    • interface state
    • address present or not
    • default route present or not
2) Use a four-step ping test
  1. Run: ping -c 2 127.0.0.1
  2. Then your gateway, if known.
  3. Then: ping -c 2 8.8.8.8
  4. Then: ping -c 2 example.com
  5. Compare what works and what fails.
3) Inspect listening services
  1. Run: ss -tuln
  2. If you have sudo, also run: sudo ss -tulpn
  3. Identify one listening TCP port and one listening UDP port.
4) Test a remote TCP port
  1. Run: nc -zv example.com 80
  2. Then try: nc -zv example.com 443
  3. Notice that "name resolves" and "port is reachable" are different checks.

Cheat Sheet

ip -br link
ip -br address
ip route
ip -6 route
ping -c 2 127.0.0.1
ping -c 2 example.com
tracepath example.com
traceroute example.com
ss -tuln
sudo ss -tulpn
nc -zv example.com 22
hostname
hostname -f

Legacy / Exam Note

LPIC still expects awareness of older tools such as:

  • ifconfig
  • route
  • netstat

In modern Linux, prefer:

  • ip instead of ifconfig and route
  • ss instead of netstat
🎯

Test Your Knowledge

Complete the quiz to assess your understanding of this course's concepts.