08-02-2023 08:49 PM
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
08-02-2023 10:20 PM
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
08-02-2023 10:26 PM
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
08-03-2023 02:28 AM
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
08-02-2023 10:28 PM
And to answer your question, the routes being learned by BGP from the next hop router are eBGP.
08-02-2023 10:23 PM - edited 08-02-2023 10:24 PM
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. ?
08-03-2023 02:18 AM
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
08-11-2023 07:30 AM
Hi
I Send you private message
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide