Here’s the route-map configuration which I have done for R2:
R2(config-router)#do sh run | s ospf
router ospf 1
log-adjacency-changes
redistribute eigrp 100 subnets route-map eigrp-to-ospf
network 10.1.24.2 0.0.0.0 area 0
route-map eigrp-to-ospf permit 10
match ip address 10
set metric 100
set tag 10
route-map eigrp-to-ospf permit 20
match ip address 20
set metric 200
set tag 20
route-map eigrp-to-ospf deny 25
match ip address 4
route-map eigrp-to-ospf permit 30
set metric 300
set tag 30
Also R2’s access-lists which are applied to route-map:
R2(config-router)#do sh run | s access-list
access-list 4 permit 10.1.4.0 0.0.0.255
access-list 10 permit 10.1.0.0 0.0.0.255
access-list 10 permit 10.1.1.0 0.0.0.255
access-list 20 permit 10.1.2.0 0.0.0.255
access-list 20 permit 10.1.3.0 0.0.0.255
Here’s what happen to R4’s routing table:
R4#sh ip route ospf
10.0.0.0/24 is subnetted, 9 subnets
O E2 10.1.12.0 [110/300] via 10.1.24.2, 00:00:30, Serial1/2
O E2 10.1.3.0 [110/200] via 10.1.24.2, 00:00:30, Serial1/2
O E2 10.1.2.0 [110/200] via 10.1.24.2, 00:00:30, Serial1/2
O E2 10.1.1.0 [110/100] via 10.1.24.2, 00:00:30, Serial1/2
O E2 10.1.0.0 [110/100] via 10.1.24.2, 00:00:30, Serial1/2
O E2 10.1.23.0 [110/300] via 10.1.24.2, 00:00:30, Serial1/2
As per objective in the diagram, 10.1.4.0/24 should not be redistributed into OSPF. Also the metric for 10.1.0.0/24 as well as 10.1.1.0 are 100, 10.1.2.0/24 and 10.1.3.0/24 are 200, the remaining subnets are at metric 300.
R4#sh ip route 10.1.2.0
Routing entry for 10.1.2.0/24
Known via “ospf 1”, distance 110, metric 200
Tag 20, type extern 2, forward metric 64
Last update from 10.1.24.2 on Serial1/2, 00:07:42 ago
Routing Descriptor Blocks:
* 10.1.24.2, from 10.1.24.2, 00:07:42 ago, via Serial1/2
Route metric is 200, traffic share count is 1
Route tag 20
R4#sh ip route 10.1.3.0
Routing entry for 10.1.3.0/24
Known via “ospf 1”, distance 110, metric 200
Tag 20, type extern 2, forward metric 64
Last update from 10.1.24.2 on Serial1/2, 00:08:08 ago
Routing Descriptor Blocks:
* 10.1.24.2, from 10.1.24.2, 00:08:08 ago, via Serial1/2
Route metric is 200, traffic share count is 1
Route tag 20
R4#sh ip route 10.1.0.0
Routing entry for 10.1.0.0/24
Known via “ospf 1”, distance 110, metric 100
Tag 10, type extern 2, forward metric 64
Last update from 10.1.24.2 on Serial1/2, 00:08:27 ago
Routing Descriptor Blocks:
* 10.1.24.2, from 10.1.24.2, 00:08:27 ago, via Serial1/2
Route metric is 100, traffic share count is 1
Route tag 10
R4#sh ip route 10.1.1.0
Routing entry for 10.1.1.0/24
Known via “ospf 1”, distance 110, metric 100
Tag 10, type extern 2, forward metric 64
Last update from 10.1.24.2 on Serial1/2, 00:08:51 ago
Routing Descriptor Blocks:
* 10.1.24.2, from 10.1.24.2, 00:08:51 ago, via Serial1/2
Route metric is 100, traffic share count is 1
Route tag 10
R3 will have the same route map as R2, hence can copy and paste the running-config above:
R3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#access-list 4 permit 10.1.4.0 0.0.0.255
R3(config)#access-list 10 permit 10.1.0.0 0.0.0.255
R3(config)#access-list 10 permit 10.1.1.0 0.0.0.255
R3(config)#access-list 20 permit 10.1.2.0 0.0.0.255
R3(config)#access-list 20 permit 10.1.3.0 0.0.0.255
R3(config)#router ospf 1
R3(config-router)#log-adjacency-changes
R3(config-router)#redistribute eigrp 100 subnets route-map eigrp-to-ospf
R3(config-router)#network 10.1.24.2 0.0.0.0 area 0
R3(config-router)#route-map eigrp-to-ospf permit 10
R3(config-route-map)#match ip address 10
R3(config-route-map)#set metric 100
R3(config-route-map)#set tag 10
R3(config-route-map)#route-map eigrp-to-ospf permit 20
R3(config-route-map)#match ip address 20
R3(config-route-map)#set metric 200
R3(config-route-map)#set tag 20
R3(config-route-map)#route-map eigrp-to-ospf deny 25
R3(config-route-map)#match ip address 4
R3(config-route-map)#route-map eigrp-to-ospf permit 30
R3(config-route-map)#set metric 300
R3(config-route-map)#set tag 30
R2’s route-map configuration for ospf to eigrp:
route-map ospf-to-eigrp permit 10
set metric 400 20 255 1 1500
set tag 40
Because the lab did not specify specific subnets no access-list is needed to group the subnets for setting. If no match is defined in route-map then it means match ALL.
R1’s routing table:
R1#sh ip route eigrp
10.0.0.0/24 is subnetted, 10 subnets
D EX 10.4.0.0 [170/6917120] via 10.1.12.2, 00:01:08, Serial1/0
D EX 10.1.24.0 [170/6917120] via 10.1.12.2, 00:01:08, Serial1/0
D 10.1.23.0 [90/2681856] via 10.1.12.2, 00:53:32, Serial1/0
D EX 10.1.34.0 [170/6917120] via 10.1.12.2, 00:01:08, Serial1/0
6917120 is the metric of EIGRP derived from the metric I defined in Route-map ospf-to-eigrp
R1#sh ip route 10.1.24.0
Routing entry for 10.1.24.0/24
Known via “eigrp 100”, distance 170, metric 6917120
Tag 40, type external
Redistributing via eigrp 100
Last update from 10.1.12.2 on Serial1/0, 00:04:46 ago
Routing Descriptor Blocks:
* 10.1.12.2, from 10.1.12.2, 00:04:46 ago, via Serial1/0
Route metric is 6917120, traffic share count is 1
Total delay is 20200 microseconds, minimum bandwidth is 400 Kbit
Reliability 255/255, minimum MTU 1500 bytes
Loading 1/255, Hops 1
Route tag 40
R1#sh ip route 10.1.34.0
Routing entry for 10.1.34.0/24
Known via “eigrp 100”, distance 170, metric 6917120
Tag 40, type external
Redistributing via eigrp 100
Last update from 10.1.12.2 on Serial1/0, 00:05:07 ago
Routing Descriptor Blocks:
* 10.1.12.2, from 10.1.12.2, 00:05:07 ago, via Serial1/0
Route metric is 6917120, traffic share count is 1
Total delay is 20200 microseconds, minimum bandwidth is 400 Kbit
Reliability 255/255, minimum MTU 1500 bytes
Loading 1/255, Hops 1
Route tag 40
R1#sh ip route 10.4.0.0
Routing entry for 10.4.0.0/24
Known via “eigrp 100”, distance 170, metric 6917120
Tag 40, type external
Redistributing via eigrp 100
Last update from 10.1.12.2 on Serial1/0, 00:05:32 ago
Routing Descriptor Blocks:
* 10.1.12.2, from 10.1.12.2, 00:05:32 ago, via Serial1/0
Route metric is 6917120, traffic share count is 1
Total delay is 20200 microseconds, minimum bandwidth is 400 Kbit
Reliability 255/255, minimum MTU 1500 bytes
Loading 1/255, Hops 1
Route tag 40
As shown in the diagram, the original route to 10.4.0.0 was through 10.1.24.4:
R2#sh ip route
10.0.0.0/24 is subnetted, 10 subnets
C 10.1.12.0 is directly connected, Serial1/0
D 10.1.3.0 [90/2297856] via 10.1.12.1, 01:18:08, Serial1/0
D 10.1.2.0 [90/2297856] via 10.1.12.1, 01:18:08, Serial1/0
D 10.1.1.0 [90/2297856] via 10.1.12.1, 01:18:08, Serial1/0
D 10.1.0.0 [90/2297856] via 10.1.12.1, 01:18:08, Serial1/0
O 10.4.0.0 [110/65] via 10.1.24.4, 00:37:46, Serial1/2
D 10.1.4.0 [90/2297856] via 10.1.12.1, 01:18:08, Serial1/0
C 10.1.24.0 is directly connected, Serial1/2
C 10.1.23.0 is directly connected, Serial1/1
O 10.1.34.0 [110/128] via 10.1.24.4, 00:37:46, Serial1/2
EIGRP external route has a default administrative distance of 170, OSPF route has a default 110.
One way is to change the AD of the EIGRP external route:
R2(config)#router eigrp 100
R2(config-router)#distance eigrp 90 105
R2#sh ip route
Codes: 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
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 10 subnets
C 10.1.12.0 is directly connected, Serial1/0
D 10.1.3.0 [90/2297856] via 10.1.12.1, 00:00:35, Serial1/0
D 10.1.2.0 [90/2297856] via 10.1.12.1, 00:00:35, Serial1/0
D 10.1.1.0 [90/2297856] via 10.1.12.1, 00:00:35, Serial1/0
D 10.1.0.0 [90/2297856] via 10.1.12.1, 00:00:35, Serial1/0
D EX 10.4.0.0 [105/6917120] via 10.1.23.3, 00:00:33, Serial1/1
D 10.1.4.0 [90/2297856] via 10.1.12.1, 00:00:35, Serial1/0
C 10.1.24.0 is directly connected, Serial1/2
C 10.1.23.0 is directly connected, Serial1/1
D EX 10.1.34.0 [105/6917120] via 10.1.23.3, 00:00:33, Serial1/1
Now the route has changed to R3 in order to reach 10.4.0.0/24
R1#traceroute 10.4.0.1
Type escape sequence to abort.
Tracing the route to 10.4.0.1
1 10.1.12.2 528 msec 424 msec 532 msec
2 10.1.23.3 796 msec 464 msec 552 msec
3 10.1.34.4 800 msec 652 msec *
Let’s look at R2’s running config:
route-map eigrp-to-ospf permit 10
match ip address 10
set metric 100
set tag 10
route-map eigrp-to-ospf permit 20
match ip address 20
set metric 200
set tag 20
route-map eigrp-to-ospf deny 25
match ip address 4
route-map eigrp-to-ospf permit 30
set metric 300
set tag 30
From the eigrp-to-ospf route-map, tag 10,20 and 30 are coming from eigrp to ospf.
route-map ospf-to-eigrp permit 10
set metric 400 20 255 1 1500
set tag 40
Tag 40 is from OSPF to eigrp.
To prevent a routing loop, that is to prevent tag40 from returning back to ospf and to prevent tag 10,20 and 30 from returning to eigrp we can use route filter:
R2(config)#route-map eigrp-to-ospf deny 5
R2(config-route-map)#match tag 40
This statement to the route map will filter tag 40 network from coming back to ospf.
R2(config)#route-map ospf-to-eigrp deny 5
R2(config-route-map)#match tag 10 20 30
This statement will prevent tag 10, 20 and 30 from returning back to eigrp.
It is apparent that the naming of your route-map is really important.