Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Free lesson

Finding why a device cannot connect

After this lesson: I can find why a device cannot connect.

50 min lesson6 commandsStatic routing lab: build routes on a small network in your browser

The laptop that has no internet

It is Monday morning in a small office. A laptop says it is connected, but no website opens. The owner says "the internet is broken".

A good help desk does not guess. It asks the same few questions, in the same order, every time.

The first question that fails points at the fault.

By the end of this lesson

Note

I can find why a device cannot connect.

Key words

WordWhat it meansExample
Faultthe one thing that stops it working
Default gatewaythe router a device sends other networks' traffic to
Routing tablea device's list of which way to send each network
pinga command that asks another device to answerping -c 2 10.0.3.2
traceroutea command that lists each router on the way
Hopone router passed on the way

The cells students fill in are left blank in this preview.

Ask the questions in order

Start at the device and work outwards. Does it have an address? Does it know its default gateway? Can it reach a far address by number? Can it reach it by name?

Each step needs the one before it. So the first step that fails is where to look.

Worked example: four questions, four faults

QuestionIf the answer is noLook at
1. Has it got an address?It cannot talk to anybodyDHCP, or the cable or Wi-Fi
2. Does it know its gateway?It can only reach its own networkThe default route
3. Can it reach a far address by number?A router on the way has no routeThe routers' tables
4. Can it reach a name?Numbers work but names failDNS

The cells students fill in are left blank in this preview.

Check h1's address and gateway

Command
sudo ip netns exec h1 ip route

Shown here, not run. Create a free account to press Run and type it into your own lab’s terminal.

Ask which way h1 would send it

Command
sudo ip netns exec h1 ip route get 10.0.3.2

Shown here, not run. Create a free account to press Run and type it into your own lab’s terminal.

Questions 1 and 2 pass

h1's second line ends src 10.0.1.2. That is its own address, so question 1 passes.

Its first line says default via 10.0.1.1. That is its default gateway, r1, so question 2 passes too. The route get agrees: to reach h2 on 10.0.3.2, h1 sends to 10.0.1.1. The fault is further out.

ping and traceroute show where it stops

ping asks a device to answer. If something on the way cannot pass it on, that router may send back an error saying why.

traceroute lists each hop, one line for each router on the way. The last router that answers is where to look next.

Ping h2 from h1

Command
sudo ip netns exec h1 ping -c 2 -W 1 10.0.3.2

Shown here, not run. Create a free account to press Run and type it into your own lab’s terminal.

List the hops from h1 to h2

Command
sudo ip netns exec h1 traceroute -n -m 4 -w 1 10.0.3.2

Shown here, not run. Create a free account to press Run and type it into your own lab’s terminal.

The first router says no

The ping prints From 10.0.1.1 ... Destination Net Unreachable twice, then 100% packet loss. r1 answered, to say it cannot reach that network.

traceroute shows one hop, 1 10.0.1.1, followed by !N. That mark means network unreachable. So question 3 fails, at r1.

Read the refusing router's table

A router passes traffic on only if its routing table has a line for that network. No line, no way.

So read r1's table, then ask r1 directly about h2's address. Remember that a reply has to come back too, so every router on the way needs a route both ways.

Read r1's routing table

Command
sudo vtysh -N r1 -c "show ip route"

Shown here, not run. Create a free account to press Run and type it into your own lab’s terminal.

Ask r1 about h2's address

Command
sudo ip netns exec r1 ip route get 10.0.3.2

Shown here, not run. Create a free account to press Run and type it into your own lab’s terminal.

r1 has no line for h2

Below the key of letters, r1 has four lines. The C lines are its two cables, 10.0.1.0/24 and 10.0.12.0/24. The L lines are its own addresses.

There is no line for 10.0.3.0/24, so r1 answers Network is unreachable. That is the fault. Fixing it is your job in the lab.

A common mistake

Warning

Many people think a failed ping means the far device is switched off. Often it is on, and a router on the way has no route. Read who answered and what they said before you blame the far end.

Going further: after the fix

Once your routes work in the lab, run the same ping and traceroute from h1 again. Copy both outputs.

Feed them to received and last_hop from your assignment. How many replies came back, and which hop answered last? Then write the four answers for diagnose.

About this lab and its source: Static routing lab: build routes on a small network in your browser

Teaching a class? Set this module for your students with a teacher guide, marked assignments and a lab for every student.