Default static route

A default route defines where packets will be sent if no specific route for the destination network is listed in the routing table. If no default route is set, the router will discard all packets with destination addresses not found in its routing table.

Consider the following example:

default static route
We have a network of three routers. R1 is directly connected to two subnets – 192.168.0.0/24 and 10.0.0.0/24. R3 is connected to the Internet.

Here is the routing table on R1:

R1#show ip route

Gateway of last resort is not set

     10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       10.0.0.0/24 is directly connected, GigabitEthernet0/1
L       10.0.0.1/32 is directly connected, GigabitEthernet0/1
     192.168.0.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.0.0/24 is directly connected, GigabitEthernet0/0
L       192.168.0.1/32 is directly connected, GigabitEthernet0/0

Notice the lack of the default gateway or default route. If R1 tries to access a public IP address (e.g. 4.2.2.2), the packets will be dropped because no route to that IP address has been found in the routing table:

Dropped packet no default route

To create a default static route on R1, we need to use the following command:

R1(config)#ip route 0.0.0.0 0.0.0.0 10.0.0.2

The command above instructs R1 to match all IP addresses and subnet masks and send the packets to 10.0.0.2 (the interface on R3 that is connected to R1). The routing table on R1 now looks like this:

R1#show ip route

Gateway of last resort is 10.0.0.2 to network 0.0.0.0

     10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       10.0.0.0/24 is directly connected, GigabitEthernet0/1
L       10.0.0.1/32 is directly connected, GigabitEthernet0/1
     192.168.0.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.0.0/24 is directly connected, GigabitEthernet0/0
L       192.168.0.1/32 is directly connected, GigabitEthernet0/0
S*   0.0.0.0/0 [1/0] via 10.0.0.2

Notice how the gateway of last resort is now set to 10.0.0.2. There is also a route marked with S* in the routing table, which means that the static default route we’ve just configured is a candidate default route (since routers can learn about multiple default routes), and * indicates that this static route is a candidate to become the default route.

Ping will now succeed:

R1#ping 4.2.2.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 4.2.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/1 ms
NOTE
Connected routes always take precedence over static or dynamically discovered routes because they have the administrative distance value of 0 (the lowest possible value). In our case, this means that R1 will send out packets destined for 192.168.0.0/24 according to the specified connected route.

Download our Free CCNA Study Guide PDF for complete notes on all the CCNA 200-301 exam topics in one book.

We recommend the Cisco CCNA Gold Bootcamp as your main CCNA training course. It’s the highest rated Cisco course online with an average rating of 4.8 from over 30,000 public reviews and is the gold standard in CCNA training: