Posted on June 27, 2018 4:51 pm
 |  Asked by junjie
Print Friendly, PDF & Email


sw2 learnt 10/8 from sw1 via ospf E1
sw2 learnt 10/8 from sw3 via ebgp

In sw2, there is an active route 10/8 which is ospf E1 learnt from sw1 since ospf E1’s AD is 110 while ebgp’s AD is 200

I want to change AD of 10/8 from sw3 to 99 ,so it can be optimized than ospf E1

it seems route-map can’t achieve it

any way to change AD per prefix or even per bgp neighbor?

Any suggestion?

Posted by Tyler Conrad
Answered on June 27, 2018 6:05 pm

Hi Junjie,

A route-map should be able to change the administrative distance of a prefix. Try something similar to the configuration below:

Case: Need to set distance for ip prefix learned from via both OSPF and BGP to prefer BGP. Default AD for all BGP routes set to 200, OSPF set to 110.

Pre-Change – Route learned from OSPF:
O [110/20] via, Ethernet1

ip prefix-list R1 seq 10 permit

route-map DISTANCE permit 10
match ip address prefix-list R1
set distance 19

Apply route-map to R1 Neighbor inbound:
neighbor route-map DISTANCE in

Route table should now prefer BGP with an AD of 19:
B E [19/0] via, Ethernet1

Hope this helps.


Post your Answer

You must be logged in to post an answer.