Redistribute routes tagged with a special BGP community

Hi,

I am trying to redistribute over a specific BGP session, all the routes I learn from an IXP.

I created the following filters in order to tag the learnt routes from that IXP:

/routing filter
(...)
add action=accept append-bgp-communities=35600:100 chain=EQUINIX-IN comment="Add BGP communitie MYASN:100 to peering routes" set-bgp-local-pref=400 set-bgp-med=10 set-route-comment=EQUINIX

That works well, as we can see on the output below:

 0 ADb  ;;; EQUINIX
        dst-address=37.64.0.0/13 gateway=195.42.144.66 gateway-status=195.42.144.66 reachable via  vlan-equinix-peering distance=20 scope=40 target-scope=10 bgp-as-path="15557,15557" 
        bgp-local-pref=400 bgp-med=10 bgp-origin=igp bgp-communities=MYASN:100 received-from=peering-eqx-sfr-ipv4

In order to reannounce those tagged routes, I created the following routing filter:

/routing filter
(...)
add action=accept bgp-communities=MYASN:100 chain=IXPTRANSIT-OUT comment="Reannounce prefixes with BGP community MYASN:100"
add action=discard chain=IXPTRANSIT-OUT

I applied that filter to the BGP session on which I’d like to reannounce the routes learnt, but my RB does not reannounce anything (even if I remove the discard action in my IXPTRANSIT-OUT routing filter).

Is there someting I am missing ?

I am using a CCR1036-12G-4S with 6.20.

Thanks for your help!

Anyone has a hint for me ? :frowning:

I already redistribute some routes using some prefix match, but that’s not quite enough…

Could you post the configuration for the neighbors you are redistributing this to?

Hi blake,

Here is the BGP config:

add comment="xxx" disabled=yes in-filter=CUST-IN instance=Vedege name=transitpartial-xxx-ipv4-eqx out-filter=IXPTRANSIT-OUT remote-address=185.56.xxx.xx remote-as=NNNN ttl=default

Regards,

Acontios

(of course, it is not disabled when I run the tests :slight_smile:)

Is your Equinix peer in the same BGP instance?

Do you mind posting the config of both neighbor sessions, and associated filters?

Hi,

Both BGP sessions are in the same instance. I do not have any other instance running, the default one is disabled.

Here is a more complete extract of the config (I didnt paste the whole Equinix sessions, just 3 for the example):
MYPREFIX#n and MYCUSTPREFIX#n are real IP networks on the config, same for MYASN or MYCUSTASN which are real 16bit ASN

/routing bgp instance
set default disabled=yes
add as=MYASN client-to-client-reflection=no name=Vedege redistribute-other-bgp=yes router-id=194.117.xxx.xxx

/routing filter
add action=accept append-bgp-communities=MYASN:100 chain=EQUINIX-IN comment="Add BGP communitie MYASN:100 to peering routes" set-bgp-local-pref=400 set-bgp-med=10 set-route-comment=EQUINIX
add action=accept chain=EQUINIX-OUT prefix=MYPREFIX#1 prefix-length=23
add action=accept chain=EQUINIX-OUT prefix=MYPREFIX#2 prefix-length=22
add action=discard chain=EQUINIX-OUT
(...)
add action=accept append-bgp-communities=MYASN:5000 chain=CUST-IN comment="Accept route #1 from AW, and set 600 for localpref, and append MYASN:5000 community" prefix=MYCUSTPREFIX#1 set-bgp-local-pref=600
add action=accept append-bgp-communities=MYASN:5000 chain=CUST-IN comment="Accept route #2 from AW, and set 600 for localpref, and append MYASN:5000 community" prefix=MYCUSTPREFIX#2 set-bgp-local-pref=600
add action=accept append-bgp-communities=MYASN:5000 chain=CUST-IN comment="Accept route #3 from AW, and set 600 for localpref, and append MYASN:5000 community" prefix=MYCUSTPREFIX#3 set-bgp-local-pref=600
add action=discard chain=CUST-IN comment="Deny any at the end"
add action=accept append-bgp-communities="" bgp-communities=MYASN:100 chain=IXPTRANSIT-OUT comment="Reannounce prefixes with BGP community MYASN:100" match-chain=""
add action=discard chain=IXPTRANSIT-OUT


