b258540d624d7c793efad7d8dc32f2de449d332b
howto/Bird-communities.md
... | ... | @@ -11,7 +11,7 @@ Below, you will see an example config for peers4 based on the original filter im |
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 | |
13 | 13 | ## BGP community criteria |
14 | -``` |
|
14 | +```conf |
|
15 | 15 | (64511, 1) :: latency \in (0, 2.7ms] |
16 | 16 | (64511, 2) :: latency \in (2.7ms, 7.3ms] |
17 | 17 | (64511, 3) :: latency \in (7.3ms, 20ms] |
... | ... | @@ -46,7 +46,7 @@ Two utilities which measure round trip time and calculate community values autom |
46 | 46 | |
47 | 47 | **Note: In general, the link latency metric only reflects the latency of the *immediate* link, and not the overall latency from following a path**. A route may traverse multiple internal routers once it enters an AS, and because this is invisible to BGP, it's best to treat latency values as informational only and not use them to make routing decisions. |
48 | 48 | |
49 | -``` |
|
49 | +```sh |
|
50 | 50 | $ ruby bgp-community.rb --help |
51 | 51 | USAGE: bgp-community.rb host mbit_speed unencrypted|unsafe|encrypted|pfs |
52 | 52 | -6, --ipv6 Assume ipv6 for ping |
... | ... | @@ -67,7 +67,7 @@ There are two type of route origin: `region` and `country` |
67 | 67 | The range `41-70` is assigned to the region property. |
68 | 68 | The communities for route origin region were first defined in [December 2015](https://lists.nox.tf/pipermail/dn42/2015-December/001259.html) and further extended in [May 2022](https://groups.io/g/dn42/topic/91226190): |
69 | 69 | |
70 | -``` |
|
70 | +```conf |
|
71 | 71 | (64511, 41) :: Europe |
72 | 72 | (64511, 42) :: North America-E |
73 | 73 | (64511, 43) :: North America-C |
... | ... | @@ -90,7 +90,7 @@ The communities for route origin region were first defined in [December 2015](ht |
90 | 90 | #### Country |
91 | 91 | The range `1000-1999` is assigned to the country property. Here we use [ISO-3166-1 numeric](https://github.com/lukes/ISO-3166-Countries-with-Regional-Codes/blob/master/all/all.csv) country codes, adding `1000` to each value to get the country origin community: |
92 | 92 | |
93 | -``` |
|
93 | +```conf |
|
94 | 94 | (64511, 1124) :: Canada |
95 | 95 | (64511, 1156) :: China |
96 | 96 | (64511, 1158) :: Taiwan |
... | ... | @@ -105,9 +105,9 @@ The range `1000-1999` is assigned to the country property. Here we use [ISO-3166 |
105 | 105 | (64511, 1756) :: Switzerland |
106 | 106 | (64511, 1826) :: United Kingdom |
107 | 107 | (64511, 1840) :: United States of America |
108 | -# etc. Please follow the ISO-3166-1 Numeric standard |
|
109 | -# https://github.com/lukes/ISO-3166-Countries-with-Regional-Codes/blob/master/all/all.csv |
|
110 | 108 | ``` |
109 | +etc. Please follow the ISO-3166-1 Numeric standard |
|
110 | +<https://github.com/lukes/ISO-3166-Countries-with-Regional-Codes/blob/master/all/all.csv>. |
|
111 | 111 | |
112 | 112 | You need to add following lines to your config(s): |
113 | 113 | - `define DN42_REGION = $VALUE_FROM_ABOVE` to your node's config (where OWNAS and OWNIP are set) |
... | ... | @@ -118,7 +118,7 @@ just above `update_flags` in `dn42_export_filter` function |
118 | 118 | |
119 | 119 | |
120 | 120 | ## Example configurations |
121 | -``` |
|
121 | +```conf |
|
122 | 122 | # /etc/bird/peers4/tombii.conf |
123 | 123 | protocol bgp tombii from dnpeers { |
124 | 124 | neighbor 172.23.102.x as 4242420321; |
... | ... | @@ -126,7 +126,7 @@ protocol bgp tombii from dnpeers { |
126 | 126 | export where dn42_export_filter(3,24,33); |
127 | 127 | }; |
128 | 128 | ``` |
129 | -``` |
|
129 | +```conf |
|
130 | 130 | #/etc/bird/community_filters.conf |
131 | 131 | function update_latency(int link_latency) { |
132 | 132 | bgp_community.add((64511, link_latency)); |
... | ... | @@ -193,11 +193,9 @@ function dn42_export_filter(int link_latency; int link_bandwidth; int link_crypt |
193 | 193 | } |
194 | 194 | reject; |
195 | 195 | } |
196 | - |
|
197 | 196 | ``` |
198 | 197 | Please remember to include /etc/bird/community_filters.conf in your bird.conf/birdc6.conf |
199 | -``` |
|
200 | - |
|
198 | +```conf |
|
201 | 199 | # local configuration |
202 | 200 | ###################### |
203 | 201 | include "bird/local4.conf"; |