Default Route
Default Route
When the router receives a packet for a destination that does not match any more specific route in its routing table then we send it to default gateway..
Network Topology
R2 (ISP)
G0/0 203.0.113.2/30
|
G0/1 203.0.113.1/30
R1
G0/0 192.168.10.1/24
|
Switch
|
PC1
192.168.10.10/24
IP Addressing
| Device | Interface | IP Address |
|---|---|---|
| PC1 | NIC | 192.168.10.10/24 |
| R1 | G0/0 | 192.168.10.1/24 |
| R1 | G0/1 | 203.0.113.1/30 |
| R2 | G0/0 | 203.0.113.2/30 |
PC Default Gateway:
192.168.10.1
Step 1: Configure R1
enable
configure terminal
interface g0/0
ip address 192.168.10.1 255.255.255.0
no shutdown
interface g0/1
ip address 203.0.113.1 255.255.255.252
no shutdown
Step 2: Configure R2
enable
configure terminal
interface g0/0
ip address 203.0.113.2 255.255.255.252
no shutdown
Step 3: Configure the Default Route on R1
ip route 0.0.0.0 0.0.0.0 203.0.113.2
Syntax
ip route 0.0.0.0 0.0.0.0 < Exit interface / ISP Gateway >
This means:
"If I don't know how to reach a destination, send the packet to 203.0.113.2."
Verify the Route
show ip route
Example output:
Gateway of last resort is 203.0.113.2
S* 0.0.0.0/0 [1/0] via 203.0.113.2
C 192.168.10.0/24 is directly connected
C 203.0.113.0/30 is directly connected
Explanation
- S = Static Route
- * = Candidate Default Route
- Gateway of last resort = The default route
Test Connectivity
From the PC:
ping 203.0.113.2
Then test a destination not in the local routing table:
ping 18.8.8.8
The packet flow is:
PC
↓
R1
↓
Default Route
↓
R2
↓
Internet
Using the Exit Interface Instead of a Next Hop
You can also configure:
ip route 0.0.0.0 0.0.0.0 g0/1
This tells R1 to send unknown traffic out interface G0/1.
Remove the Default Route
no ip route 0.0.0.0 0.0.0.0 203.0.113.2
Troubleshooting Commands
show ip route
show running-config
show ip interface brief
show arp
show cdp neighbors
ping 203.0.113.2
traceroute 8.8.8.8Think of it like this
- Default gateways = doors inside a building (one door for each department/VLAN).
- Public IP = the building's single main street address.
Comments
Post a Comment