Default routes are used to direct packets addressed to networks not explicitly listed in the routing table.
There are 3 possibilities to configure this.
- ip default-gateway
- ip default-network
- 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 22.214.171.124 255.255.255.0 126.96.36.199 HJFR_Router(config)#ip default-network 188.8.131.52 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 184.108.40.206 to network 220.127.116.11 * 18.104.22.168/16 is variably subnetted, 2 subnets, 2 masks S* 22.214.171.124/16 [1/0] via 126.96.36.199 S 188.8.131.52/24 [1/0] via 184.108.40.206 220.127.116.11/24 is subnetted, 1 subnets C 18.104.22.168 is directly connected, Ethernet0 22.214.171.124/24 is subnetted, 1 subnets C 126.96.36.199 is directly connected, Serial0 S* 188.8.131.52/24 [1/0] via 184.108.40.206
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 220.127.116.11 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 18.104.22.168 to network 0.0.0.0 22.214.171.124/24 is subnetted, 2 subnets C 126.96.36.199 is directly connected, Serial0 C 188.8.131.52 is directly connected, Ethernet0 S* 0.0.0.0/0 [1/0] via 184.108.40.206 HJFR_Rotuer#