Route redistribution configuration [step by step]
Topology:
In this tutorial, we will redistribute a static route into OSPF.
Steps:
1/ Between R1 and R2, static routing is configured (R1 have static route to 3.3.3.3).
2/ OSPF adjacency between R2 and R3. (Lo1 : 3.3.3.3 advertised into ospf)
3/ Redsitribute static route subnet into OSPF process
==> R3 will have 1.1.1.1 as external route in its routing table, connectivity between Loopbacks in R1 and R3.
R1 config:
R1#
!
version 15.2
!
hostname R1
!
interface Loopback1
ip address 1.1.1.1 255.255.255.255
!
interface Ethernet0/0
no ip address
shutdown
duplex auto
!
interface GigabitEthernet0/0
ip address 172.16.0.1 255.255.255.252
media-type gbic
speed 1000
duplex full
negotiation auto
ip route 3.3.3.3 255.255.255.255 172.16.0.2
ip route 172.17.0.0 255.255.255.252 172.16.0.2
routing table R1:
R1#sh 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
i – IS-IS, su – IS-IS summary, 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, H – NHRP, l – LISP
+ – replicated route, % – next hop override
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
C 1.1.1.1 is directly connected, Loopback1
3.0.0.0/32 is subnetted, 1 subnets
S 3.3.3.3 [1/0] via 172.16.0.2
172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
C 172.16.0.0/30 is directly connected, GigabitEthernet0/0
L 172.16.0.1/32 is directly connected, GigabitEthernet0/0
172.17.0.0/30 is subnetted, 1 subnets
S 172.17.0.0 [1/0] via 172.16.0.2
R2 configuration:
R2#
interface Loopback0
ip address 2.2.2.2 255.255.255.0
!
interface GigabitEthernet0/0
ip address 172.16.0.2 255.255.255.252
media-type gbic
speed 1000
duplex full
negotiation auto
!
interface GigabitEthernet1/0
ip address 172.17.0.1 255.255.255.252
negotiation auto
!
router ospf 10
redistribute connected subnets
redistribute static subnets
network 172.17.0.0 0.0.0.3 area 0
!
ip forward-protocol nd
!
!
no ip http server
no ip http secure-server
ip route 1.1.1.1 255.255.255.255 172.16.0.1
R2 routing table:
R2#sh 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
i – IS-IS, su – IS-IS summary, 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, H – NHRP, l – LISP
+ – replicated route, % – next hop override
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
S 1.1.1.1 [1/0] via 172.16.0.1
2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 2.2.2.0/24 is directly connected, Loopback0
L 2.2.2.2/32 is directly connected, Loopback0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/2] via 172.17.0.2, 01:22:37, GigabitEthernet1/0
172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
C 172.16.0.0/30 is directly connected, GigabitEthernet0/0
L 172.16.0.2/32 is directly connected, GigabitEthernet0/0
172.17.0.0/16 is variably subnetted, 2 subnets, 2 masks
C 172.17.0.0/30 is directly connected, GigabitEthernet1/0
L 172.17.0.1/32 is directly connected, GigabitEthernet1/0
R2#
R3 configuration:
interface Loopback1
ip address 3.3.3.3 255.255.255.255
!
interface Ethernet0/0
no ip address
shutdown
duplex auto
!
interface GigabitEthernet0/0
ip address 172.17.0.2 255.255.255.252
media-type gbic
speed 1000
duplex full
negotiation auto
!
interface GigabitEthernet1/0
no ip address
shutdown
negotiation auto
!
router ospf 10
network 3.3.3.3 0.0.0.0 area 0
network 172.17.0.0 0.0.0.3 area 0
!
R3 routing table:
R3#sh 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
i – IS-IS, su – IS-IS summary, 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, H – NHRP, l – LISP
+ – replicated route, % – next hop override
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
O E2 1.1.1.1 [110/20] via 172.17.0.1, 01:11:43, GigabitEthernet0/0
2.0.0.0/24 is subnetted, 1 subnets
O E2 2.2.2.0 [110/20] via 172.17.0.1, 00:00:54, GigabitEthernet0/0
3.0.0.0/32 is subnetted, 1 subnets
C 3.3.3.3 is directly connected, Loopback1
172.16.0.0/30 is subnetted, 1 subnets
O E2 172.16.0.0 [110/20] via 172.17.0.1, 00:00:54, GigabitEthernet0/0
172.17.0.0/16 is variably subnetted, 2 subnets, 2 masks
C 172.17.0.0/30 is directly connected, GigabitEthernet0/0
L 172.17.0.2/32 is directly connected, GigabitEthernet0/0
Tests:
R1#ping 3.3.3.3 so lo1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 56/68/88 ms
R1#ping 3.3.3.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 52/60/72 ms
R1#
————-
————-
R3#ping 1.1.1.1 so lo1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
Packet sent with a source address of 3.3.3.3
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 60/72/104 ms
R3#ping 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 48/56/64 ms
R3#
Notes:
- R2 have a static to 1.1.1.1 , this route is redistributed in OSPF process, so R3 will have an external route to R1’s LO1 (1.1.1.1)
- redistribute connected needed in order to ping from R1 with the interface connected to R2 as source interface.
- R1 must have a static route to 172.17.0.0/30 in order to ping from R3 gi0/0 interface (when pinging from R3 to R1 , the return traffic need that R1 knows 172.17.0.0/30 subnets in order to reach R3gi0/0). this is not needed when pinging from R3 with Lo1(3.3.3.3) as source interface.
Done! (Bol)