ip route, default route and a backup with administrative distance
Level: IntermediateTime: 25 minDomain 3.0 IP Connectivity
Scenario
R1 is a branch router and R2 the headquarters router, which also provides Internet access (its Loopback0, 203.0.113.1). They're joined by two links: the primary (G0/1, 10.0.0.0/30) and a backup (G0/2, 10.0.0.4/30).
On R1, create a default route via 10.0.0.2 and a backup one via 10.0.0.6 with administrative distance 5, so it's only used if the primary link fails. On R2, create a static route to the branch LAN (192.168.1.0/24) via 10.0.0.1. Check the table with show ip route.
Topology
Devices and cabling
R1, R2·2911
PC1, PC2·PC-PT
From
To
Cable
PC1Fa0
R1Gi0/0
Crossover
R1Gi0/1
R2Gi0/0
Crossover
R1Gi0/2
R2Gi0/2
Crossover
R2Gi0/1
PC2Fa0
Crossover
If in doubt, the automatic connection cable (the lightning bolt) picks the right one. Rule: straight-through between different devices (PC or router to switch) and crossover between alike ones.
Addressing
Device
Interface
Address
Mask
Default gateway
R1
G0/0
192.168.1.1
255.255.255.0
—
R1
G0/1
10.0.0.1
255.255.255.252
—
R1
G0/2
10.0.0.5
255.255.255.252
—
R2
G0/0
10.0.0.2
255.255.255.252
—
R2
G0/2
10.0.0.6
255.255.255.252
—
R2
G0/1
192.168.2.1
255.255.255.0
—
R2
Lo0
203.0.113.1
255.255.255.255
—
PC1
NIC
192.168.1.10
255.255.255.0
192.168.1.1
PC2
NIC
192.168.2.10
255.255.255.0
192.168.2.1
Starting configuration
In the app this is already done. In Packet Tracer, before you start, enter each device with enable and configure terminal and type (or paste) these lines.
R1hostname R1
no ip domain-lookup
interface g0/0
ip address 192.168.1.1 255.255.255.0
no shutdown
interface g0/1
description Principal
ip address 10.0.0.1 255.255.255.252
no shutdown
interface g0/2
description Respaldo
ip address 10.0.0.5 255.255.255.252
no shutdown
R2hostname R2
no ip domain-lookup
interface g0/0
ip address 10.0.0.2 255.255.255.252
no shutdown
interface g0/1
ip address 192.168.2.1 255.255.255.0
no shutdown
interface g0/2
ip address 10.0.0.6 255.255.255.252
no shutdown
interface loopback 0
description Internet
ip address 203.0.113.1 255.255.255.255
PCs and servers (Desktop › IP Configuration)
PC1: IP 192.168.1.10, mask 255.255.255.0, gateway 192.168.1.1
PC2: IP 192.168.2.10, mask 255.255.255.0, gateway 192.168.2.1
Tasks
What must end up working. In the app, each one ticks itself off as soon as you get it.
R1: default route via 10.0.0.2
R1: floating route via 10.0.0.6 with distance 5
R2: route to 192.168.1.0/24 via 10.0.0.1
PC1 reaches PC2
PC1 reaches the Internet (203.0.113.1)
Traffic uses the primary link; the backup waits
Checked with show ip route on R1
In Packet Tracer
R1 and R2 are joined by two crossover cables: G0/1 to G0/0 (primary) and G0/2 to G0/2 (backup).
Hints
R1: default route via 10.0.0.2: ip route 0.0.0.0 0.0.0.0 10.0.0.2
R1: floating route via 10.0.0.6 with distance 5: ip route 0.0.0.0 0.0.0.0 10.0.0.6 5. The 5 is the administrative distance: higher than a normal static route (1).
R2: route to 192.168.1.0/24 via 10.0.0.1: ip route 192.168.1.0 255.255.255.0 10.0.0.1
PC1 reaches PC2: You need a route there (R1) and back (R2)
PC1 reaches the Internet (203.0.113.1): From PC1: ping 203.0.113.1
Traffic uses the primary link; the backup waits: R1's show ip route should only show S* via 10.0.0.2. If you shut G0/1, the route via 10.0.0.6 will appear.
Checked with show ip route on R1: show ip route
Step-by-step solution
Try it on your own first: you learn much more by typing the commands yourself.
Show the solution
1Primary default route R1
0.0.0.0 0.0.0.0 matches any destination: it's what R1 uses when it has no more specific route.
R1enable
configure terminal
ip route 0.0.0.0 0.0.0.0 10.0.0.2
2Floating backup route R1
The trailing 5 is the administrative distance. Since it's worse than the primary's (1), it only enters the table if the primary disappears.
R1ip route 0.0.0.0 0.0.0.0 10.0.0.6 5
end
3Return route to the branch R2
Without it, packets reach R2 but the replies don't know how to get back to 192.168.1.0/24.
R2enable
configure terminal
ip route 192.168.1.0 255.255.255.0 10.0.0.1
end
Verification
Only S* via 10.0.0.2 shows up: the floating route is configured but waiting. Shut G0/1 and look again: the route via 10.0.0.6 will appear.
R1R1#show ip route
Codes: L - local, C - connected, S - static, 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, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
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
10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C 10.0.0.0/30 is directly connected, GigabitEthernet0/1
L 10.0.0.1/32 is directly connected, GigabitEthernet0/1
C 10.0.0.4/30 is directly connected, GigabitEthernet0/2
L 10.0.0.5/32 is directly connected, GigabitEthernet0/2
192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.1.0/24 is directly connected, GigabitEthernet0/0
L 192.168.1.1/32 is directly connected, GigabitEthernet0/0
The first hop is R1 and the second, R2's loopback.
PC1C:\>tracert 203.0.113.1
Tracing route to 203.0.113.1 over a maximum of 30 hops:
1 0 ms 0 ms 0 ms 192.168.1.1
2 0 ms 0 ms 0 ms 203.0.113.1
Trace complete.
Common mistakes
Configuring only the way there: pings fail because R2 has no return route.
Giving the floating route the same distance as the primary: the router load-balances across both instead of keeping it as a backup.
Practice this lab on your phone
RoutingLab has this lab with a simulated IOS terminal: abbreviations, ? help, the same error messages and objectives that check themselves. The first two labs are free.