Showing posts with label redistribution. Show all posts
Showing posts with label redistribution. Show all posts

Monday, November 10, 2008

Redistribution filtering with distribute list

This command still gets me because of the "out" keyword but here is it how it works. It might help to remember there is no "in" keyword when you filter from a routing process.

Topology:

R1---OSPF---R2---OSPF---R5---EIGRP---R6---EIGRP---R9

R9 has loopback 9.9.9.9
R2 has loopback 2.2.2.2

We will filter these routes during redistribution but allow all others.

Will start by filtering R9's loopback from EIGRP to OSPF. On R5 we create the prefix-list:

R5(config)#ip prefix-list BLOCK9 deny 9.9.9.9/32
R5(config)#ip prefix-list BLOCK9 permit 0.0.0.0/0 le 32


Then we apply it under the OSPF process. I know it looks weird but just remember there is no "in" direction when you filter this way.

R5(config)#router ospf 1
R5(config-router)#distribute-list prefix BLOCK9 out eigrp 1


Lets' check R2, notice we see R6's loopback but not R9's

R2#show ip route | inc E2
E1 - OSPF external type 1, E2 - OSPF external type 2
O E2 6.6.6.6 [110/20] via 150.100.100.5, 00:00:11, Serial1/0.2
O E2 150.100.69.0/24 [110/20] via 150.100.100.5, 00:07:51, Serial1/0.2
O E2 150.100.56.0/24 [110/20] via 150.100.100.5, 00:07:51, Serial1/0.2


Now let's do the other direction. First Let's check R9's table:

R9#show ip route | inc EX
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
D EX 1.1.1.1 [170/2560514816] via 150.100.69.6, 00:00:06, Serial1/1
D EX 2.2.2.2 [170/2560514816] via 150.100.69.6, 00:00:06, Serial1/1
D EX 4.4.4.4 [170/2560514816] via 150.100.69.6, 00:00:06, Serial1/1
D EX 192.168.100.2 [170/2560514816] via 150.100.69.6, 00:00:06, Serial1/1
D EX 150.100.100.2/32
D EX 150.100.24.0/24 [170/2560514816] via 150.100.69.6, 00:00:06, Serial1/1
D EX 150.100.12.0/24 [170/2560514816] via 150.100.69.6, 00:00:06, Serial1/1


Configure R5. remember this blocks FROM ospf process 1:

R5(config)#ip prefix-list BLOCK2 seq 5 deny 2.2.2.2/32
R5(config)#ip prefix-list BLOCK2 seq 10 permit 0.0.0.0/0 le 32
R5(config)#router eigrp 1
R5(config-router)#distribute-list prefix BLOCK2 out ospf 1


The neighbors will resync:

*Mar 1 00:20:38.571: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 1: Neighbor 150.100.56.6 (FastEthernet0/0) is resync: route configuration changed

Now check R9 and R2's loopback has been filtered:

R9#show ip route | inc EX
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
D EX 1.1.1.1 [170/2560514816] via 150.100.69.6, 00:02:11, Serial1/1
D EX 4.4.4.4 [170/2560514816] via 150.100.69.6, 00:02:11, Serial1/1
D EX 192.168.100.2 [170/2560514816] via 150.100.69.6, 00:02:11, Serial1/1
D EX 150.100.100.2/32
D EX 150.100.24.0/24 [170/2560514816] via 150.100.69.6, 00:02:11, Serial1/1
D EX 150.100.12.0/24 [170/2560514816] via 150.100.69.6, 00:02:11, Serial1/1

Monday, June 2, 2008

OSPF - calculating external route metrics

This post explains how to find the costs for E1 and E2 routes in OSPF.

R1 <--- area0 ---> R2 <--- area3 ---> R3

R3 is redistributing it's loopback 3.3.3.3 into area 3.
This route shows up with a cost of 20 on R1

R1#show ip route 3.3.3.3
Routing entry for 3.3.3.3/32
Known via "ospf 1", distance 110, metric 20, type extern 2, forward metric 128
Last update from 172.12.12.2 on Serial1/0, 00:02:54 ago
Routing Descriptor Blocks:
* 172.12.12.2, from 3.3.3.3, 00:02:54 ago, via Serial1/0
Route metric is 20, traffic share count is 1


The cost of 20 comes from the default metric applied to routes redistributed routes.
Let's change the metric on R3:

R3(config)#router ospf 1
R3(config-router)#redistribute connected subnets ?
metric Metric for redistributed routes
metric-type OSPF/IS-IS exterior metric type for redistributed routes
route-map Route map reference
tag Set tag for routes redistributed into OSPF


R3(config-router)#redistribute connected subnets metric 30

On R1 we see the metric is 30 now:

R1#show ip route | inc 3.3.3.3
O E2 3.3.3.3 [110/30] via 172.12.12.2, 00:00:40, Serial1/0


So the metric of E2 routes is equal to the metric given to it when the route was redistributed by the ASBR.

What about E1 routes?
Let's change the metric of 3.3.3.3 to type E1 on R3:

R3(config-router)#redistribute connected subnets metric 30 metric-type 1


View the metric on R1:

R1#show ip route | inc 3.3.3.3
O E1 3.3.3.3 [110/158] via 172.12.12.2, 00:00:34, Serial1/0


It's now 158! How did R1 come up with this metric? By adding these values

metric of route as redistributed (contained in type 5 LSA)
metric of R2 (ABR) to reach R3 (ASBR) (contained in type 4 LSA)
metric of R1 to reach R2 (ABR) (contained in R2's type 1 LSA)

we can view these costs with the show ip ospf database command:

R1#show ip ospf database external 3.3.3.3 | inc Metric
Metric Type: 1 (Comparable directly to link state metric)
Metric: 30

R1#show ip ospf database asbr-summary 3.3.3.3 | inc Metric
TOS: 0 Metric: 64


R1#show ip ospf database router 2.2.2.2 | section Link connected to: another Router
Link connected to: another Router (point-to-point)
(Link ID) Neighboring Router ID: 1.1.1.1
(Link Data) Router Interface address: 172.12.12.2
Number of TOS metrics: 0
TOS 0 Metrics: 64


Metric total = 64+64+30 = 158

In summary:
E2 route metric is equal to the metric upon redistribution
E1 route metrics add up original metric, metric to ASBR from ABR, metric to ABR.