Community discussions

MikroTik App
 
supermega
just joined
Topic Author
Posts: 21
Joined: Sun Sep 25, 2011 8:06 pm

BGP prepend filters - Can I prepend input with own AS?

Wed Oct 11, 2023 4:04 pm

In v6 you could set set-bgp-prepend (https://wiki.mikrotik.com/wiki/Manual:R ... ng_filters) to prepend AS Path with router's own AS number in both input and output filters.

In v7 you have settings:
1. bgp-path-peer-prepend - prepends with peer's AS, works only in input
2. bgp-path-prepend - prepends with router's own AS, works only in output

I need to prepend AS Path of imported prefixes with router's own AS. How to do it? Why bgp-path-prepend doesn't work in input (v7.11.2)?
Last edited by supermega on Wed Oct 11, 2023 6:37 pm, edited 1 time in total.
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7056
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: BGP prepend filters - Can I prepend input with own AS?

Wed Oct 11, 2023 4:13 pm

Because BGP adds its own ASN only when sending routes to remote peers (so prepending own as is possible only in output).
By adding local as in input you are deliberately "saying" that those routes are looped, you might as well just reject the routes.
 
supermega
just joined
Topic Author
Posts: 21
Joined: Sun Sep 25, 2011 8:06 pm

Re: BGP prepend filters - Can I prepend input with own AS?

Wed Oct 11, 2023 6:01 pm

Do you suggest that the solution is impossible, even though it works on Linux and Mikrotik v6?

I don't know the internals of Mikrotik v7 BGP, but it lacks functionality.

The problem is that in AS Path "AS3 AS2 AS2 AS2 AS1" you can't tell which of "AS2 AS2 AS2" was added by the AS2 router in output and which by the AS3 router in input, so basically, you don't know what router prepends AS Path.
 
pe1chl
Forum Guru
Forum Guru
Posts: 10248
Joined: Mon Jun 08, 2015 12:09 pm

Re: BGP prepend filters - Can I prepend input with own AS?

Wed Oct 11, 2023 6:17 pm

Because BGP adds its own ASN only when sending routes to remote peers (so prepending own as is possible only in output).
By adding local as in input you are deliberately "saying" that those routes are looped, you might as well just reject the routes.
No, the purpose of prepending own AS on received routes is to artificially increase the number of hops for one of the paths.
So the prepending is to be done AFTER it has been checked to be a loop.
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7056
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: BGP prepend filters - Can I prepend input with own AS?

Wed Oct 11, 2023 8:09 pm

the purpose of prepending own AS on received routes is to artificially increase the number of hops
For that bgp-path-peer-prepend exists
The problem is that in AS Path "AS3 AS2 AS2 AS2 AS1" you can't tell which of "AS2 AS2 AS2" was added by the AS2 router in output and which by the AS3 router in input, so basically, you don't know what router prepends AS Path.
Don't get your point, how prepending in input would allow to determine which router prepended AS2? AS path is a list of ASNs there is no extra info to determine such things.
 
supermega
just joined
Topic Author
Posts: 21
Joined: Sun Sep 25, 2011 8:06 pm

Re: BGP prepend filters - Can I prepend input with own AS?

Thu Nov 09, 2023 8:42 pm

To me prepending with own AS is normal action.

To me AS Path "AS3 AS2 AS2 AS2 AS1" means that AS2 router prepended itself 3 times, either in the input or output, so that's the router I need to check to change prepend settings. That's how I use Linux (bird) and RouterOS v6. That doesn't work on RouterOS v7, because on v7 prepending in the output on AS2 router results in same AS Path as prepending in the input on AS3 router.

I don't understand the idea of prepending with peer AS but if someone uses it that's OK. Just why "bgp-path-prepend" does nothing in input filters?
 
supermega
just joined
Topic Author
Posts: 21
Joined: Sun Sep 25, 2011 8:06 pm

Re: BGP prepend filters - Can I prepend input with own AS?

Thu Dec 28, 2023 12:36 pm

Also "bgp-path-peer-prepend" works with "+", while "bgp-path-prepend" doesn't.

I request fixing "bgp-path-prepend" so it can be set in input filters and it accepts values with "+" (relative to current default setting which is "bgp-path-prepend 0" in input and "bgp-path-prepend 1" in output).

Who is online

Users browsing this forum: No registered users and 4 guests