Distance command for one source only?

I ran into an odd situation. I was playing with the OSPF distance command, to filter external type 2 prefixes coming from R6 in area 1, from entering the routing table on R5 in area 0. 

R6 is advertising as follows:

R6#sh ip route static
     170.1.0.0/24 is subnetted, 1 subnets
S       170.1.70.0 is directly connected, Null0
     160.1.0.0/24 is subnetted, 1 subnets
S       160.1.60.0 is directly connected, Null0
     180.1.0.0/24 is subnetted, 1 subnets
S       180.1.80.0 is directly connected, Null0

On R5 I configured :

R5(config)#router ospf 1

R5(config-router)#distance 255 150.1.6.6 0.0.0.0 R6_160
R5(config-router)#distance 255 150.1.6.6 0.0.0.0 R6_170
R5(config-router)#distance 255 150.1.6.6 0.0.0.0 R6_180

R5#sh run | sec ip access-list
ip access-list standard R6_160
 permit 160.1.60.0 0.0.0.255
ip access-list standard R6_170
 permit 170.1.70.0 0.0.0.255
ip access-list standard R6_180
 permit 180.1.80.0 0.0.0.255

but the result was this:

R5#sh run | sec router
router ospf 1
 router-id 150.1.5.5
 log-adjacency-changes
 network 150.1.5.5 0.0.0.0 area 0
 network 155.1.0.5 0.0.0.0 area 0
 network 0.0.0.0 255.255.255.255 area 0
 neighbor 155.1.0.4
 neighbor 155.1.0.1
 distance 255 150.1.6.6 0.0.0.0 R6_180

     170.1.0.0/24 is subnetted, 1 subnets
O E2    170.1.70.0 [110/20] via 155.1.0.1, 00:25:52, Serial1/0
     155.1.0.0/24 is subnetted, 2 subnets
O IA    155.1.146.0 [110/65] via 155.1.0.1, 00:25:52, Serial1/0
C       155.1.0.0 is directly connected, Serial1/0
     160.1.0.0/24 is subnetted, 1 subnets
O E2    160.1.60.0 [110/20] via 155.1.0.1, 00:25:52, Serial1/0
     150.1.0.0/16 is variably subnetted, 4 subnets, 2 masks
C       150.1.5.0/24 is directly connected, Loopback0
O IA    150.1.6.6/32 [110/66] via 155.1.0.1, 00:25:52, Serial1/0
O IA    150.1.4.4/32 [110/65] via 155.1.0.4, 00:25:52, Serial1/0
O IA    150.1.1.1/32 [110/65] via 155.1.0.1, 00:25:52, Serial1/0

So you can only filter on admin distance per one source? whats the deal?

Comments

  • In this particular case it makes sense to use the distance ospf ext 255 command.

    But that doesn't answer your question. The way it works is that you are defining the source and acl for the distance 255 specifically. If you wanted to add an entry for distance 254, then it would show up the way you expect; as a list of distances in the routing process. Of course that's not exactly preventing it from getting in the RIB.

    In your case, you should have one ACL that has the specific list of networks. But yeah, that's the way it works.

     

    Of -- and of course it's not only for one source. Just exapnd your ip address and mask to include as many sources as you need.

  • Use the same access-list to filter from the same source

Sign In or Register to comment.