Gateway of last resort

📘 CCNA 200-301 v1.1

3.1 Interpret the components of routing table

3.1.g Gateway of last resort

What is a Gateway of Last Resort?

The Gateway of Last Resort is the router’s “default route” — it is the route the router will use when there is no specific match in the routing table for a destination IP address.

Think of it as a backup route or a final option for forwarding packets that don’t match any other route.


🔹 Why is it needed?

A router uses its routing table to decide where to send packets.
Each route in the table tells the router which next hop or exit interface to use for a specific network.

But sometimes:

  • The router receives a packet with a destination network not listed in its routing table.

Instead of dropping that packet, the router can forward it to the Gateway of Last Resort — if one is configured.

So, the Gateway of Last Resort prevents unnecessary packet drops and helps ensure connectivity to unknown or external networks (like the internet).


🔹 How it appears in the routing table

When you run the command:

show ip route

You may see a line like:

Gateway of last resort is 192.168.1.1 to network 0.0.0.0

This means:

  • 192.168.1.1 is the next-hop IP address the router will use for all destinations not found in its routing table.
  • 0.0.0.0/0 is the default route — it represents “any IP address”.

🔹 How the Gateway of Last Resort is set

The Gateway of Last Resort is set automatically or manually, depending on how you configure the router.

1. Manually – Using a Static Default Route

You can configure a default route using this command:

ip route 0.0.0.0 0.0.0.0 <next-hop-IP or exit-interface>

Example:

ip route 0.0.0.0 0.0.0.0 192.168.1.1
  • This tells the router:
    “If you don’t know where to send a packet, send it to 192.168.1.1.”
  • Once configured, it appears in the routing table as: S* 0.0.0.0/0 [1/0] via 192.168.1.1
    • S means static route.
    • * (star symbol) indicates that this route is the Gateway of Last Resort.

2. Automatically – From a Dynamic Routing Protocol

Some dynamic routing protocols (like EIGRP, RIP, or OSPF) can advertise a default route to other routers.

Example with EIGRP:

If you configure one router with:

ip route 0.0.0.0 0.0.0.0 10.1.1.1

and then advertise it using:

router eigrp 100
redistribute static

Then other routers running EIGRP can learn this route dynamically and set their own Gateway of Last Resort to that router.


🔹 How the router uses it (Decision Process)

When a router receives a packet:

  1. The router checks the destination IP address in the packet.
  2. It looks for a longest match in the routing table (the route with the most specific network prefix).
  3. If no route matches, it checks if a default route (0.0.0.0/0) exists.
  4. If the default route exists → it uses the Gateway of Last Resort.
  5. If not → the router drops the packet and may send an ICMP “Destination Unreachable” message back to the sender.

🔹 How to verify it

You can use:

show ip route

and look for:

Gateway of last resort is <IP> to network 0.0.0.0

Or, to see only the default route:

show ip route 0.0.0.0

You may see:

S* 0.0.0.0/0 [1/0] via 192.168.1.1

🔹 Important Notes for the CCNA Exam

ConceptDescription
0.0.0.0/0Represents the default route (all IP addresses).
S*Static route that acts as the Gateway of Last Resort.
Gateway of Last ResortThe next-hop IP or interface used when no other route matches.
Set manuallyUsing ip route 0.0.0.0 0.0.0.0 <next-hop>.
Set dynamicallyThrough routing protocols that advertise default routes.
If not configuredPackets with unknown destinations are dropped.

🔹 Example: Routing Table Interpretation

R1# show ip route
Codes: C - connected, S - static, R - RIP, D - EIGRP, O - OSPF, * - candidate default

Gateway of last resort is 10.0.0.2 to network 0.0.0.0

     S* 0.0.0.0/0 [1/0] via 10.0.0.2
     C  10.0.0.0/24 is directly connected, GigabitEthernet0/0
     C  192.168.1.0/24 is directly connected, GigabitEthernet0/1

Interpretation:

  • The router will send packets for 10.0.0.0/24 and 192.168.1.0/24 directly to those interfaces.
  • If a packet arrives for any other network (for example, 8.8.8.8), the router will use the Gateway of Last Resort (10.0.0.2) to forward it.

✅ Summary

FeatureDescription
PurposeUsed when no specific route exists in the routing table.
RepresentsThe router’s default route (0.0.0.0/0).
Configured byStatic route command or learned from routing protocols.
Display commandshow ip route
SymbolS* (Static Default Route)
Without itRouter drops packets for unknown destinations.

In short:
The Gateway of Last Resort is the default path the router uses to forward packets when it does not know where the destination network is.
It is shown as a default route (0.0.0.0/0) in the routing table and is an essential concept for ensuring continuous connectivity — especially toward external or unknown networks.


Leave a Reply

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

Buy Me a Coffee