I'm having a confusion on static routing!
Let's say we have two static routes:
ip route 0.0.0.0 0.0.0.0 x.x.x.x
ip route y.y.y.y 255.255.255.255 z.z.z.z
Here, z.z.z.z is one link to one destination and x.x.x.x is other destination via another link of the same router.
Now what will happen if I put formar link
i.e. z.z.z.z down by doing 'shutdown' on serial interface, Does the packet to destination y.y.y.y will follow 0.0.0.0 route (default) or it will get dropped?
the x.x.x.x and z.z.z.z are the next hop for the networks 0.0.0.0 0.0.0.0 (default route) and y.y.y.y 255.255.255.255 (single host in this case!). Next hop is on the same netowrk of interface you defined on the router..but when you shut down one interface, you "shut down" the route toward next hop. The packet for that destination follow the default route, because router sees the routing table and when there is no specific route toward network, it will forward the packet toward the next hop of the default route (in this case x.x.x.x).
I hope this helps.
The packet will follow the default route. The reason being that if you shut the serial interface down and z.z.z.z is reached via that serial interface then the static route
y.y.y.y 255.255.255.255 z.z.z.z
will be removed from the routing table so there is now the default route left. Assuming you haven't got a more specific route in your routing table for y.y.y.y then it will use the default route.
The ip route 0.0.0.0 0.0.0.0 x.x.x.x command is called a default route. This is the route to be used in the event that the router cannot find a prefix match in its routing table for a given network. A default route, also known as the gateway of last resort, is the network route used by a router when no other known route exists for a given IP packet's destination address.
So, if you bring down the interface that the static route for network y.y.y.y points to, that static route will be removed from the routing table. The router will then forward the packet according to the default route.
It would have perhaps been a bit less confusing had you posted actual IP addresses.
If so, please rate this post.
Thanks for the replies!
Actually I'm observing the same response, the default route should be taken. But, does the actaul static route actually vanish from routing table if the interface is down...?
I can still see the route 'ip route y.y.y.y 255.255.255.255 z.z.z.z' when i do 'sho ip route y.y.y.y'.
The route should disappear from the routing table however if the z.z.z.z is the next hop there is a slight delay after you shut the interface before it is removed. At least in my lab although i was testing on an Ethernet interface.
If the interface that has z.z.z.z is shut down (and assuming that z.z.z.z is not reachable through some other interface) then the static route should be removed from the table. To help us understand better what is going on perhaps you could supply some additional information?
Would you post the output of show ip route when the interface is up, then shut down the interface, and post the output of show ip route when the interface is shut down? It would also be helpful to have the output of show ip interface brief when the interface is shutdown.
I am wondering if there is an alternate path to z.z.z.z and whether the next hop for y.y.y.y changes when the interface is shut down.
you are right, i was also experiencing some delay before it actually started taking default route.
Yes, i do have an alternative path to reach z.z.z.z via default route.