Fixes

Fix

Can reach the local network but not other subnets

The machine has no default route, or the wrong prefix on its address, so packets for other networks never go to the router. Check ip route and the prefix.

Likely causes

  1. No default route (default via <router> missing from ip route).
  2. A prefix too short, such as /16 on a /24 network: the machine thinks far addresses are on its own wire and asks for them with ARP.
  3. A default route via an address nobody answers for.

Diagnose

Run these in order. The output is what each printed on a lab's real Linux machines.

leo:~# ip route
Only the local network, 10.0.1.0/24. No default line: nothing says where other networks are.
10.0.1.0/24 dev eth0 proto kernel scope link src 10.0.1.10 
till:~# ping -c 1 -W 2 10.0.1.70
Network unreachable with no packet sent: the address is outside the machine's own block, and no route covers it.
ping: connect: Network unreachable
till:~# ifconfig eth0
Read the mask. 255.255.255.192 is /26: only .0 to .63 count as neighbors, and everything else goes through a router.
eth0      Link encap:Ethernet  HWaddr 1A:74:03:72:3B:A9  
          inet addr:10.0.1.10  Bcast:10.0.1.63  Mask:255.255.255.192
…

Fix

leo:~# ip route add default via 10.0.1.2
Add the default route through the router.
leo:~# ip route
default via 10.0.1.2 dev eth0 
10.0.1.0/24 dev eth0 proto kernel scope link src 10.0.1.10 
leo:~# ping -c 1 10.0.2.10
The far network answers, and ttl=63 shows the ping crossing one router.
PING 10.0.2.10 (10.0.2.10) 56(84) bytes of data.
64 bytes from 10.0.2.10: icmp_seq=1 ttl=63 time=0.103 ms

--- 10.0.2.10 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.103/0.103/0.103/0.000 ms
ip addr add 10.0.1.10/24 dev eth0
For a wrong prefix: add the address with the right prefix first.

The fix the lab's challenge "The supplier's page will not open" checks.

ip addr del 10.0.1.10/16 dev eth0
Then delete the one with the wrong prefix. In this order the machine keeps its default route.

The fix the lab's challenge "The supplier's page will not open" checks.

till:~# curl -s http://10.0.2.80/
The page on the other network opens, through the router.
Flour supplier: 25 kg bags in stock

Break it and fix it yourself

Each lab is a small network of real Linux machines in your browser, where this fault happens.

Open Linux networking: bring a blank machine online by hand

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Sign in with Google or email to start.

Start this lab