Configure a default gateway in a CISCO router (gateway of last resource)

Default routes are used to direct packets addressed to networks not explicitly listed in the routing table.

There are 3 possibilities to configure this.

  1. ip default-gateway
  2. ip default-network
  3. and ip route 0.0.0.0 0.0.0.0

Lets start by the first.

1 – The ip default-gateway command differs from the other two commands. It should only be used when ip routing is not enabled on the Cisco router.

For instance, if the router is a host in the IP world, you can use this command to define a default gateway for it. You might also use this command when your low-end Cisco router is in boot mode in order to upload a Cisco IOS Software image to the router.

In boot mode, the router does not have ip routing enabled.

2 – you can use ip default-network when ip routing is active on the Cisco router. When you configure ip default-network the router considers routes to that network for installation as the gateway of last resort on the router.

HJFR_Router#configure terminal
HJFR_Router#ip route 170.70.24.0 255.255.255.0 131.108.99.2
HJFR_Router(config)#ip default-network 170.70.0.0
HJFR_Router(config)#^Z

HJFR_Router#show 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, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is 170.70.24.0 to network 170.70.0.0

 *   170.70.0.0/16 is variably subnetted, 2 subnets, 2 masks
S*      170.70.0.0/16 [1/0] via 170.70.24.0
S       170.70.24.0/24 [1/0] via 131.108.99.2
     161.44.0.0/24 is subnetted, 1 subnets
C       161.44.192.0 is directly connected, Ethernet0
     131.108.0.0/24 is subnetted, 1 subnets
C       131.108.99.0 is directly connected, Serial0
S*   198.10.1.0/24 [1/0] via 161.44.192.2

3 – Creating a static route to network 0.0.0.0 0.0.0.0 is another way to set the gateway of last resort on a router. As with the ip default-network command, using the static route to 0.0.0.0 is not dependent on any routing protocols. However, ip routing has to be enabled on the router.

Note: IGRP does not understand a route to 0.0.0.0. Therefore, it cannot propagate default routes created using the ip route 0.0.0.0 0.0.0.0 command. Use the ip default-network command to have IGRP propagate a default route.

EIGRP propagates a route to network 0.0.0.0, but the static route has to be redistributed into the routing protocol.

In earlier versions of RIP, the default route created using the ip route 0.0.0.0 0.0.0.0 was automatically advertised by RIP routers. In Cisco IOS Software Release 12.0T and later, RIP does not advertise the default route if the route is not learned via RIP. It might be necessary to redistribute the route into RIP.

OSPF and IS-IS does not propagate the default routes created by the command: ip route 0.0.0.0 0.0.0.0. Additionally, this default route can not be redistributed into OSPF or IS-IS using the redistribute command.

Use the default-information originate command to generate a default route into an IS-IS or OSPF routing domain.

HJFR_Router#configure terminal
HJFR_Router(config)#ip route 0.0.0.0 0.0.0.0 170.170.3.4
HJFR_Router(config)#^Z
HJFR_Router#

HJFR_Router#show 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 170.170.3.4 to network 0.0.0.0
170.170.0.0/24 is subnetted, 2 subnets
C 170.170.2.0 is directly connected, Serial0
C 170.170.3.0 is directly connected, Ethernet0
S* 0.0.0.0/0 [1/0] via 170.170.3.4
HJFR_Rotuer#

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.