cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1454
Views
40
Helpful
7
Replies

Redistribute BGP into OSPF

Gavin.Lawson
Level 1
Level 1

Hi, I have a strange behavior where the route tag is changing when I'm redistributing from BGP to OSPF.

The Tag in the BGP route is 4290090134 (Which is the BGP AS# that the route was learnt from),

but when I redistribute the route to OSPF the Tag changes to 3489725495.

Any idea why it changes, or how to keep the tag at 4290090134 (Without setting it in the route-map)

7 Replies 7

Harold Ritter
Level 12
Level 12

Hi @Gavin.Lawson ,

Looking at the tag value (3489725495), it appears that you are using ospf as a PE-CE protocol and that the core ASN would be 64567. This tag value is automatically generated and mandatory according to RFC4577 section 4.2.5.2.

https://datatracker.ietf.org/doc/html/rfc4577#section-4.2.5.2

Note that the purpose of this tag is to make sure that other PEs will not redistribute routes received from OSPF back into BGP.  So, changing this default behaviour might cause routing loop issues.

Regards,

Harold Ritter
Sr Technical Leader
CCIE 4168 (R&S, SP)
harold@cisco.com
México móvil: +52 1 55 8312 4915
Cisco México
Paseo de la Reforma 222
Piso 19
Cuauhtémoc, Juárez
Ciudad de México, 06600
México

Thanks Harold

It looks like this is the reason, even though there is no MPLS PE or CE routers.
 - Do you know how to disable this function.

Hi @Gavin.Lawson ,

If you are seeing that tag, it is that some ASBR has generated it and this router is most likely an MPLS PE. It might be that the external LSA that you see with that specific tag is being generated by another ASBR in that same OSPF domain. You will need to track the router originating that external LSA with the following command:

sh ip ospf data external <prefix>

 >  - Do you know how to disable this function.

As I mentioned in my initial response, it is not a good idea to disable or interfere with that automatic behaviour, as it might introduce a routing loop.

Regards,

Harold Ritter
Sr Technical Leader
CCIE 4168 (R&S, SP)
harold@cisco.com
México móvil: +52 1 55 8312 4915
Cisco México
Paseo de la Reforma 222
Piso 19
Cuauhtémoc, Juárez
Ciudad de México, 06600
México

My instructor @Harold Ritter  write 
"""As I mentioned in my initial response, it is not a good idea to disable or interfere with that automatic behaviour, as it might introduce a routing loop."""
that totally right, 

R1-BGP-R2-OSPF-R3-BGP-R1

without adjust tag
the bgp-into-ospf redistribute is done in R2 (boundary between OSPF and BGP), and the tag value is automatic add which is R1 AS-Number 

the R3 do OSPF-into-BGP redistribute, NOW the R3 advertise the route back to R1 
R1 see it AS-number in AS-path and reject this prefix 

with adjust tag
the bgp-into-ospf redistribute is done in R2 (boundary between OSPF and BGP), and the tag value is adjust with different value

the R3 do OSPF-into-BGP redistribute, NOW the R3 advertise the route back to R1 
R1 see prefix and since it AS-number is not list in AS-Path then it accept it 
here R1 can select this prefix from R3 even so it source of this prefix in first point.
here is LOOP 

and that why @Harold Ritter  mention it recommend to not adjust the value and keep it default automatic the AS prefix learn from.

"""The Tag in the BGP route is 4290090134 (Which is the BGP AS# that the route was learnt from),"""
just need to know more about this ?
"""the BGP as I know dont have tag attribute. """

I do LAB, BGP-into-OSPF is automatic add tag  equal to AS the prefix learn from 
but 
you can add route-map with redistribute bgp-into-ospf to adjust the tag 
set tag <value>

in my lab i set tag = 1000. 

 

fghfghgfhfgh.png

 

Hello @MHM Cisco World 
You could just use tag but then the origin will be lost, to advertise the tag and origin, use the automatic tag feature via the table map


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

Hello
By default when bgp is redistruted inbto ospf the ASN of the bgp router becomes the OSPF tag within ospf, however if/when OSPF is then redstrubted back into bgp then the originand as-path information is lost, using as bgp feature called "automatic-tag"  this Origin and ASN information is retained as such can negate route feedback, however within OPSF is now calcualted into from decinmal into Hexidecimal but a quick convertion of this hexidecimal back nto decimal will show the correct ASN of a bgp prefix.

Example
A BGP prefix is originated from ASN 100  which is restibrintued OSPF then that OSPF rtr is redadvertising this ospf route into another bgp process

RTR1 BGP/OSPF  <> RTR2 OSPF/BGP

BGP/OSPF rtr 1
route-map auto-tag
set automatic-tag

router bgp 100
table-map auto-tag filter

OSPF/BGP rtr2
sh ip bgp  | B N
Network                       Next Hop        Metric LocPrf   Weight         Path
*> 10.10.10.0/24       20.20.20.2                 1           32768         3489661028 i <----origin-------3489661028  into hex D0000064   last 4 bit of hex into decimal sow the correct ASA 0064 =100


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
Review Cisco Networking for a $25 gift card