چارەسەری لاب / Routing
Static route not working
Packet Tracer · GNS3 · Cisco IOS · دوایین پشکنین
لەم پەڕەیەدا
What you see
R1 has a static route to the LAN behind R3, but a PC behind R1 still can't ping a PC behind R3. Sometimes traceroute reaches R2 and then stops.
Why it happens
A route only decides where a packet goes next. Every router on the way needs its own route to the destination, and the reply needs routes all the way back. Students often add the route on the first router and forget the others.
Check it
- On each router,
show ip route. Static routes are markedS. Is the destination network there, with the right mask? show ip route 192.168.3.10asks the router which route it would use for that exact address.show running-config | include ip routeshows what you typed, even if the route is not in the table.traceroute 192.168.3.10from the PC (tracerton a PC) shows the last router that knew what to do.
If a route is in the running config but not in show ip route, the next hop is unreachable or the exit interface is down.
Fix: add the missing routes
For three routers in a line (R1 to R2 to R3), every router needs a route to every network it is not connected to. A typical lab:
! R1 (LAN 192.168.1.0/24, link to R2 is 10.0.12.0/30)
ip route 192.168.3.0 255.255.255.0 10.0.12.2
ip route 10.0.23.0 255.255.255.252 10.0.12.2
! R2
ip route 192.168.1.0 255.255.255.0 10.0.12.1
ip route 192.168.3.0 255.255.255.0 10.0.23.2
! R3 (the return routes people forget)
ip route 192.168.1.0 255.255.255.0 10.0.23.1
ip route 10.0.12.0 255.255.255.252 10.0.23.1
On a stub router with only one way out, one default route is simpler:
ip route 0.0.0.0 0.0.0.0 10.0.12.2
Fix: a wrong route
You can't edit a static route. Remove it and type it again:
no ip route 192.168.3.0 255.255.255.0 10.0.12.6
ip route 192.168.3.0 255.255.255.0 10.0.12.2
Watch for these mistakes:
- Next hop is your own address instead of the neighbor's.
- Mask typo, for example 255.255.0.0 for a /24, which may send other traffic the wrong way.
- Network address wrong: 192.168.3.1 instead of 192.168.3.0.
- Floating route: a static route with a distance like
ip route ... 10.0.12.2 130is only a backup and won't show while a better route exists.
Still not working?
The link itself may be down; see interface down. If the far end is the internet in your lab, the ISP side also needs a route back, or you need NAT; see NAT not working.