cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3801
Views
4
Helpful
17
Replies

Redistribution from BGP to OSPF

rmv72
Level 1
Level 1

I've private AS connected to other private AS's via 2 routers. I received route at first router with as-path 3 and on the second with as-path 4(i've made it for influence traffic). But during redistribution to OSPF all as-path information will be lost. How to preserve that info and use it later in OSPF domain for managing routes?

1 Accepted Solution

Accepted Solutions

Ah well, you never said you wanted to do anything with them :)

If you want to set metrics you are better doing it when you redistribute - on the 7200 in our example. So you still use the as-paths to identify the relevant routes but then just set the metric you need.

Jon

View solution in original post

17 Replies 17

royalblues
Level 10
Level 10

You can always modify the metric while redistributing so that one router is always preferred inside your ospf domain

Narayan

Jon Marshall
Hall of Fame
Hall of Fame

Hi

I've just checked this in our lab. The as-path information is preserved as a tag automatically for you. To see this do a

sh ip route "IP subnet" "subnet mask"

on an OSPF route redistributed from BGP and you will see the tag.

You can then use a route-map to match these tags and apply whatever policies you want to them.

Jon

Hi

Position tag shows me only last AS number ( Tag 65334)-

pdc-cat6506-obs# sh ip route 10.20.9.0

Routing entry for 10.20.9.0/24

Known via "ospf 1", distance 110, metric 1

Tag 65334, type extern 2, forward metric 1

Last update from 9.9.9.2 on GigabitEthernet5/1, 18:19:09 ago

Routing Descriptor Blocks:

* 9.9.9.2, from 172.22.21.222, 18:19:09 ago, via GigabitEthernet5/1

Route metric is 1, traffic share count is 1

Route tag 65334

pdc-cat6506-obs# sh ip route 10.20.16.0

Routing entry for 10.20.16.0/24

Known via "ospf 1", distance 110, metric 1

Tag 65334, type extern 2, forward metric 1

Last update from 9.9.9.2 on GigabitEthernet5/1, 18:19:22 ago

Routing Descriptor Blocks:

* 9.9.9.2, from 172.22.21.222, 18:19:22 ago, via GigabitEthernet5/1

Route metric is 1, traffic share count is 1

Route tag 65334

Here info from BGP table -

*> 10.20.9.0/24 2.2.2.100 0 65334 i

*> 10.20.16.0/24 2.2.2.201 0 65334 2854 65011 i

Ospf does not understand the attributes of bgp ,you1`d better use metric xx command when redistribute was configured

Should i use route policy during redistribution from bgp to ospf where i can match as-path and set metric?

Hi

This is exactly what i'm trying at the moment in the lab - can't seem to get it working just yet but there is a lot going on in my lab :)

I can't see why this wouldn't work though.

** Edit - okay just got it working, my mistake on the as-path access-list. So yes, you can do this on the router that redistributes between BGP and OSPF. **

Jon

Jon, can you post part of config for example?

Okay, i did not emulate your setup entirely so you will need to use regexs in your as-path access-lists.

R5 -> R1 -> 7200 -> R4

R5 is in BGP AS 20

R1 is in BGP AS 3

7200 is in BGP 10

R5 peers with R1, R1 peers with 7200 and 7200 uses OSPF to peer with R4.

The routes received by 7200 from R1

192.168.31.0 - as path 3

192.168.41.0 - as path 3 20 <-- this is the one we are setting tag of 200 on.

router ospf 10

log-adjacency-changes

redistribute bgp 10 subnets route-map MPL

network 172.16.22.0 0.0.0.255 area 0

!

router bgp 10

no synchronization

bgp log-neighbor-changes

network 10.9.1.0 mask 255.255.255.240

network 172.16.22.0 mask 255.255.255.0

neighbor 192.168.5.1 remote-as 3

no auto-summary

!

ip as-path access-list 2 permit 3 20

!

route-map MPL permit 10

match as-path 2

set tag 200

!

route-map MPL permit 20

Output from R4

R4#sh ip ro 192.168.31.0

Routing entry for 192.168.31.0/24

Known via "ospf 1", distance 110, metric 1

Tag 3, type extern 2, forward metric 1

Last update from 172.16.22.1 on FastEthernet0/1, 00:12:39 ago

Routing Descriptor Blocks:

* 172.16.22.1, from 192.168.6.2, 00:12:39 ago, via FastEthernet0/1

Route metric is 1, traffic share count is 1

Route tag 3

R4#sh ip ro 192.168.41.0

Routing entry for 192.168.41.0/24

Known via "ospf 1", distance 110, metric 1

Tag 200, type extern 2, forward metric 1

Last update from 172.16.22.1 on FastEthernet0/1, 00:13:04 ago

Routing Descriptor Blocks:

* 172.16.22.1, from 192.168.6.2, 00:13:04 ago, via FastEthernet0/1

Route metric is 1, traffic share count is 1

Route tag 200

HTH

Jon

And now i can have routes at R4 with different route tags. But how to use it is later? I mean how to convert Route tag to metric which can influence which route to use )?

Ah well, you never said you wanted to do anything with them :)

If you want to set metrics you are better doing it when you redistribute - on the 7200 in our example. So you still use the as-paths to identify the relevant routes but then just set the metric you need.

Jon

you would be better off configuring the metric while redistribution

Make sure the router that is setting the as-path prepend redistributes with a higher metric

Narayan

Narayan

After messing around in a lab with route-maps, as-path's etc. i came to the same conclusion as you. The fact that you got straight to the point while i went round the houses should tell me something :)

Jon

There is always something we get to learn when you play around in the lab. worth the time spent

I keep doing it all the time :-)

good day..

can i get to know your mail address

Narayan

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Innovations in Cisco Full Stack Observability - A new webinar from Cisco