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, andhostname. - 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, andnetstat.
Big Idea: Troubleshoot Layer by Layer
Do not start with random commands. Use a repeatable order:
- is the interface up?
- does it have an address?
- is there a route?
- does name resolution work?
- is the remote host reachable?
- 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
UPorDOWN- 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.1tests 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
- Run:
ip -br link - Then:
ip -br address - Then:
ip route - Explain in plain words:
- interface state
- address present or not
- default route present or not
2) Use a four-step ping test
- Run:
ping -c 2 127.0.0.1 - Then your gateway, if known.
- Then:
ping -c 2 8.8.8.8 - Then:
ping -c 2 example.com - Compare what works and what fails.
3) Inspect listening services
- Run:
ss -tuln - If you have
sudo, also run:sudo ss -tulpn - Identify one listening TCP port and one listening UDP port.
4) Test a remote TCP port
- Run:
nc -zv example.com 80 - Then try:
nc -zv example.com 443 - 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:
ifconfigroutenetstat
In modern Linux, prefer:
ipinstead ofifconfigandroutessinstead ofnetstat
Test Your Knowledge
Complete the quiz to assess your understanding of this course's concepts.