/routing bgp peer
add comment="Peering Equinix HE IPv4" in-filter=EQUINIX-IN instance=Vedege max-prefix-limit=100000 max-prefix-restart-time=15m name=peering-eqx-he-ipv4 out-filter=EQUINIX-OUT remote-address=195.42.144.104 remote-as=6939 ttl=default
add comment="Peering Equinix Widevoip IPv4" in-filter=EQUINIX-IN instance=Vedege max-prefix-limit=100 max-prefix-restart-time=15m name=peering-eqx-widevoip-ipv4 out-filter= EQUINIX-OUT remote-address=195.42.144.16 remote-as=42456 ttl=default
add comment="Peering Equinix Renater IPv4" in-filter=EQUINIX-IN instance=Vedege max-prefix-limit=1000 max-prefix-restart-time=15m name=peering-eqx-renater-ipv4 out-filter=EQUINIX-OUT remote-address=195.42.145.38 remote-as=2200 tcp-md5-key=xxxxxxxxx ttl=default
(...)
add comment="Transit partial Cust" in-filter=CUST-IN instance=Vedege name=transitpartial-aw-ipv4 out-filter=IXPTRANSIT-OUT remote-address=185.56.xx.xx  remote-as=MYCUSTASN ttl=default

We do something similar, tag communities (append) on inbound routes, and use this info in filters to outbound routes .

one thing I have noticed is that when you append communities, e.g. a route has multiple communities on it, the MT filters don’t work…

However, this is not a problem if you are not appending but replacing communities (i.e. only one community tag on the route)

But what gets even more interesting is that, if your filters are setup to use two parameters to identify the route, (e.g. prefix & bgp-communities or AS# and Communities.) then the filters work correctly (with the multiple community tags on the route).

We have had to become creative in working around this…
BTW, I see you are tagging your route with a Comment… you can use that in your filter as well, not elegant, but it will work.

Hi faisali, thanks for your reply !

So, it seems that we have a bug there ?

I have tried to change the filters with the following:

- add action=accept append-bgp-communities=MYASN:100 chain=EQUINIX-IN comment="Add BGP communitie 35600:100 to peering routes" set-bgp-local-pref=400 set-bgp-med=10 set-route-comment=EQUINIX
+ add action=accept chain=EQUINIX-IN comment="Set BGP communitie 35600:100 to peering routes" set-bgp-communities=MYASN:100 set-bgp-local-pref=400 set-bgp-med=10 set-route-comment=EQUINIX

… still no effects…

Will try others “dual match”…

Does not match either with dual matches:

     chain=IXPTRANSIT-OUT  match-chain="" route-comment=EQUINIX bgp-communities=MYASN:100 invert-match=no action=accept set-bgp-prepend-path="" append-bgp-communities=""

Could you please show me a sample of your conf ?
This is driving me crazy…

Needless to say it a bit ‘wonky’…

I had to play with it… (Took a bit of patience :slight_smile: )

  1. if you are going to use Route Comment, then just use Route Comment, and not communities, in your filter.

  2. Make sure that the route is active on your router, that you are advertising from.

I had a couple of more options available to select the routes.

e.g. ASN on the peering fabric
chain=xx-mia-out bgp-as-path=^12345_* bgp-communities=“” invert-match=no
action=accept set-bgp-prepend-path=“” append-bgp-communities=“”

Hi,

When trying to match route comment, it does not work either.
Can anyone paste me a sample of config with that ?

I cannot match with just ASN, because there are many routes from differents ASN that I want to redistribute.

How the hell it it possible that such a simple thing is not working ?!?

add action=accept append-bgp-communities="" bgp-communities=MYASN:100 chain=IXPTRANSIT-OUT comment="Reannounce prefixes with BGP community MYASN:100" match-chain=""

I think the issue is that your appending a blank community in the same filter rule as your match. I seem to remember having a similar issue once before. Try changing this to set-bgp-communities=“” if the desired action is to remove the community before advertizing it. If that still doesn’t work you could use the match rules to jump into a chain with one rule to accept and remove the community.

So, did anyone figure this out in the end?

While setting up a new CCR1015-12G (running 6.38.1) for a client, I seem to be running into a variant(?) of this.

What I’m doing is very simple and done fairly frequently in Carrier networking. Learn routes from upstream, tag them with ASN:, and then match that tag when sending the route to another peer.

Good news (at least in my case) is that it seems to partially work, but seems to ignore prefixes (with completely same/similar attributes) at random. I tried the comment hack posted, matches the same routes…

Is the MT filtering implementation really this wonky? =/