A real-life situation
A new printer was given a static IP address by hand. Everyone on the same floor can print to it, but people in the other building can't. The printer works, the cables work and the switches work. The fault is one wrong number in its settings: the default gateway.
What goes wrong at Layer 3
| Fault | Typical symptom | How to spot it |
|---|---|---|
| Wrong IP (in the wrong subnet) | Can't even reach the gateway | Compare the host address with the gateway: same subnet? |
| Wrong mask | Some local devices work, others don't | Compare the mask with the mask on the gateway's interface |
| Wrong or no gateway | Local traffic works; other networks don't | ipconfig / ip route |
| Duplicate IP | Connection keeps dropping and coming back | Windows warning, %IP-4-DUPADDR log message on Cisco routers |
| Missing route | One remote network fails, others work | show ip route, traceroute |
Why the gateway matters
A host compares the destination with its own address and subnet mask (the value that shows which part of the address is the network). If the destination is in the same subnet, the host sends the packet straight to it. If not, it sends the packet to its default gateway. So a wrong gateway only breaks traffic to other networks. That is exactly what happened with the printer.
- 1. Same subnet: the PC sends straight to the printer. No gateway is needed, so printing works.
- 2. From building B: the print job reaches the printer through R1.
- 3. The reply goes nowhere: the printer tries to send it to gateway 192.168.10.254, which does not exist, so the reply is never delivered. Fix: set the gateway to 192.168.10.1.
How to verify: the host side
C:\> ipconfig Ethernet adapter Ethernet: IPv4 Address. . . . . . . . . . . : 192.168.10.40 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.10.1
ip addr and ip route.Missing routes, and the return path
Each router on the way needs a route to the destination, and each router on the way back needs a route to the source. A ping only works if both directions work. Forgetting the return route is one of the most common mistakes when adding static routes.
- 1. Going there works: R1 has a static route to 192.168.30.0/24.
- 2. Coming back fails: R2 has no route to 192.168.10.0/24, so it drops the reply. The PC only sees a timeout.
Based on Cisco documentation, not run on a lab device:
R2#show ip route 192.168.10.0 % Network not in table
R2(config)#ip route 192.168.10.0 255.255.255.0 10.0.12.1
ping 192.168.10.40 source 192.168.30.1. Using R2's LAN address as the source tests the same return path that the server's replies use.Check yourself
A PC can reach every device in its own subnet but nothing outside it. What is the most likely fault?
A PC has 192.168.10.40/24 and gateway 192.168.1.1. What is wrong?
R1 has a route to the server's network. Traceroute from the PC shows R1 as hop 1, then only stars. What should you check on R2?