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

Switch1—-switch2—–switch3

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?

1
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 10.208.255.1/32 learned from 10.208.1.2 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 10.208.255.1/32 [110/20] via 10.208.1.2, Ethernet1

ip prefix-list R1 seq 10 permit 10.208.255.1/32


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

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

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

Hope this helps.

Attachments:

Post your Answer

You must be logged in to post an answer.