Community discussions

MikroTik App
 
Shawn2012
just joined
Topic Author
Posts: 7
Joined: Thu Apr 26, 2012 3:41 pm

BGP Traffic Manipulation

Tue Aug 25, 2015 6:35 pm

It was supposed to do the job, but it seemed not.

Two BGP peers with full routing table on one router CCR1036.

Purpose: Peer1 is preferable path for incoming and outgoing traffic.
Peer2 is less preferable.

I have tried to set AS Prepend on Peer2 to make Rx (incoming traffic) less preferable path. However, no matter what AS Prepend number I tried, 5, 10, and 15, it seems no difference. Rx is still more than Rx on Peer1.

Notes: after the filter modified, I did run /routing BGP peer refresh (peername).
The upstream did see more my AS numbers.

Second, I tried to set either Weight or Local Preference higher on Peer1 for sending traffic preferable path, seems less effects either.

Questions:

In order to receive full routing table, what is a correct in-filter?

Prefix 0.0.0.0/0 without prefix length accept
Prefix 0.0.0.0/0 with prefix length 0 accept

which one is correct? or something else?

Set Weight or Set Local Preference in which filter, in-filter or out-filter?

I think I was on right track, but it seemed not working.

Really appreciate it if you could help.

Shawn
 
tirkitneth
newbie
Posts: 31
Joined: Wed Nov 06, 2013 9:17 pm

Re: BGP Traffic Manipulation

Wed Aug 26, 2015 12:49 pm

Hello
I have tried to set AS Prepend on Peer2 to make Rx (incoming traffic) less preferable path. However, no matter what AS Prepend number I tried, 5, 10, and 15, it seems no difference. Rx is still more than Rx on Peer1.

Notes: after the filter modified, I did run /routing BGP peer refresh (peername).
The upstream did see more my AS numbers.
Even if prepend is working correctly, you have little control on how people send traffic to your AS.
They can override your prepend with their weight/local-pref. It is also possible that the people sending traffic to you only have peer2 as upstream.

In order to receive full routing table, what is a correct in-filter?
If you want to receive every prefix that your peer advertises, than do not use a filter or do not set any prefix related parameters in the filter.
You might want to deny some prefixes to protect your network from misconfigurations though (eg: filter martians/bogons networks, your own IP ranges, etc.).
Set Weight or Set Local Preference in which filter, in-filter or out-filter?
Weight and local preference are set when you receive routes from a peer, so it is defined in an in-filter.
For example:
/routing bgp peer
add in-filter=peer1-in name=peer1 remote-address=10.0.0.1 remote-as=100
/routing filter
add chain=peer1-in set-bgp-local-pref=200

[admin@MikroTik] /routing> /ip route print detail
Flags: X - disabled, A - active, D - dynamic, C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme, B - blackhole, U - unreachable, P - prohibit
 0 ADC  dst-address=10.0.0.0/24 pref-src=10.0.0.2 gateway=ether3 gateway-status=ether3 reachable distance=0 scope=10

 1 ADb  dst-address=192.168.2.0/24 gateway=10.0.0.1 gateway-status=10.0.0.1 reachable via  ether3 distance=20 scope=40 target-scope=10 bgp-as-path="100" bgp-local-pref=200 bgp-med=0 bgp-origin=igp received-from=peer1

 2 ADb  dst-address=192.168.87.0/24 gateway=10.0.0.1 gateway-status=10.0.0.1 reachable via  ether3 distance=20 scope=40 target-scope=10 bgp-as-path="100" bgp-local-pref=200 bgp-med=0 bgp-origin=igp received-from=peer1

 3 ADb  dst-address=192.168.122.0/24 gateway=10.0.0.1 gateway-status=10.0.0.1 reachable via  ether3 distance=20 scope=40 target-scope=10 bgp-as-path="100" bgp-local-pref=200 bgp-med=0 bgp-origin=igp received-from=peer1
Weight and local-pref work the same way: routes with highest values are preferred.
However, weight is only local to the router. Local-pref is advertised to your iBGP peers.
 
User avatar
Cha0s
Forum Guru
Forum Guru
Posts: 1161
Joined: Tue Oct 11, 2005 4:53 pm

Re: BGP Traffic Manipulation

Wed Aug 26, 2015 1:05 pm

Instead of Prepends you can use MED (Multi Exit Discrimator) to control incoming traffic - if your rest of your configuration allows for it.

In this talk he describes the use of MED on slides 26-28
http://mum.mikrotik.com/presentations/G ... _Nikos.pdf

Useful info
http://wiki.mikrotik.com/wiki/Manual:BG ... _Algorithm
http://wiki.mikrotik.com/wiki/Manual:Routing/BGP
 
Shawn2012
just joined
Topic Author
Posts: 7
Joined: Thu Apr 26, 2012 3:41 pm

Re: BGP Traffic Manipulation

Thu Aug 27, 2015 9:27 pm

Thank you very much, Tirkitneth, for your more clear concept.

I will remove the prefix 0.0.0.0/0 and prefix length 0 in in-filter, and set weight or local preference to try.
 
Shawn2012
just joined
Topic Author
Posts: 7
Joined: Thu Apr 26, 2012 3:41 pm

Re: BGP Traffic Manipulation

Thu Aug 27, 2015 9:36 pm

Thanks, Cha0s, another way to do it.

Who is online

Users browsing this forum: vaughn and 32 guests