cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 
cancel
1338
Views
3
Helpful
7
Replies

Redistributing into OSPF: Setting metric in route-map

modular182
Level 1
Level 1

Hello all. Thank you in advance for your help. 

When redistributing from BGP into OSPF is it possible to use a route map in the "redistribute" command with the "set metric" option? I'm trying to redistribute from BGP into OSPF, making them external type-1 routes and setting the metric to a particular value based on the particular network. So, for instance, if the network is 111.111.111.111/32 I want it's metric to be 100. If the network is 222.222.222.222/32 I want the metric to be 200. To do this, in the "redistribute bgp" command, I'm using a route-map that employs the "set metric" command based on which network it is. (Decided by a prefix list.) I'm not able to get it to work... which leads me to believe that in the steps that are taken to redistribute BGP into OSPF the step that sets the metric of the route occurs after the step(s) that run through the route map attached to the redistribute command. Is what I'm trying to do not possible? I'll paste the config below so you'll understand what I'm trying to do. Thanks again!

ip prefix-list NETWORK_MATCH-111 seq 10 permit 111.111.111.111/32
ip prefix-list NETWORK_MATCH-222 seq 10 permit 222.222.222.222/32


route-map BGP-TO-OSPF-IN-3 permit 10
match ip address prefix-list NETWORK_MATCH-111
set metric 100
match ip address prefix-list NETWORK_MATCH-222
set metric 200
match ip address prefix-list NETWORK_MATCH

redistribute bgp 65003 metric-type 1 subnets route-map BGP-TO-OSPF-IN-3

 

7 Replies 7

Hello,

Can you clarify what doesnt work exactly?

Do the routes get redistributed but not with the intended metric? - iBGP learned routes don't get redistributed into IGPs be default. You need to issue the bgp redistribute-internal command under the bgp process

Do they not get redistributed at all? The config looks like it'll work. Can you provide the output of the following commands:

show ip route

show ip bgp

and the configuration of both protocols.

 

-David

Hey David.... I'm redistributing from BGP into OSPF. I'm setting the BGP routes redistributed into ospf as external type-1 routes. In this redistribution I'm trying to set the metric of 111.111.111.111 to 100 and the metric of 222.222.222.222 to 200. This is not working. For some reason the metric for both routes is being set to 200. Do you know if you can set the metric of one route to one value and the metric of another route to a different route to a different value when redistributing from BGP to OSPF? I'm using a route map in the redistribute bgp command with the following config:

ip prefix-list NETWORK_MATCH-111 seq 10 permit 111.111.111.111/32
ip prefix-list NETWORK_MATCH-222 seq 10 permit 222.222.222.222/32


route-map BGP-TO-OSPF-IN-3 permit 10
match ip address prefix-list NETWORK_MATCH-111
set metric 100
match ip address prefix-list NETWORK_MATCH-222
set metric 200
match ip address prefix-list NETWORK_MATCH

redistribute bgp 65003 metric-type 1 subnets route-map BGP-TO-OSPF-IN-3

Hello @modular182 ,

>> For some reason the metric for both routes is being set to 200

The explanation has been provided by @paul driver your configuration of the route-map is not correct and you need to use multiple route-map clauses blocks to achieve the desired behaviour.

With your current config all routes coming from BGP have seed metric 200 , because that is the last set command in your route-map and it overrides the previous one.

Hope to help

Giuseppe

 

And to answer your question, the routes being learned by BGP from the next hop router are eBGP.

M02@rt37
VIP
VIP

Hello @modular182,

111.111.111.111/32 and 222.222.222.222/32 are host learn from BGP? Or are there Loopbacks configured on your Router where you want to configure the redis. ?

 

Best regards
.ı|ı.ı|ı. If This Helps, Please Rate .ı|ı.ı|ı.

Hello
Your route-map isnt vaible, you need to create addtional clauses to accomodate the different matching acls

Example:
route-map BGP-TO-OSPF-IN-3 permit 10
match ip address prefix-list NETWORK_MATCH-111
set metric 100

route-map BGP-TO-OSPF-IN-3 permit 20
match ip address prefix-list NETWORK_MATCH-222
set metric 200

route-map BGP-TO-OSPF-IN-3 permit 99


Please rate and mark as an accepted solution if you have found any of the information provided useful.
This then could assist others on these forums to find a valuable answer and broadens the communityā€™s global network.

Kind Regards
Paul

Hi

I Send you private message 

Review Cisco Networking for a $25 gift card