Default Gateway of Last Resort
Let's explore the concept of the default gateway of last resort and how to configure it on Cisco routers.
The default gateway of last resort is a route that a router uses when no specific route exists for a destination network in its routing table. It's essentially a "catch-all" route that tells the router where to send packets when it doesn't know the specific path to the destination.
Understanding the Gateway of Last Resort
When a router receives a packet destined for a network that isn't in its routing table, it needs to know where to forward that packet. Without a default route, the router would simply drop the packet. The gateway of last resort provides this fallback mechanism.
In routing tables, the default route is represented as 0.0.0.0/0 (all networks) and is often called a "quad-zero route."
Configuring a Static Default Route
The most common way to configure a gateway of last resort is through a static default route. Here's the basic syntax:
Router(config)# ip route 0.0.0.0 0.0.0.0 [next-hop-ip | exit-interface]For example:
Router(config)# ip route 0.0.0.0 0.0.0.0 192.168.1.1This command tells the router to send all unknown traffic to the next-hop IP address 192.168.1.1.
Alternatively, you can specify an exit interface:
Router(config)# ip route 0.0.0.0 0.0.0.0 Serial0/0Verifying the Default Route
To verify your default route configuration, use the following commands:
Router# show ip route
Router# show ip route 0.0.0.0The output will display the gateway of last resort at the top of the routing table, followed by the specific 0.0.0.0/0 route entry.
Dynamic Default Routes
Default routes can also be learned dynamically through routing protocols like OSPF, EIGRP, or BGP. However, static default routes are more common in smaller networks and edge router configurations.
Administrative Distance
Static default routes have an administrative distance of 1 by default, making them highly trusted. You can modify this if needed:
Router(config)# ip route 0.0.0.0 0.0.0.0 192.168.1.1 10This sets the administrative distance to 10, making it less preferred than the default value of 1.
Practical Example
Consider a branch office router that needs internet connectivity through its ISP connection:
BranchRouter(config)# interface Serial0/0
BranchRouter(config-if)# ip address 203.0.113.2 255.255.255.252
BranchRouter(config-if)# no shutdown
BranchRouter(config-if)# exit
BranchRouter(config)# ip route 0.0.0.0 0.0.0.0 203.0.113.1This configuration sets up the default route pointing to the ISP's gateway at 203.0.113.1.
Video Tutorial
The default gateway of last resort is a fundamental concept in routing that ensures packets have a path when no specific route exists. Proper configuration of default routes is essential for maintaining connectivity, especially in networks with internet access requirements.