Community discussions

MikroTik App
 
PandemiK
just joined
Topic Author
Posts: 4
Joined: Sat Feb 04, 2012 9:58 am

Remove private ASes with BGP

Mon Jun 04, 2018 6:30 pm

Hello,
I'm receiving some mis-configured routes on IXes with AS-PATH containing private ASes (64512-65534).
Thoses routes should be cleared on level higher that me in a perfect world but we're in the real world.

I would like to NOT reannounce those routes with such AS-PATH.

Is there a way with routeuros to remove those ASes from the AS-PATH ?
I tried to set remove-private-as to on for a few peers but I'm still getting the private ASes and re-announcing them.

My goal is to have the same behavior as :
https://www.cisco.com/c/en/us/support/d ... 58-36.html

Thanks,
Julien Escario
 
sri2007
Member Candidate
Member Candidate
Posts: 206
Joined: Wed May 20, 2015 10:14 pm
Location: Lake Grove, NY

Re: Remove private ASes with BGP

Tue Jun 05, 2018 7:53 pm

Yes there is an option who removes the private AS:
remove-private-as (yes | no; Default: no) If set, then BGP AS-PATH attribute is removed before sending out route update if attribute contains only private AS numbers.
removal process happens before routing filters are applied and before local AS

number is prepended to the AS path. Option is available starting from v4.3. Currently works only with 16-bit ASNs.
You can check more information about BGP here:

https://wiki.mikrotik.com/wiki/Manual:Routing/BGP
 
PandemiK
just joined
Topic Author
Posts: 4
Joined: Sat Feb 04, 2012 9:58 am

Re: Remove private ASes with BGP

Wed Jun 06, 2018 12:22 pm

Thanks for the idea but : "if attribute contains only private AS numbers"

This is not the case here : AS-PATH contains private ASes but there's public AS before and/or after.

I think this is why my routes aren't 'sanitized'.

Finally, I think I'll just drop those routes instead of trying to remove the private AS from the AS-PATH. They can be considered as bogons and it seems to be a common good practices. (see http://as2914.net/bogon_asns/configuration_examples.txt from Job Snijders - NTT).

Now, I have to find howto filter a route containing a range of AS (64496-64511 for example) without having to specify each AS in the regex.
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7053
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Remove private ASes with BGP

Mon Jun 11, 2018 2:45 pm

The following conditions apply for remove-private-as:
* You can only use this solution with external BGP (eBGP) peers.
* If the update has only private AS numbers in the AS_PATH,
BGP removes these numbers.
* If the AS_PATH includes both private and public AS numbers,
BGP doesn't remove the private AS numbers. This situation is
considered a configuration error.
* If the AS_PATH contains the AS number of the eBGP neighbor,
BGP does not remove the private AS number.
* If the AS_PATH contains confederations, BGP removes the private
AS numbers only if they come after the confederation portion of
the AS_PATH.
 
PandemiK
just joined
Topic Author
Posts: 4
Joined: Sat Feb 04, 2012 9:58 am

Re: Remove private ASes with BGP

Mon Jun 11, 2018 4:00 pm

Hello,
I finally managed to DISCARD AS-PATH containing private AS with rules behind.
They are directly taken from Cisco's examples here http://as2914.net/bogon_asns/configuration_examples.txt

This will create a bogons-asn filter that could be used with upsteams and peers to filter those buggy routes (a few Tier1 already filter those routes, you can safely consider them as buggy).

add action=accept bgp-as-path=_0_ chain=bogons-asn
add action=accept bgp-as-path=_23456_ chain=bogons-asn
add action=accept bgp-as-path="_(6449[6-9])_|_(6450[0-9])_|_(6451[0-1])_|_(655\
3[6-9])_|_(6554[0-9])_|_(6555[0-1])_" chain=bogons-asn
add action=accept bgp-as-path="_6(4(5(1[2-9]|[2-9][0-9])|[6-9][0-9][0-9])|5([0\
-4][0-9][0-9]|5([0-2][0-9]|3[0-5])))_" chain=bogons-asn
add action=accept bgp-as-path=\
"_6555[2-9]_|_655[6-9][0-9]_|_65[6-9][0-9][0-9]_|_6[6-9][0-9][0-9][0-9]_" \
chain=bogons-asn
add action=accept bgp-as-path="_[7-9][0-9][0-9][0-9][0-9]_|_1[0-2][0-9][0-9][0\
-9][0-9]_|_130[0-9][0-9][0-9]_" chain=bogons-asn
add action=accept bgp-as-path="_1310[0-6][0-9]_|_13107[0-1]_" chain=\
bogons-asn
add action=accept bgp-as-path="_42[0-8][0-9][0-9][0-9][0-9][0-9][0-9][0-9]_" \
chain=bogons-asn
add action=accept bgp-as-path="_(429[0-3][0-9][0-9][0-9][0-9][0-9][0-9])_|_(42\
94[0-8][0-9][0-9][0-9][0-9][0-9])_" chain=bogons-asn
add action=accept bgp-as-path=\
"_(42949[0-5][0-9][0-9][0-9][0-9])_|_(429496[0-6][0-9][0-9][0-9])_" \
chain=bogons-asn
add action=accept bgp-as-path=\
"_(4294967[0-1][0-9][0-9])_|_(42949672[0-8][0-9])_|_(429496729[0-4])_" \
chain=bogons-asn

Who is online

Users browsing this forum: No registered users and 44 guests