cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1601
Views
0
Helpful
8
Replies

Distance In OSPF

Joe Akiki
Level 1
Level 1

Dear,

 

I am trying to redistribute EIGRP into OSPF while using an access list to change the AD of particular routes.

 

I am using a Cisco 1941 router Version 15.1(4)M4 and trying the below command :

 

distance 180 <ip> <wild-card mask> <access list number>

 

But i am getting an error when adding the access list number.

 

Can you please explain why i am not able to specify any access list in the above command and what is the model of router or IOS version that is compatible with this command.

 

Looking forward to hearing from you as soon as possible.

8 Replies 8

Bilal Nawaz
VIP Alumni
VIP Alumni

What is the error you are getting please? Is it that the parser doesn't let you put in an ACL?

Please rate useful posts & remember to mark any solved questions as answered. Thank you.

Yes, it will indicates an arrow below the ACL number and write Invalid input detected at '^' marker

 

below is an example:

 

Router(config-router)#distance 180 192.168.100.1 0.0.0.255 1

                                                                                                 ^

% Invalid input detected at '^' marker.

Why do you use that wildcard ? it should be 0.0.0.0 to specify the IP source address
 

The issue is not with the wildcard mask, it is with the access list number, even if I use the 0.0.0.0 as a wildcard mask, I am getting the same error.

Joe

Can you just clarify.

You are redistributing EIGRP into OSPF and the distance command is being used under the OSPF configuration ?

If so this wouldn't have any effect because on the router you are doing redistribution on the EIGRP route would be in the routing table as it must be for it to be redistributed and AD is not passed in any routing updates to other routers.

So if you have an EIGRP external route in the routing table and you redistribute into OSPF the OSPF route won't replace the EIGRP route.

Apologies if I am not understanding what you are trying to do.

Jon

 

Jon,

I have one subnet that could be learned from an OSPF route and EIGRP route.

I need the router to always prefer the EIGRP route on the OSPF route for a particular subnet unless this route is down it will goes from the OSPF route and for all the remaining subnets, OSPF route should be preferred unless the route is down, EIGRP will take place.

Can you please provide a solution? 

Joe

Apologies for the delay in getting back.

Okay you have EIGRP externals and OSPF and you want to prefer all OSPF routes which it will by default except for one EIGRP route which you want preferred.

This is a bit of a long shot but I checked the command references for your IOS version and the distance command with OSPF specifically says you need to use an acl name and makes no mention of using an acl number.

It may just be the way it is worded but can you try using a named acl and see if it works.

Jon

Hmm, im not too sure with the command reference, though i think you are right Jon - it will probably be a named ACL, I've seen some platforms or IOS versions, allowing named ACLs/numbered ACLs or both, yet the command reference had been the opposite to what was available on the IOS.

I have R1, R2 and R3 below. Just to see if both named and numbered ACL work. (I know it does, but just for others who are interested)

OSFP between R1 and R2, EIGRP between R2 and R3. I'll just redistribute EIGRP to OSPF on R2.

R1 .1 ----10.0.0.0/30----- .2 -R2- .2----20.0.0.0/24 ---.3 R3

Output from R1:

R1#sh ip route 
Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        10.0.0.0/30 is directly connected, Ethernet0/1
L        10.0.0.1/32 is directly connected, Ethernet0/1
      20.0.0.0/24 is subnetted, 1 subnets
O E1     20.0.0.0 [110/1020] via 10.0.0.2, 00:00:05, Ethernet0/1

 

Okay, so lets say I wanted to change the Admin Distance just for this one route...

 

R1(config-router)#distance 111 10.0.0.2 0.0.0.0 ?
  <1-99>       IP Standard access list number
  <1300-1999>  IP Standard expanded access list number
  WORD         Standard access-list name
  <cr>

So I'll try the standard access - list number (1)

R1(config-router)#ip access-list standard 1
R1(config-std-nacl)#permit 20.0.0.0 0.0.0.255    
R1(config-std-nacl)#end
R1#sh ip route

Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        10.0.0.0/30 is directly connected, Ethernet0/1
L        10.0.0.1/32 is directly connected, Ethernet0/1
      20.0.0.0/24 is subnetted, 1 subnets
O E1     20.0.0.0 [111/1020] via 10.0.0.2, 00:00:43, Ethernet0/1

I'll try with the named ACL now...

R1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#router ospf 1
R1(config-router)#no distance 111 10.0.0.2 0.0.0.0 1
R1(config-router)#no ip access-list standard 1

R1(config)#do sh ip route | inc O E1
O E1     20.0.0.0 [110/1020] via 10.0.0.2, 00:00:17, Ethernet0/1

R1(config)#router ospf 1                           
R1(config-router)#ip access-list standard OSPF-AD         
R1(config-std-nacl)#permit 20.0.0.0 0.0.0.255               
R1(config-std-nacl)#router ospf 1                  
R1(config-router)#distance 111 10.0.0.2 0.0.0.0 OSPF-AD   
R1(config-router)#
R1(config-router)#do sh ip route | inc O E1            
O E1     20.0.0.0 [111/1020] via 10.0.0.2, 00:00:04, Ethernet0/1

It works for both numbered and named ACLs, just depends on the IOS and whichever one it supports. Like many things with Cisco - inconsistency.

Bilal

Please rate useful posts & remember to mark any solved questions as answered. Thank you.