Default Routing

In the same way that you can set a default gateway on your desktops and servers, you can also set a default gateway of sorts on your Cisco router – the gateway of last resort. While the name is different, the function is the same. Remember that when a router comes across a packet destined for an unknown network, it automatically drops the packet. If we specify a gateway of last resort, a router will forward traffic for networks that it doesn’t know about to the destination router address we specify.

Figure: Router B configured with a default route, also known as a gateway of last resort.

Consider the figure above, in which Router A is connected to many different networks. Router B, on the other hand, is only connected to two networks. In order to allow Router B to get to all of the other networks shown, we would either need to configure a routing protocol (like RIP or IGRP), or define static routes to each network. In this particular scenario, it might actually be easier to use default routing to allow Router B to reach those three networks. Remember that Router B already knows about networks and, since they are directly connected. In order to have Router B forward all traffic destined for other networks to Router A, we should configure a gateway of last resort on Router B. This involves a single routing table entry, with a destination network of If you recall from Chapter 5, this address literally means “all networks”. In other words, we are saying that all other networks can be reached via Router A. When Router B attempts to route packets, it will first look in its routing table for the destination network. If it doesn’t find an entry, it will forward packets to the default route specified.

To configure the gateway of last resort on Router B, use the ip route command, as shown below.

RouterB(config)#ip route
RouterB#sh ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default
U - per-user static route, o - ODR
Gateway of last resort is to network is subnetted, 2 subnets
C is directly connected, Ethernet0
C is directly connected, Serial0
S* [1/0] via

Notice that the static route entry used for both the destination IP address and subnet mask, followed by the address of the next hop router. In this case, all traffic not destined for networks and will be forwarded to, interface S0 on Router A. The default route also appears in our routing tables as both the gateway of last result and as a static route. In this scenario, Router A would still need a routing table entry that defines how to reach network

Default routes are commonly used when you are routing public IP addresses to the Internet. If you didn’t define a default route, you would literally need to define a next hop address for every network on the Internet!

Author: Dan DiNicolo

Dan DiNicolo is a freelance author, consultant, trainer, and the managing editor of He is the author of the CCNA Study Guide found on this site, as well as many books including the PC Magazine titles Windows XP Security Solutions and Windows Vista Security Solutions. Click here to contact Dan.