howto/Bird-communities.md
... ...
@@ -4,9 +4,9 @@ Communities can be used to prioritize traffic based on different flags, in DN42
4 4
5 5
The community is applied to the route when it is imported and exported, therefore you need to change your bird configuration, in /etc/bird/peers4 if you followed the [Bird](/howto/Bird) guide.
6 6
7
-The calculations for finding the best route can be stored in a separate file, for example /etc/bird/community_filters.conf.
7
+The filter helpers can be stored in a separate file, for example /etc/bird/community_filters.conf.
8 8
9
-Below, you will see an example config for peers4 as well as the and the suggested improvement by tombii (prefers low latency) to original filter implementation by Jplitza (prefers high BW over low latency).
9
+Below, you will see an example config for peers4 based on the original filter implementation by Jplitza without any bgp_local_pref calculation. An example with bgp_local_pref calculation can also be found below.
10 10
11 11
To properly assign the right community to your peer, please reference the table below. If you are running your own network and peering internally, please also apply the communities inside your network.
12 12
... ...
@@ -104,7 +104,6 @@ latency = update_latency(link_latency);
104 104
bandwidth = update_bandwidth(link_bandwidth) - 20;
105 105
crypto = update_crypto(link_crypto) - 30;
106 106
if bandwidth > 4 then bandwidth = 4;
107
-bgp_local_pref = 10000+100*bandwidth + 50*(10-latency)-200*bgp_path.len+100*crypto;
108 107
return true;
109 108
}
110 109
```
... ...
@@ -120,6 +119,14 @@ include "/etc/bird/community_filters.conf";
120 119
121 120
***
122 121
122
+### Bird bgp_local_pref calculation
123
+If you are running a bigger network and also want to prioritize your traffic based on the communities, then you can look at the following below:
124
+bgp_local_pref = 10000+100*bandwidth + 50*(10-latency)-200*bgp_path.len+100*crypto; (as suggested by tombii)
125
+
126
+bgp_local_pref = 1000*bandwidth - 10*latency; if crypto < 2 then bgp_local_pref = 0; (as suggested by Jplitza)
127
+
128
+These go into the /etc/bird/community_filters.conf just above the return true; line. However for starters I recommend to stick with the above, simpler implementation with assigning community flags to your peerings to have a smarter routing in dn42 in total.
129
+
123 130
Original implementation by Jplitza: https://gist.github.com/welterde/524cc9b37a618e29093d
124 131
125 132
All props to him for the bird code based on the suggestion from welterde.