10-30-2022 07:44 PM - edited 10-30-2022 07:51 PM
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)
10-30-2022 10:55 PM - edited 10-30-2022 11:16 PM
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,
10-31-2022 12:41 AM
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.
10-31-2022 06:52 AM - edited 10-31-2022 07:02 AM
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,
10-31-2022 07:04 AM
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.
10-30-2022 11:14 PM - edited 10-31-2022 03:18 AM
"""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.
10-31-2022 10:30 AM - edited 10-31-2022 10:31 AM
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
10-31-2022 01:06 AM - edited 10-31-2022 01:06 AM
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
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