Gateway of last resort is not set In Cisco Router

Gateway of last resort is not set In Cisco Router or Switch

You may notice the Line “gateway of last resort is not set” in output when you use the cisco command Show IP Route. This short article will explain that why you are getting this message.

Cisco router gateway of last resort

"Gateway of Last Resort is not set” means that there is no default route for IP packets which have no match with routing table. Gateway of last resort are routes use to avoid your router from dropping packets with unknown networks those are not exist in routing table
Routing table have the list of all known routes. Every time when a router receives a packet, router matches it with routing table entries if it present in routing table then it forward to that path and if route not present in routing table then it is forwarded to default gateway or default route.

How to set Gateway of last resort in router

You can configure or set a default gateway, or route of last resort with following commands:
  •  ip default-network    
  • ip default-gateway    
  • ip route

ip default-gateway

The ip default-gateway command is used when ip routing is disabled on Cisco-router. Following example defines the default route on router to
ip default-gateway

Instead of ip default-gateway command, you can use ip default-network when ip routing is enabled on 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. Gateways of last resort selected using the ip default-network command are advertised differently depending on which routing protocol is advertise the default route. For IGRP/EIGRP to propagate the route, the network specified by the ip default-network command must be known to IGRP or EIGRP.
RIP advertises a route to if a gateway of last resort is selected using the ip default-network command.
The default route advertised with the ip default-network command is not propagated by IS-IS and OSPF.

IP Route

Creating a static-route to unknown network is another way to set the gateway of last resort on a router. IGRP does not recognize a route advertise with static route command to You are required to use the ip default-network command in case of IGRP. EIGRP advertise a route to network, but the static route must beredistributed into the routing protocol.
RIP routers running Cisco IOS 12.0T and later does not advertise the default route where as in earlier version it automatically create a default route

Use the ip default-gateway command if the ip routing is disabled on Cisco-router and Use the ip default-network and ip route commands to set the gateway of last resort on Cisco routers that have ip routing enabled. The way in which routing-protocols advertise the default route differs for each protocol.

Quick Tip:
For setting network of last resort like use the following command:
ip default-network <IP address of gateway>