Community discussions

MikroTik App
 
jjmuw
just joined
Topic Author
Posts: 5
Joined: Tue Dec 15, 2009 10:51 pm

BGP routing filter syntax

Fri Dec 18, 2009 12:14 am

Hello,

I'm fairly new to BGP and I want to make sure that these sorts of filters are what I'm looking for. Here's my scenario. I have a router with a lot of internal addresses and other sorts of routes that I don't want advertised upstream. On my peer configuration I have redistribute-static=no, redistribute-connected=no and all other redistribute options set to no. Currently, I have some "test" routers upstream that do receive my blocks correctly. I accomplished this by using network statements and configuring a routing filter as follows:

0 chain=ISP1 prefix=X.X.X.0/21 prefix-length=21-32 invert-match=no action=accept set-bgp-prepend=5

1 chain=ISP1 prefix=Y.Y.Y.0/21 prefix-length=21-32 invert-match=no action=accept set-bgp-prepend=5

2 chain=ISP1 invert-match=no action=discard

3 chain=ISP2 prefix=X.X.X.0/21 prefix-length=21-32 invert-match=no action=accept

4 chain=ISP2 prefix=Y.Y.Y.0/21 prefix-length=21-32 invert-match=no action=accept

5 chain=ISP2 invert-match=no action=discard

We have two upstream providers, and I want our path to "ISP1" to be seen as not preferred, and have ISP2 be the more attractive route to routers upstream. Am I correct in that these filters will suitably prevent any routes from being advertised by my router that do not fall under my x.x.x.0/21 and y.y.y.0/21 blocks, and that "ISP1" will have our AS number prepended 5 times to the AS path list?

Also, is the correct way to apply a BGP filter or am I taking the wrong approach?

Thank you in advance for any assistance.
 
changeip
Forum Guru
Forum Guru
Posts: 3833
Joined: Fri May 28, 2004 5:22 pm

Re: BGP routing filter syntax

Fri Dec 18, 2009 12:27 am

that looks right. be aware that prefixes within the /21 might get annouced with the 21-32 prefix length. other than that, it looks good.
 
changeip
Forum Guru
Forum Guru
Posts: 3833
Joined: Fri May 28, 2004 5:22 pm

Re: BGP routing filter syntax

Fri Dec 18, 2009 12:27 am

with redistribute no on all those you should only get the networks specifically in the networks list annouced.
 
jjmuw
just joined
Topic Author
Posts: 5
Joined: Tue Dec 15, 2009 10:51 pm

Re: BGP routing filter syntax

Fri Dec 18, 2009 12:44 am

Great, thanks!