What is Gateway of Last Resort in CCNA?
Pre-requisites: Ping, default route.
A gateway of last resort is used to forward packets whose destination address is not listed in the routing table. It is useful in networks where learning where the rest of the networks exist is not necessary. Whenever a packet hits the router’s interface and if the destination layer 3 information is not available in the routing table the packet is forwarded to the gateway of last resort. We can provide a gateway of last resort to a router using the command:
ip route 0.0.0.0 0.0.0.0 <next hop ip address>
Configuring Default Route:
Consider a topology:
Configuring R1’s physical interface:
interface GigabitEthernet0/0/0 ip address 192.168.1.1 255.255.255.0 no sh interface GigabitEthernet0/0/1 ip address 192.168.2.2 255.255.255.0 no shutdown
Configuring R0’s physical interface:
interface GigabitEthernet0/0/0 ip address 192.168.2.1 255.255.255.0 no shutdown
Configuring R0’s loopback interface:
interface Loopback0 ip address 18.104.22.168 255.255.255.255
In this topology consider that PC0 wants to communicate with 22.214.171.124 and the router 1 does not have an entry for 126.96.36.199 in it’s routing table. When we try to ping 188.8.131.52 from PC1.
We get a Destination Host Unreachable error as Router1 doesn’t have an entry for 184.108.40.206 on it’s routing table.
To allow the networks to communicate we will provide a gateway of last resort to R1 and add 192.168.2.0/24 network in the R0’s routing table.
Now, we add the gateway of last resort on R1 with the command:-
ip route 0.0.0.0 0.0.0.0 192.168.2.1
and checking R1’s routing table
show ip route
And now adding 192.168.2.0/24 network in the R0’s routing table and checking its routing table.
ip route 192.168.1.0 255.255.255.0 192.168.2.2
do show ip route
Now we ping 220.127.116.11 using PC0.
Please Login to comment...