paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1 | @c -*-texinfo-*- |
paul | 7190f4e | 2003-08-12 12:40:20 +0000 | [diff] [blame] | 2 | @c This is part of the Quagga Manual. |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 3 | @c @value{COPYRIGHT_STR} |
Paul Jakma | d5062d2 | 2015-12-02 16:47:43 +0000 | [diff] [blame] | 4 | @c Portions: |
| 5 | @c Copyright @copyright{} 2015 Hewlett Packard Enterprise Development LP |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 6 | @c See file quagga.texi for copying conditions. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7 | @node BGP |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8 | @chapter BGP |
| 9 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 10 | @acronym{BGP} stands for a Border Gateway Protocol. The lastest BGP version |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 11 | is 4. It is referred as BGP-4. BGP-4 is one of the Exterior Gateway |
| 12 | Protocols and de-fact standard of Inter Domain routing protocol. |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 13 | BGP-4 is described in @cite{RFC1771, A Border Gateway Protocol |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 14 | 4 (BGP-4)}. |
| 15 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 16 | Many extensions have been added to @cite{RFC1771}. @cite{RFC2858, |
| 17 | Multiprotocol Extensions for BGP-4} provides multiprotocol support to |
| 18 | BGP-4. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 19 | |
| 20 | @menu |
| 21 | * Starting BGP:: |
| 22 | * BGP router:: |
Paul Jakma | d5062d2 | 2015-12-02 16:47:43 +0000 | [diff] [blame] | 23 | * BGP MED:: |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 24 | * BGP network:: |
| 25 | * BGP Peer:: |
| 26 | * BGP Peer Group:: |
| 27 | * BGP Address Family:: |
| 28 | * Autonomous System:: |
| 29 | * BGP Communities Attribute:: |
| 30 | * BGP Extended Communities Attribute:: |
| 31 | * Displaying BGP routes:: |
| 32 | * Capability Negotiation:: |
| 33 | * Route Reflector:: |
| 34 | * Route Server:: |
| 35 | * How to set up a 6-Bone connection:: |
| 36 | * Dump BGP packets and table:: |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 37 | * BGP Configuration Examples:: |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 38 | @end menu |
| 39 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 40 | @node Starting BGP |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 41 | @section Starting BGP |
| 42 | |
| 43 | Default configuration file of @command{bgpd} is @file{bgpd.conf}. |
| 44 | @command{bgpd} searches the current directory first then |
| 45 | @value{INSTALL_PREFIX_ETC}/bgpd.conf. All of bgpd's command must be |
| 46 | configured in @file{bgpd.conf}. |
| 47 | |
| 48 | @command{bgpd} specific invocation options are described below. Common |
| 49 | options may also be specified (@pxref{Common Invocation Options}). |
| 50 | |
| 51 | @table @samp |
| 52 | @item -p @var{PORT} |
| 53 | @itemx --bgp_port=@var{PORT} |
| 54 | Set the bgp protocol's port number. |
| 55 | |
| 56 | @item -r |
| 57 | @itemx --retain |
| 58 | When program terminates, retain BGP routes added by zebra. |
Paul Jakma | d5062d2 | 2015-12-02 16:47:43 +0000 | [diff] [blame] | 59 | |
| 60 | @item -l |
| 61 | @itemx --listenon |
| 62 | Specify a specific IP address for bgpd to listen on, rather than its |
| 63 | default of INADDR_ANY / IN6ADDR_ANY. This can be useful to constrain bgpd |
| 64 | to an internal address, or to run multiple bgpd processes on one host. |
| 65 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 66 | @end table |
| 67 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 68 | @node BGP router |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 69 | @section BGP router |
| 70 | |
| 71 | First of all you must configure BGP router with @command{router bgp} |
| 72 | command. To configure BGP router, you need AS number. AS number is an |
| 73 | identification of autonomous system. BGP protocol uses the AS number |
| 74 | for detecting whether the BGP connection is internal one or external one. |
| 75 | |
| 76 | @deffn Command {router bgp @var{asn}} {} |
| 77 | Enable a BGP protocol process with the specified @var{asn}. After |
| 78 | this statement you can input any @code{BGP Commands}. You can not |
| 79 | create different BGP process under different @var{asn} without |
| 80 | specifying @code{multiple-instance} (@pxref{Multiple instance}). |
| 81 | @end deffn |
| 82 | |
| 83 | @deffn Command {no router bgp @var{asn}} {} |
| 84 | Destroy a BGP protocol process with the specified @var{asn}. |
| 85 | @end deffn |
| 86 | |
| 87 | @deffn {BGP} {bgp router-id @var{A.B.C.D}} {} |
| 88 | This command specifies the router-ID. If @command{bgpd} connects to @command{zebra} it gets |
| 89 | interface and address information. In that case default router ID value |
| 90 | is selected as the largest IP Address of the interfaces. When |
| 91 | @code{router zebra} is not enabled @command{bgpd} can't get interface information |
| 92 | so @code{router-id} is set to 0.0.0.0. So please set router-id by hand. |
| 93 | @end deffn |
| 94 | |
| 95 | @menu |
| 96 | * BGP distance:: |
| 97 | * BGP decision process:: |
Alexandre Chappuis | c31e572 | 2011-09-11 16:54:11 +0400 | [diff] [blame] | 98 | * BGP route flap dampening:: |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 99 | @end menu |
| 100 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 101 | @node BGP distance |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 102 | @subsection BGP distance |
| 103 | |
| 104 | @deffn {BGP} {distance bgp <1-255> <1-255> <1-255>} {} |
| 105 | This command change distance value of BGP. Each argument is distance |
| 106 | value for external routes, internal routes and local routes. |
| 107 | @end deffn |
| 108 | |
| 109 | @deffn {BGP} {distance <1-255> @var{A.B.C.D/M}} {} |
| 110 | @deffnx {BGP} {distance <1-255> @var{A.B.C.D/M} @var{word}} {} |
| 111 | This command set distance value to |
| 112 | @end deffn |
| 113 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 114 | @node BGP decision process |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 115 | @subsection BGP decision process |
| 116 | |
Paul Jakma | d5062d2 | 2015-12-02 16:47:43 +0000 | [diff] [blame] | 117 | The decision process Quagga BGP uses to select routes is as follows: |
| 118 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 119 | @table @asis |
| 120 | @item 1. Weight check |
Paul Jakma | d5062d2 | 2015-12-02 16:47:43 +0000 | [diff] [blame] | 121 | prefer higher local weight routes to lower routes. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 122 | |
Paul Jakma | d5062d2 | 2015-12-02 16:47:43 +0000 | [diff] [blame] | 123 | @item 2. Local preference check |
| 124 | prefer higher local preference routes to lower. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 125 | |
Paul Jakma | d5062d2 | 2015-12-02 16:47:43 +0000 | [diff] [blame] | 126 | @item 3. Local route check |
| 127 | Prefer local routes (statics, aggregates, redistributed) to received routes. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 128 | |
Paul Jakma | d5062d2 | 2015-12-02 16:47:43 +0000 | [diff] [blame] | 129 | @item 4. AS path length check |
| 130 | Prefer shortest hop-count AS_PATHs. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 131 | |
Paul Jakma | d5062d2 | 2015-12-02 16:47:43 +0000 | [diff] [blame] | 132 | @item 5. Origin check |
| 133 | Prefer the lowest origin type route. That is, prefer IGP origin routes to |
| 134 | EGP, to Incomplete routes. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 135 | |
Paul Jakma | d5062d2 | 2015-12-02 16:47:43 +0000 | [diff] [blame] | 136 | @item 6. MED check |
| 137 | Where routes with a MED were received from the same AS, |
| 138 | prefer the route with the lowest MED. @xref{BGP MED}. |
| 139 | |
| 140 | @item 7. External check |
| 141 | Prefer the route received from an external, eBGP peer |
| 142 | over routes received from other types of peers. |
| 143 | |
| 144 | @item 8. IGP cost check |
| 145 | Prefer the route with the lower IGP cost. |
| 146 | |
| 147 | @item 9. Multi-path check |
| 148 | If multi-pathing is enabled, then check whether |
| 149 | the routes not yet distinguished in preference may be considered equal. If |
| 150 | @ref{bgp bestpath as-path multipath-relax} is set, all such routes are |
| 151 | considered equal, otherwise routes received via iBGP with identical AS_PATHs |
| 152 | or routes received from eBGP neighbours in the same AS are considered equal. |
| 153 | |
| 154 | @item 10 Already-selected external check |
| 155 | |
| 156 | Where both routes were received from eBGP peers, then prefer the route which |
| 157 | is already selected. Note that this check is not applied if @ref{bgp |
| 158 | bestpath compare-routerid} is configured. This check can prevent some cases |
| 159 | of oscillation. |
| 160 | |
| 161 | @item 11. Router-ID check |
| 162 | Prefer the route with the lowest @w{router-ID}. If the |
| 163 | route has an @w{ORIGINATOR_ID} attribute, through iBGP reflection, then that |
| 164 | router ID is used, otherwise the @w{router-ID} of the peer the route was |
| 165 | received from is used. |
| 166 | |
| 167 | @item 12. Cluster-List length check |
| 168 | The route with the shortest cluster-list |
| 169 | length is used. The cluster-list reflects the iBGP reflection path the |
| 170 | route has taken. |
| 171 | |
| 172 | @item 13. Peer address |
| 173 | Prefer the route received from the peer with the higher |
| 174 | transport layer address, as a last-resort tie-breaker. |
| 175 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 176 | @end table |
| 177 | |
hasso | 6811845 | 2005-04-08 15:40:36 +0000 | [diff] [blame] | 178 | @deffn {BGP} {bgp bestpath as-path confed} {} |
| 179 | This command specifies that the length of confederation path sets and |
| 180 | sequences should should be taken into account during the BGP best path |
| 181 | decision process. |
| 182 | @end deffn |
| 183 | |
Pradosh Mohapatra | 2fdd455 | 2013-09-07 07:02:36 +0000 | [diff] [blame] | 184 | @deffn {BGP} {bgp bestpath as-path multipath-relax} {} |
Paul Jakma | d5062d2 | 2015-12-02 16:47:43 +0000 | [diff] [blame] | 185 | @anchor{bgp bestpath as-path multipath-relax} |
Pradosh Mohapatra | 2fdd455 | 2013-09-07 07:02:36 +0000 | [diff] [blame] | 186 | This command specifies that BGP decision process should consider paths |
| 187 | of equal AS_PATH length candidates for multipath computation. Without |
| 188 | the knob, the entire AS_PATH must match for multipath computation. |
| 189 | @end deffn |
| 190 | |
Paul Jakma | d5062d2 | 2015-12-02 16:47:43 +0000 | [diff] [blame] | 191 | @deffn {BGP} {bgp bestpath compare-routerid} {} |
| 192 | @anchor{bgp bestpath compare-routerid} |
| 193 | |
| 194 | Ensure that when comparing routes where both are equal on most metrics, |
| 195 | including local-pref, AS_PATH length, IGP cost, MED, that the tie is broken |
| 196 | based on router-ID. |
| 197 | |
| 198 | If this option is enabled, then the already-selected check, where |
| 199 | already selected eBGP routes are preferred, is skipped. |
| 200 | |
| 201 | If a route has an @w{ORIGINATOR_ID} attribute because it has been reflected, |
| 202 | that @w{ORIGINATOR_ID} will be used. Otherwise, the router-ID of the peer the |
| 203 | route was received from will be used. |
| 204 | |
| 205 | The advantage of this is that the route-selection (at this point) will be |
| 206 | more deterministic. The disadvantage is that a few or even one lowest-ID |
| 207 | router may attract all trafic to otherwise-equal paths because of this |
| 208 | check. It may increase the possibility of MED or IGP oscillation, unless |
| 209 | other measures were taken to avoid these. The exact behaviour will be |
| 210 | sensitive to the iBGP and reflection topology. |
| 211 | |
| 212 | @end deffn |
| 213 | |
| 214 | |
Alexandre Chappuis | c31e572 | 2011-09-11 16:54:11 +0400 | [diff] [blame] | 215 | @node BGP route flap dampening |
| 216 | @subsection BGP route flap dampening |
| 217 | |
| 218 | @deffn {BGP} {bgp dampening @var{<1-45>} @var{<1-20000>} @var{<1-20000>} @var{<1-255>}} {} |
| 219 | This command enables BGP route-flap dampening and specifies dampening parameters. |
| 220 | |
| 221 | @table @asis |
| 222 | @item @asis{half-life} |
| 223 | Half-life time for the penalty |
| 224 | @item @asis{reuse-threshold} |
| 225 | Value to start reusing a route |
| 226 | @item @asis{suppress-threshold} |
| 227 | Value to start suppressing a route |
| 228 | @item @asis{max-suppress} |
| 229 | Maximum duration to suppress a stable route |
| 230 | @end table |
| 231 | |
| 232 | The route-flap damping algorithm is compatible with @cite{RFC2439}. The use of this command |
| 233 | is not recommended nowadays, see @uref{http://www.ripe.net/ripe/docs/ripe-378,,RIPE-378}. |
| 234 | @end deffn |
| 235 | |
Paul Jakma | d5062d2 | 2015-12-02 16:47:43 +0000 | [diff] [blame] | 236 | @node BGP MED |
| 237 | @section BGP MED |
| 238 | |
| 239 | The BGP MED (Multi_Exit_Discriminator) attribute has properties which can |
| 240 | cause subtle convergence problems in BGP. These properties and problems |
| 241 | have proven to be hard to understand, at least historically, and may still |
| 242 | not be widely understood. The following attempts to collect together and |
| 243 | present what is known about MED, to help operators and Quagga users in |
| 244 | designing and configuring their networks. |
| 245 | |
| 246 | The BGP @acronym{MED, Multi_Exit_Discriminator} attribute is intended to |
| 247 | allow one AS to indicate its preferences for its ingress points to another |
| 248 | AS. The MED attribute will not be propagated on to another AS by the |
| 249 | receiving AS - it is `non-transitive' in the BGP sense. |
| 250 | |
| 251 | E.g., if AS X and AS Y have 2 different BGP peering points, then AS X |
| 252 | might set a MED of 100 on routes advertised at one and a MED of 200 at the |
| 253 | other. When AS Y selects between otherwise equal routes to or via |
| 254 | AS X, AS Y should prefer to take the path via the lower MED peering of 100 with |
| 255 | AS X. Setting the MED allows an AS to influence the routing taken to it |
| 256 | within another, neighbouring AS. |
| 257 | |
| 258 | In this use of MED it is not really meaningful to compare the MED value on |
| 259 | routes where the next AS on the paths differs. E.g., if AS Y also had a |
| 260 | route for some destination via AS Z in addition to the routes from AS X, and |
| 261 | AS Z had also set a MED, it wouldn't make sense for AS Y to compare AS Z's |
| 262 | MED values to those of AS X. The MED values have been set by different |
| 263 | administrators, with different frames of reference. |
| 264 | |
| 265 | The default behaviour of BGP therefore is to not compare MED values across |
| 266 | routes received from different neighbouring ASes. In Quagga this is done by |
| 267 | comparing the neighbouring, left-most AS in the received AS_PATHs of the |
| 268 | routes and only comparing MED if those are the same. |
| 269 | |
| 270 | @c TeXInfo uses the old, non-UTF-8 capable, pdftex, and so |
| 271 | @c doesn't render TeX the unicode precedes character correctly in PDF, etc. |
| 272 | @c Using a TeX code on the other hand doesn't work for non-TeX outputs |
| 273 | @c (plaintext, e.g.). So, use an output-conditional macro. |
| 274 | |
| 275 | @iftex |
| 276 | @macro mprec{} |
| 277 | @math{\\prec} |
| 278 | @end macro |
| 279 | @end iftex |
| 280 | |
| 281 | @ifnottex |
| 282 | @macro mprec{} |
| 283 | @math{≺} |
| 284 | @end macro |
| 285 | @end ifnottex |
| 286 | |
| 287 | Unfortunately, this behaviour of MED, of sometimes being compared across |
| 288 | routes and sometimes not, depending on the properties of those other routes, |
| 289 | means MED can cause the order of preference over all the routes to be |
| 290 | undefined. That is, given routes A, B, and C, if A is preferred to B, and B |
| 291 | is preferred to C, then a well-defined order should mean the preference is |
| 292 | transitive (in the sense of orders @footnote{For some set of objects to have |
| 293 | an order, there @emph{must} be some binary ordering relation that is defined |
| 294 | for @emph{every} combination of those objects, and that relation @emph{must} |
| 295 | be transitive. I.e.@:, if the relation operator is @mprec{}, and if |
| 296 | a @mprec{} b and b @mprec{} c then that relation must carry over |
| 297 | and it @emph{must} be that a @mprec{} c for the objects to have an |
| 298 | order. The ordering relation may allow for equality, i.e. |
| 299 | a @mprec{} b and b @mprec{} a may both be true amd imply that |
| 300 | a and b are equal in the order and not distinguished by it, in |
| 301 | which case the set has a partial order. Otherwise, if there is an order, |
| 302 | all the objects have a distinct place in the order and the set has a total |
| 303 | order.}) and that A would be preferred to C. |
| 304 | |
| 305 | @c No longer need the precedes character definition |
| 306 | @unmacro mprec |
| 307 | |
| 308 | However, when MED is involved this need not be the case. With MED it is |
| 309 | possible that C is actually preferred over A. So A is preferred to B, B is |
| 310 | preferred to C, but C is preferred to A. This can be true even where BGP |
| 311 | defines a deterministic ``most preferred'' route out of the full set of |
| 312 | A,B,C. With MED, for any given set of routes there may be a |
| 313 | deterministically preferred route, but there need not be any way to arrange |
| 314 | them into any order of preference. With unmodified MED, the order of |
| 315 | preference of routes literally becomes undefined. |
| 316 | |
| 317 | That MED can induce non-transitive preferences over routes can cause issues. |
| 318 | Firstly, it may be perceived to cause routing table churn locally at |
| 319 | speakers; secondly, and more seriously, it may cause routing instability in |
| 320 | iBGP topologies, where sets of speakers continually oscillate between |
| 321 | different paths. |
| 322 | |
| 323 | The first issue arises from how speakers often implement routing decisions. |
| 324 | Though BGP defines a selection process that will deterministically select |
| 325 | the same route as best at any given speaker, even with MED, that process |
| 326 | requires evaluating all routes together. For performance and ease of |
| 327 | implementation reasons, many implementations evaluate route preferences in a |
| 328 | pair-wise fashion instead. Given there is no well-defined order when MED is |
| 329 | involved, the best route that will be chosen becomes subject to |
| 330 | implementation details, such as the order the routes are stored in. That |
| 331 | may be (locally) non-deterministic, e.g.@: it may be the order the routes |
| 332 | were received in. |
| 333 | |
| 334 | This indeterminism may be considered undesirable, though it need not cause |
| 335 | problems. It may mean additional routing churn is perceived, as sometimes |
| 336 | more updates may be produced than at other times in reaction to some event . |
| 337 | |
| 338 | This first issue can be fixed with a more deterministic route selection that |
| 339 | ensures routes are ordered by the neighbouring AS during selection. |
| 340 | @xref{bgp deterministic-med}. This may reduce the number of updates as |
| 341 | routes are received, and may in some cases reduce routing churn. Though, it |
| 342 | could equally deterministically produce the largest possible set of updates |
| 343 | in response to the most common sequence of received updates. |
| 344 | |
| 345 | A deterministic order of evaluation tends to imply an additional overhead of |
| 346 | sorting over any set of n routes to a destination. The implementation of |
| 347 | deterministic MED in Quagga scales significantly worse than most sorting |
| 348 | algorithms at present, with the number of paths to a given destination. |
| 349 | That number is often low enough to not cause any issues, but where there are |
| 350 | many paths, the deterministic comparison may quickly become increasingly |
| 351 | expensive in terms of CPU. |
| 352 | |
| 353 | Deterministic local evaluation can @emph{not} fix the second, more major, |
| 354 | issue of MED however. Which is that the non-transitive preference of routes |
| 355 | MED can cause may lead to routing instability or oscillation across multiple |
| 356 | speakers in iBGP topologies. This can occur with full-mesh iBGP, but is |
| 357 | particularly problematic in non-full-mesh iBGP topologies that further |
| 358 | reduce the routing information known to each speaker. This has primarily |
| 359 | been documented with iBGP route-reflection topologies. However, any |
| 360 | route-hiding technologies potentially could also exacerbate oscillation with |
| 361 | MED. |
| 362 | |
| 363 | This second issue occurs where speakers each have only a subset of routes, |
| 364 | and there are cycles in the preferences between different combinations of |
| 365 | routes - as the undefined order of preference of MED allows - and the routes |
| 366 | are distributed in a way that causes the BGP speakers to 'chase' those |
| 367 | cycles. This can occur even if all speakers use a deterministic order of |
| 368 | evaluation in route selection. |
| 369 | |
| 370 | E.g., speaker 4 in AS A might receive a route from speaker 2 in AS X, and |
| 371 | from speaker 3 in AS Y; while speaker 5 in AS A might receive that route |
| 372 | from speaker 1 in AS Y. AS Y might set a MED of 200 at speaker 1, and 100 |
| 373 | at speaker 3. I.e, using ASN:ID:MED to label the speakers: |
| 374 | |
| 375 | @example |
| 376 | |
| 377 | /---------------\ |
| 378 | X:2------|--A:4-------A:5--|-Y:1:200 |
| 379 | Y:3:100--|-/ | |
| 380 | \---------------/ |
| 381 | |
| 382 | @end example |
| 383 | |
| 384 | Assuming all other metrics are equal (AS_PATH, ORIGIN, 0 IGP costs), then |
| 385 | based on the RFC4271 decision process speaker 4 will choose X:2 over |
| 386 | Y:3:100, based on the lower ID of 2. Speaker 4 advertises X:2 to speaker 5. |
| 387 | Speaker 5 will continue to prefer Y:1:200 based on the ID, and advertise |
| 388 | this to speaker 4. Speaker 4 will now have the full set of routes, and the |
| 389 | Y:1:200 it receives from 5 will beat X:2, but when speaker 4 compares |
| 390 | Y:1:200 to Y:3:100 the MED check now becomes active as the ASes match, and |
| 391 | now Y:3:100 is preferred. Speaker 4 therefore now advertises Y:3:100 to 5, |
| 392 | which will also agrees that Y:3:100 is preferred to Y:1:200, and so |
| 393 | withdraws the latter route from 4. Speaker 4 now has only X:2 and Y:3:100, |
| 394 | and X:2 beats Y:3:100, and so speaker 4 implicitly updates its route to |
| 395 | speaker 5 to X:2. Speaker 5 sees that Y:1:200 beats X:2 based on the ID, |
| 396 | and advertises Y:1:200 to speaker 4, and the cycle continues. |
| 397 | |
| 398 | The root cause is the lack of a clear order of preference caused by how MED |
| 399 | sometimes is and sometimes is not compared, leading to this cycle in the |
| 400 | preferences between the routes: |
| 401 | |
| 402 | @example |
| 403 | |
| 404 | /---> X:2 ---beats---> Y:3:100 --\ |
| 405 | | | |
| 406 | | | |
| 407 | \---beats--- Y:1:200 <---beats---/ |
| 408 | |
| 409 | @end example |
| 410 | |
| 411 | This particular type of oscillation in full-mesh iBGP topologies can be |
| 412 | avoided by speakers preferring already selected, external routes rather than |
| 413 | choosing to update to new a route based on a post-MED metric (e.g. |
| 414 | router-ID), at the cost of a non-deterministic selection process. Quagga |
| 415 | implements this, as do many other implementations, so long as it is not |
| 416 | overridden by setting @ref{bgp bestpath compare-routerid}, and see also |
| 417 | @ref{BGP decision process}, . |
| 418 | |
| 419 | However, more complex and insidious cycles of oscillation are possible with |
| 420 | iBGP route-reflection, which are not so easily avoided. These have been |
| 421 | documented in various places. See, e.g., @cite{McPherson, D. and Gill, V. |
| 422 | and Walton, D., "Border Gateway Protocol (BGP) Persistent Route Oscillation |
| 423 | Condition", IETF RFC3345}, and @cite{Flavel, A. and M. Roughan, "Stable |
| 424 | and flexible iBGP", ACM SIGCOMM 2009}, and @cite{Griffin, T. and G. Wilfong, |
| 425 | "On the correctness of IBGP configuration", ACM SIGCOMM 2002} for concrete |
| 426 | examples and further references. |
| 427 | |
| 428 | There is as of this writing @emph{no} known way to use MED for its original |
| 429 | purpose; @emph{and} reduce routing information in iBGP topologies; |
| 430 | @emph{and} be sure to avoid the instability problems of MED due the |
| 431 | non-transitive routing preferences it can induce; in general on arbitrary |
| 432 | networks. |
| 433 | |
| 434 | There may be iBGP topology specific ways to reduce the instability risks, |
| 435 | even while using MED, e.g.@: by constraining the reflection topology and by |
| 436 | tuning IGP costs between route-reflector clusters, see RFC3345 for details. |
| 437 | In the near future, the Add-Path extension to BGP may also solve MED |
| 438 | oscillation while still allowing MED to be used as intended, by distributing |
| 439 | "best-paths per neighbour AS". This would be at the cost of distributing at |
| 440 | least as many routes to all speakers as a full-mesh iBGP would, if not more, |
| 441 | while also imposing similar CPU overheads as the "Deterministic MED" feature |
| 442 | at each Add-Path reflector. |
| 443 | |
| 444 | More generally, the instability problems that MED can introduce on more |
| 445 | complex, non-full-mesh, iBGP topologies may be avoided either by: |
| 446 | |
| 447 | @itemize |
| 448 | |
| 449 | @item |
| 450 | Setting @ref{bgp always-compare-med}, however this allows MED to be compared |
| 451 | across values set by different neighbour ASes, which may not produce |
| 452 | coherent desirable results, of itself. |
| 453 | |
| 454 | @item |
| 455 | Effectively ignoring MED by setting MED to the same value (e.g.@: 0) using |
| 456 | @ref{routemap set metric} on all received routes, in combination with |
| 457 | setting @ref{bgp always-compare-med} on all speakers. This is the simplest |
| 458 | and most performant way to avoid MED oscillation issues, where an AS is happy |
| 459 | not to allow neighbours to inject this problematic metric. |
| 460 | |
| 461 | @end itemize |
| 462 | |
| 463 | As MED is evaluated after the AS_PATH length check, another possible use for |
| 464 | MED is for intra-AS steering of routes with equal AS_PATH length, as an |
| 465 | extension of the last case above. As MED is evaluated before IGP metric, |
| 466 | this can allow cold-potato routing to be implemented to send traffic to |
| 467 | preferred hand-offs with neighbours, rather than the closest hand-off |
| 468 | according to the IGP metric. |
| 469 | |
| 470 | Note that even if action is taken to address the MED non-transitivity |
| 471 | issues, other oscillations may still be possible. E.g., on IGP cost if |
| 472 | iBGP and IGP topologies are at cross-purposes with each other - see the |
| 473 | Flavel and Roughan paper above for an example. Hence the guideline that the |
| 474 | iBGP topology should follow the IGP topology. |
| 475 | |
| 476 | @deffn {BGP} {bgp deterministic-med} {} |
| 477 | @anchor{bgp deterministic-med} |
| 478 | |
| 479 | Carry out route-selection in way that produces deterministic answers |
| 480 | locally, even in the face of MED and the lack of a well-defined order of |
| 481 | preference it can induce on routes. Without this option the preferred route |
| 482 | with MED may be determined largely by the order that routes were received |
| 483 | in. |
| 484 | |
| 485 | Setting this option will have a performance cost that may be noticeable when |
| 486 | there are many routes for each destination. Currently in Quagga it is |
| 487 | implemented in a way that scales poorly as the number of routes per |
| 488 | destination increases. |
| 489 | |
| 490 | The default is that this option is not set. |
| 491 | @end deffn |
| 492 | |
| 493 | Note that there are other sources of indeterminism in the route selection |
| 494 | process, specifically, the preference for older and already selected routes |
| 495 | from eBGP peers, @xref{BGP decision process}. |
| 496 | |
| 497 | @deffn {BGP} {bgp always-compare-med} {} |
| 498 | @anchor{bgp always-compare-med} |
| 499 | |
| 500 | Always compare the MED on routes, even when they were received from |
| 501 | different neighbouring ASes. Setting this option makes the order of |
| 502 | preference of routes more defined, and should eliminate MED induced |
| 503 | oscillations. |
| 504 | |
| 505 | If using this option, it may also be desirable to use @ref{routemap set |
| 506 | metric} to set MED to 0 on routes received from external neighbours. |
| 507 | |
| 508 | This option can be used, together with @ref{routemap set metric} to use MED |
| 509 | as an intra-AS metric to steer equal-length AS_PATH routes to, e.g., desired |
| 510 | exit points. |
| 511 | @end deffn |
| 512 | |
| 513 | |
| 514 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 515 | @node BGP network |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 516 | @section BGP network |
| 517 | |
| 518 | @menu |
| 519 | * BGP route:: |
| 520 | * Route Aggregation:: |
| 521 | * Redistribute to BGP:: |
| 522 | @end menu |
| 523 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 524 | @node BGP route |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 525 | @subsection BGP route |
| 526 | |
| 527 | @deffn {BGP} {network @var{A.B.C.D/M}} {} |
| 528 | This command adds the announcement network. |
| 529 | @example |
| 530 | @group |
| 531 | router bgp 1 |
| 532 | network 10.0.0.0/8 |
| 533 | @end group |
| 534 | @end example |
| 535 | This configuration example says that network 10.0.0.0/8 will be |
| 536 | announced to all neighbors. Some vendors' routers don't advertise |
Paul Jakma | 4136717 | 2007-08-06 15:24:51 +0000 | [diff] [blame] | 537 | routes if they aren't present in their IGP routing tables; @code{bgpd} |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 538 | doesn't care about IGP routes when announcing its routes. |
| 539 | @end deffn |
| 540 | |
| 541 | @deffn {BGP} {no network @var{A.B.C.D/M}} {} |
| 542 | @end deffn |
| 543 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 544 | @node Route Aggregation |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 545 | @subsection Route Aggregation |
| 546 | |
| 547 | @deffn {BGP} {aggregate-address @var{A.B.C.D/M}} {} |
| 548 | This command specifies an aggregate address. |
| 549 | @end deffn |
| 550 | |
| 551 | @deffn {BGP} {aggregate-address @var{A.B.C.D/M} as-set} {} |
Paul Jakma | d5062d2 | 2015-12-02 16:47:43 +0000 | [diff] [blame] | 552 | This command specifies an aggregate address. Resulting routes include |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 553 | AS set. |
| 554 | @end deffn |
| 555 | |
| 556 | @deffn {BGP} {aggregate-address @var{A.B.C.D/M} summary-only} {} |
| 557 | This command specifies an aggregate address. Aggreated routes will |
| 558 | not be announce. |
| 559 | @end deffn |
| 560 | |
| 561 | @deffn {BGP} {no aggregate-address @var{A.B.C.D/M}} {} |
| 562 | @end deffn |
| 563 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 564 | @node Redistribute to BGP |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 565 | @subsection Redistribute to BGP |
| 566 | |
| 567 | @deffn {BGP} {redistribute kernel} {} |
| 568 | Redistribute kernel route to BGP process. |
| 569 | @end deffn |
| 570 | |
| 571 | @deffn {BGP} {redistribute static} {} |
| 572 | Redistribute static route to BGP process. |
| 573 | @end deffn |
| 574 | |
| 575 | @deffn {BGP} {redistribute connected} {} |
| 576 | Redistribute connected route to BGP process. |
| 577 | @end deffn |
| 578 | |
| 579 | @deffn {BGP} {redistribute rip} {} |
| 580 | Redistribute RIP route to BGP process. |
| 581 | @end deffn |
| 582 | |
| 583 | @deffn {BGP} {redistribute ospf} {} |
| 584 | Redistribute OSPF route to BGP process. |
| 585 | @end deffn |
| 586 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 587 | @node BGP Peer |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 588 | @section BGP Peer |
| 589 | |
| 590 | @menu |
| 591 | * Defining Peer:: |
| 592 | * BGP Peer commands:: |
| 593 | * Peer filtering:: |
| 594 | @end menu |
| 595 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 596 | @node Defining Peer |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 597 | @subsection Defining Peer |
| 598 | |
| 599 | @deffn {BGP} {neighbor @var{peer} remote-as @var{asn}} {} |
| 600 | Creates a new neighbor whose remote-as is @var{asn}. @var{peer} |
| 601 | can be an IPv4 address or an IPv6 address. |
| 602 | @example |
| 603 | @group |
| 604 | router bgp 1 |
| 605 | neighbor 10.0.0.1 remote-as 2 |
| 606 | @end group |
| 607 | @end example |
| 608 | In this case my router, in AS-1, is trying to peer with AS-2 at |
| 609 | 10.0.0.1. |
| 610 | |
| 611 | This command must be the first command used when configuring a neighbor. |
| 612 | If the remote-as is not specified, @command{bgpd} will complain like this: |
| 613 | @example |
| 614 | can't find neighbor 10.0.0.1 |
| 615 | @end example |
| 616 | @end deffn |
| 617 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 618 | @node BGP Peer commands |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 619 | @subsection BGP Peer commands |
| 620 | |
| 621 | In a @code{router bgp} clause there are neighbor specific configurations |
| 622 | required. |
| 623 | |
| 624 | @deffn {BGP} {neighbor @var{peer} shutdown} {} |
| 625 | @deffnx {BGP} {no neighbor @var{peer} shutdown} {} |
| 626 | Shutdown the peer. We can delete the neighbor's configuration by |
| 627 | @code{no neighbor @var{peer} remote-as @var{as-number}} but all |
| 628 | configuration of the neighbor will be deleted. When you want to |
| 629 | preserve the configuration, but want to drop the BGP peer, use this |
| 630 | syntax. |
| 631 | @end deffn |
| 632 | |
| 633 | @deffn {BGP} {neighbor @var{peer} ebgp-multihop} {} |
| 634 | @deffnx {BGP} {no neighbor @var{peer} ebgp-multihop} {} |
| 635 | @end deffn |
| 636 | |
| 637 | @deffn {BGP} {neighbor @var{peer} description ...} {} |
| 638 | @deffnx {BGP} {no neighbor @var{peer} description ...} {} |
| 639 | Set description of the peer. |
| 640 | @end deffn |
| 641 | |
| 642 | @deffn {BGP} {neighbor @var{peer} version @var{version}} {} |
| 643 | Set up the neighbor's BGP version. @var{version} can be @var{4}, |
| 644 | @var{4+} or @var{4-}. BGP version @var{4} is the default value used for |
| 645 | BGP peering. BGP version @var{4+} means that the neighbor supports |
| 646 | Multiprotocol Extensions for BGP-4. BGP version @var{4-} is similar but |
| 647 | the neighbor speaks the old Internet-Draft revision 00's Multiprotocol |
| 648 | Extensions for BGP-4. Some routing software is still using this |
| 649 | version. |
| 650 | @end deffn |
| 651 | |
| 652 | @deffn {BGP} {neighbor @var{peer} interface @var{ifname}} {} |
| 653 | @deffnx {BGP} {no neighbor @var{peer} interface @var{ifname}} {} |
Paul Jakma | 825cd49 | 2006-05-23 22:20:34 +0000 | [diff] [blame] | 654 | When you connect to a BGP peer over an IPv6 link-local address, you |
| 655 | have to specify the @var{ifname} of the interface used for the |
| 656 | connection. To specify IPv4 session addresses, see the |
| 657 | @code{neighbor @var{peer} update-source} command below. |
| 658 | |
| 659 | This command is deprecated and may be removed in a future release. Its |
| 660 | use should be avoided. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 661 | @end deffn |
| 662 | |
Timo Teräs | 9e7a53c | 2014-04-24 10:22:37 +0300 | [diff] [blame] | 663 | @deffn {BGP} {neighbor @var{peer} next-hop-self [all]} {} |
| 664 | @deffnx {BGP} {no neighbor @var{peer} next-hop-self [all]} {} |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 665 | This command specifies an announced route's nexthop as being equivalent |
Timo Teräs | 9e7a53c | 2014-04-24 10:22:37 +0300 | [diff] [blame] | 666 | to the address of the bgp router if it is learned via eBGP. |
| 667 | If the optional keyword @code{all} is specified the modifiation is done |
| 668 | also for routes learned via iBGP. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 669 | @end deffn |
| 670 | |
Paul Jakma | 466c965 | 2006-06-26 12:55:58 +0000 | [diff] [blame] | 671 | @deffn {BGP} {neighbor @var{peer} update-source @var{<ifname|address>}} {} |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 672 | @deffnx {BGP} {no neighbor @var{peer} update-source} {} |
Paul Jakma | 825cd49 | 2006-05-23 22:20:34 +0000 | [diff] [blame] | 673 | Specify the IPv4 source address to use for the @acronym{BGP} session to this |
| 674 | neighbour, may be specified as either an IPv4 address directly or |
| 675 | as an interface name (in which case the @command{zebra} daemon MUST be running |
| 676 | in order for @command{bgpd} to be able to retrieve interface state). |
| 677 | @example |
| 678 | @group |
| 679 | router bgp 64555 |
| 680 | neighbor foo update-source 192.168.0.1 |
| 681 | neighbor bar update-source lo0 |
| 682 | @end group |
| 683 | @end example |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 684 | @end deffn |
| 685 | |
| 686 | @deffn {BGP} {neighbor @var{peer} default-originate} {} |
| 687 | @deffnx {BGP} {no neighbor @var{peer} default-originate} {} |
| 688 | @command{bgpd}'s default is to not announce the default route (0.0.0.0/0) even it |
| 689 | is in routing table. When you want to announce default routes to the |
| 690 | peer, use this command. |
| 691 | @end deffn |
| 692 | |
| 693 | @deffn {BGP} {neighbor @var{peer} port @var{port}} {} |
| 694 | @deffnx {BGP} {neighbor @var{peer} port @var{port}} {} |
| 695 | @end deffn |
| 696 | |
| 697 | @deffn {BGP} {neighbor @var{peer} send-community} {} |
| 698 | @deffnx {BGP} {neighbor @var{peer} send-community} {} |
| 699 | @end deffn |
| 700 | |
| 701 | @deffn {BGP} {neighbor @var{peer} weight @var{weight}} {} |
| 702 | @deffnx {BGP} {no neighbor @var{peer} weight @var{weight}} {} |
| 703 | This command specifies a default @var{weight} value for the neighbor's |
| 704 | routes. |
| 705 | @end deffn |
| 706 | |
| 707 | @deffn {BGP} {neighbor @var{peer} maximum-prefix @var{number}} {} |
| 708 | @deffnx {BGP} {no neighbor @var{peer} maximum-prefix @var{number}} {} |
| 709 | @end deffn |
| 710 | |
Andrew Certain | 5aebb9c | 2012-11-07 23:50:09 +0000 | [diff] [blame] | 711 | @deffn {BGP} {neighbor @var{peer} local-as @var{as-number}} {} |
| 712 | @deffnx {BGP} {neighbor @var{peer} local-as @var{as-number} no-prepend} {} |
| 713 | @deffnx {BGP} {neighbor @var{peer} local-as @var{as-number} no-prepend replace-as} {} |
| 714 | @deffnx {BGP} {no neighbor @var{peer} local-as} {} |
| 715 | Specify an alternate AS for this BGP process when interacting with the |
| 716 | specified peer. With no modifiers, the specified local-as is prepended to |
| 717 | the received AS_PATH when receiving routing updates from the peer, and |
| 718 | prepended to the outgoing AS_PATH (after the process local AS) when |
| 719 | transmitting local routes to the peer. |
| 720 | |
| 721 | If the no-prepend attribute is specified, then the supplied local-as is not |
| 722 | prepended to the received AS_PATH. |
| 723 | |
| 724 | If the replace-as attribute is specified, then only the supplied local-as is |
| 725 | prepended to the AS_PATH when transmitting local-route updates to this peer. |
| 726 | |
| 727 | Note that replace-as can only be specified if no-prepend is. |
| 728 | |
| 729 | This command is only allowed for eBGP peers. |
| 730 | @end deffn |
| 731 | |
Pradosh Mohapatra | 5d804b4 | 2013-09-12 03:37:07 +0000 | [diff] [blame] | 732 | @deffn {BGP} {neighbor @var{peer} ttl-security hops @var{number}} {} |
| 733 | @deffnx {BGP} {no neighbor @var{peer} ttl-security hops @var{number}} {} |
| 734 | This command enforces Generalized TTL Security Mechanism (GTSM), as |
| 735 | specified in RFC 5082. With this command, only neighbors that are the |
| 736 | specified number of hops away will be allowed to become neighbors. This |
| 737 | command is mututally exclusive with @command{ebgp-multihop}. |
| 738 | @end deffn |
| 739 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 740 | @node Peer filtering |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 741 | @subsection Peer filtering |
| 742 | |
| 743 | @deffn {BGP} {neighbor @var{peer} distribute-list @var{name} [in|out]} {} |
| 744 | This command specifies a distribute-list for the peer. @var{direct} is |
| 745 | @samp{in} or @samp{out}. |
| 746 | @end deffn |
| 747 | |
| 748 | @deffn {BGP command} {neighbor @var{peer} prefix-list @var{name} [in|out]} {} |
| 749 | @end deffn |
| 750 | |
| 751 | @deffn {BGP command} {neighbor @var{peer} filter-list @var{name} [in|out]} {} |
| 752 | @end deffn |
| 753 | |
| 754 | @deffn {BGP} {neighbor @var{peer} route-map @var{name} [in|out]} {} |
| 755 | Apply a route-map on the neighbor. @var{direct} must be @code{in} or |
| 756 | @code{out}. |
| 757 | @end deffn |
| 758 | |
| 759 | @c ----------------------------------------------------------------------- |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 760 | @node BGP Peer Group |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 761 | @section BGP Peer Group |
| 762 | |
| 763 | @deffn {BGP} {neighbor @var{word} peer-group} {} |
| 764 | This command defines a new peer group. |
| 765 | @end deffn |
| 766 | |
| 767 | @deffn {BGP} {neighbor @var{peer} peer-group @var{word}} {} |
| 768 | This command bind specific peer to peer group @var{word}. |
| 769 | @end deffn |
| 770 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 771 | @node BGP Address Family |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 772 | @section BGP Address Family |
| 773 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 774 | @c ----------------------------------------------------------------------- |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 775 | @node Autonomous System |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 776 | @section Autonomous System |
| 777 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 778 | The @acronym{AS,Autonomous System} number is one of the essential |
| 779 | element of BGP. BGP is a distance vector routing protocol, and the |
| 780 | AS-Path framework provides distance vector metric and loop detection to |
| 781 | BGP. @cite{RFC1930, Guidelines for creation, selection, and |
| 782 | registration of an Autonomous System (AS)} provides some background on |
| 783 | the concepts of an AS. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 784 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 785 | The AS number is a two octet value, ranging in value from 1 to 65535. |
| 786 | The AS numbers 64512 through 65535 are defined as private AS numbers. |
| 787 | Private AS numbers must not to be advertised in the global Internet. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 788 | |
| 789 | @menu |
| 790 | * AS Path Regular Expression:: |
| 791 | * Display BGP Routes by AS Path:: |
| 792 | * AS Path Access List:: |
| 793 | * Using AS Path in Route Map:: |
| 794 | * Private AS Numbers:: |
| 795 | @end menu |
| 796 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 797 | @node AS Path Regular Expression |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 798 | @subsection AS Path Regular Expression |
| 799 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 800 | AS path regular expression can be used for displaying BGP routes and |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 801 | AS path access list. AS path regular expression is based on |
| 802 | @code{POSIX 1003.2} regular expressions. Following description is |
| 803 | just a subset of @code{POSIX} regular expression. User can use full |
| 804 | @code{POSIX} regular expression. Adding to that special character '_' |
| 805 | is added for AS path regular expression. |
| 806 | |
| 807 | @table @code |
| 808 | @item . |
| 809 | Matches any single character. |
| 810 | @item * |
| 811 | Matches 0 or more occurrences of pattern. |
| 812 | @item + |
| 813 | Matches 1 or more occurrences of pattern. |
| 814 | @item ? |
| 815 | Match 0 or 1 occurrences of pattern. |
| 816 | @item ^ |
| 817 | Matches the beginning of the line. |
| 818 | @item $ |
| 819 | Matches the end of the line. |
| 820 | @item _ |
| 821 | Character @code{_} has special meanings in AS path regular expression. |
| 822 | It matches to space and comma , and AS set delimiter @{ and @} and AS |
| 823 | confederation delimiter @code{(} and @code{)}. And it also matches to |
| 824 | the beginning of the line and the end of the line. So @code{_} can be |
| 825 | used for AS value boundaries match. @code{show ip bgp regexp _7675_} |
| 826 | matches to all of BGP routes which as AS number include @var{7675}. |
| 827 | @end table |
| 828 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 829 | @node Display BGP Routes by AS Path |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 830 | @subsection Display BGP Routes by AS Path |
| 831 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 832 | To show BGP routes which has specific AS path information @code{show |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 833 | ip bgp} command can be used. |
| 834 | |
| 835 | @deffn Command {show ip bgp regexp @var{line}} {} |
| 836 | This commands display BGP routes that matches AS path regular |
| 837 | expression @var{line}. |
| 838 | @end deffn |
| 839 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 840 | @node AS Path Access List |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 841 | @subsection AS Path Access List |
| 842 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 843 | AS path access list is user defined AS path. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 844 | |
| 845 | @deffn {Command} {ip as-path access-list @var{word} @{permit|deny@} @var{line}} {} |
| 846 | This command defines a new AS path access list. |
| 847 | @end deffn |
| 848 | |
| 849 | @deffn {Command} {no ip as-path access-list @var{word}} {} |
| 850 | @deffnx {Command} {no ip as-path access-list @var{word} @{permit|deny@} @var{line}} {} |
| 851 | @end deffn |
| 852 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 853 | @node Using AS Path in Route Map |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 854 | @subsection Using AS Path in Route Map |
| 855 | |
| 856 | @deffn {Route Map} {match as-path @var{word}} {} |
| 857 | @end deffn |
| 858 | |
| 859 | @deffn {Route Map} {set as-path prepend @var{as-path}} {} |
Paul Jakma | 5e4ba81 | 2014-10-20 17:49:44 +0100 | [diff] [blame] | 860 | Prepend the given string of AS numbers to the AS_PATH. |
| 861 | @end deffn |
| 862 | |
| 863 | @deffn {Route Map} {set as-path prepend last-as @var{num}} {} |
| 864 | Prepend the existing last AS number (the leftmost ASN) to the AS_PATH. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 865 | @end deffn |
| 866 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 867 | @node Private AS Numbers |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 868 | @subsection Private AS Numbers |
| 869 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 870 | @c ----------------------------------------------------------------------- |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 871 | @node BGP Communities Attribute |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 872 | @section BGP Communities Attribute |
| 873 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 874 | BGP communities attribute is widely used for implementing policy |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 875 | routing. Network operators can manipulate BGP communities attribute |
| 876 | based on their network policy. BGP communities attribute is defined |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 877 | in @cite{RFC1997, BGP Communities Attribute} and |
| 878 | @cite{RFC1998, An Application of the BGP Community Attribute |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 879 | in Multi-home Routing}. It is an optional transitive attribute, |
| 880 | therefore local policy can travel through different autonomous system. |
| 881 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 882 | Communities attribute is a set of communities values. Each |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 883 | communities value is 4 octet long. The following format is used to |
| 884 | define communities value. |
| 885 | |
| 886 | @table @code |
| 887 | @item AS:VAL |
| 888 | This format represents 4 octet communities value. @code{AS} is high |
| 889 | order 2 octet in digit format. @code{VAL} is low order 2 octet in |
| 890 | digit format. This format is useful to define AS oriented policy |
| 891 | value. For example, @code{7675:80} can be used when AS 7675 wants to |
| 892 | pass local policy value 80 to neighboring peer. |
| 893 | @item internet |
| 894 | @code{internet} represents well-known communities value 0. |
| 895 | @item no-export |
| 896 | @code{no-export} represents well-known communities value @code{NO_EXPORT}@* |
| 897 | @r{(0xFFFFFF01)}. All routes carry this value must not be advertised |
| 898 | to outside a BGP confederation boundary. If neighboring BGP peer is |
| 899 | part of BGP confederation, the peer is considered as inside a BGP |
| 900 | confederation boundary, so the route will be announced to the peer. |
| 901 | @item no-advertise |
| 902 | @code{no-advertise} represents well-known communities value |
| 903 | @code{NO_ADVERTISE}@*@r{(0xFFFFFF02)}. All routes carry this value |
| 904 | must not be advertise to other BGP peers. |
| 905 | @item local-AS |
| 906 | @code{local-AS} represents well-known communities value |
| 907 | @code{NO_EXPORT_SUBCONFED} @r{(0xFFFFFF03)}. All routes carry this |
| 908 | value must not be advertised to external BGP peers. Even if the |
| 909 | neighboring router is part of confederation, it is considered as |
| 910 | external BGP peer, so the route will not be announced to the peer. |
| 911 | @end table |
| 912 | |
| 913 | When BGP communities attribute is received, duplicated communities |
| 914 | value in the communities attribute is ignored and each communities |
| 915 | values are sorted in numerical order. |
| 916 | |
| 917 | @menu |
| 918 | * BGP Community Lists:: |
| 919 | * Numbered BGP Community Lists:: |
| 920 | * BGP Community in Route Map:: |
| 921 | * Display BGP Routes by Community:: |
| 922 | * Using BGP Communities Attribute:: |
| 923 | @end menu |
| 924 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 925 | @node BGP Community Lists |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 926 | @subsection BGP Community Lists |
| 927 | |
| 928 | BGP community list is a user defined BGP communites attribute list. |
| 929 | BGP community list can be used for matching or manipulating BGP |
| 930 | communities attribute in updates. |
| 931 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 932 | There are two types of community list. One is standard community |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 933 | list and another is expanded community list. Standard community list |
| 934 | defines communities attribute. Expanded community list defines |
| 935 | communities attribute string with regular expression. Standard |
| 936 | community list is compiled into binary format when user define it. |
| 937 | Standard community list will be directly compared to BGP communities |
| 938 | attribute in BGP updates. Therefore the comparison is faster than |
| 939 | expanded community list. |
| 940 | |
| 941 | @deffn Command {ip community-list standard @var{name} @{permit|deny@} @var{community}} {} |
| 942 | This command defines a new standard community list. @var{community} |
| 943 | is communities value. The @var{community} is compiled into community |
| 944 | structure. We can define multiple community list under same name. In |
| 945 | that case match will happen user defined order. Once the |
| 946 | community list matches to communities attribute in BGP updates it |
| 947 | return permit or deny by the community list definition. When there is |
| 948 | no matched entry, deny will be returned. When @var{community} is |
| 949 | empty it matches to any routes. |
| 950 | @end deffn |
| 951 | |
| 952 | @deffn Command {ip community-list expanded @var{name} @{permit|deny@} @var{line}} {} |
| 953 | This command defines a new expanded community list. @var{line} is a |
| 954 | string expression of communities attribute. @var{line} can include |
| 955 | regular expression to match communities attribute in BGP updates. |
| 956 | @end deffn |
| 957 | |
| 958 | @deffn Command {no ip community-list @var{name}} {} |
| 959 | @deffnx Command {no ip community-list standard @var{name}} {} |
| 960 | @deffnx Command {no ip community-list expanded @var{name}} {} |
| 961 | These commands delete community lists specified by @var{name}. All of |
| 962 | community lists shares a single name space. So community lists can be |
| 963 | removed simpley specifying community lists name. |
| 964 | @end deffn |
| 965 | |
| 966 | @deffn {Command} {show ip community-list} {} |
| 967 | @deffnx {Command} {show ip community-list @var{name}} {} |
| 968 | This command display current community list information. When |
| 969 | @var{name} is specified the specified community list's information is |
| 970 | shown. |
| 971 | |
| 972 | @example |
| 973 | # show ip community-list |
| 974 | Named Community standard list CLIST |
| 975 | permit 7675:80 7675:100 no-export |
| 976 | deny internet |
| 977 | Named Community expanded list EXPAND |
| 978 | permit : |
| 979 | |
| 980 | # show ip community-list CLIST |
| 981 | Named Community standard list CLIST |
| 982 | permit 7675:80 7675:100 no-export |
| 983 | deny internet |
| 984 | @end example |
| 985 | @end deffn |
| 986 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 987 | @node Numbered BGP Community Lists |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 988 | @subsection Numbered BGP Community Lists |
| 989 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 990 | When number is used for BGP community list name, the number has |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 991 | special meanings. Community list number in the range from 1 and 99 is |
| 992 | standard community list. Community list number in the range from 100 |
| 993 | to 199 is expanded community list. These community lists are called |
| 994 | as numbered community lists. On the other hand normal community lists |
| 995 | is called as named community lists. |
| 996 | |
| 997 | @deffn Command {ip community-list <1-99> @{permit|deny@} @var{community}} {} |
| 998 | This command defines a new community list. <1-99> is standard |
| 999 | community list number. Community list name within this range defines |
| 1000 | standard community list. When @var{community} is empty it matches to |
| 1001 | any routes. |
| 1002 | @end deffn |
| 1003 | |
| 1004 | @deffn Command {ip community-list <100-199> @{permit|deny@} @var{community}} {} |
| 1005 | This command defines a new community list. <100-199> is expanded |
| 1006 | community list number. Community list name within this range defines |
| 1007 | expanded community list. |
| 1008 | @end deffn |
| 1009 | |
| 1010 | @deffn Command {ip community-list @var{name} @{permit|deny@} @var{community}} {} |
| 1011 | When community list type is not specifed, the community list type is |
| 1012 | automatically detected. If @var{community} can be compiled into |
| 1013 | communities attribute, the community list is defined as a standard |
| 1014 | community list. Otherwise it is defined as an expanded community |
| 1015 | list. This feature is left for backward compability. Use of this |
| 1016 | feature is not recommended. |
| 1017 | @end deffn |
| 1018 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 1019 | @node BGP Community in Route Map |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1020 | @subsection BGP Community in Route Map |
| 1021 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 1022 | In Route Map (@pxref{Route Map}), we can match or set BGP |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1023 | communities attribute. Using this feature network operator can |
| 1024 | implement their network policy based on BGP communities attribute. |
| 1025 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 1026 | Following commands can be used in Route Map. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1027 | |
| 1028 | @deffn {Route Map} {match community @var{word}} {} |
| 1029 | @deffnx {Route Map} {match community @var{word} exact-match} {} |
| 1030 | This command perform match to BGP updates using community list |
| 1031 | @var{word}. When the one of BGP communities value match to the one of |
| 1032 | communities value in community list, it is match. When |
| 1033 | @code{exact-match} keyword is spcified, match happen only when BGP |
| 1034 | updates have completely same communities value specified in the |
| 1035 | community list. |
| 1036 | @end deffn |
| 1037 | |
| 1038 | @deffn {Route Map} {set community none} {} |
| 1039 | @deffnx {Route Map} {set community @var{community}} {} |
| 1040 | @deffnx {Route Map} {set community @var{community} additive} {} |
| 1041 | This command manipulate communities value in BGP updates. When |
| 1042 | @code{none} is specified as communities value, it removes entire |
| 1043 | communities attribute from BGP updates. When @var{community} is not |
| 1044 | @code{none}, specified communities value is set to BGP updates. If |
| 1045 | BGP updates already has BGP communities value, the existing BGP |
| 1046 | communities value is replaced with specified @var{community} value. |
| 1047 | When @code{additive} keyword is specified, @var{community} is appended |
| 1048 | to the existing communities value. |
| 1049 | @end deffn |
| 1050 | |
| 1051 | @deffn {Route Map} {set comm-list @var{word} delete} {} |
| 1052 | This command remove communities value from BGP communities attribute. |
| 1053 | The @var{word} is community list name. When BGP route's communities |
| 1054 | value matches to the community list @var{word}, the communities value |
| 1055 | is removed. When all of communities value is removed eventually, the |
| 1056 | BGP update's communities attribute is completely removed. |
| 1057 | @end deffn |
| 1058 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 1059 | @node Display BGP Routes by Community |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1060 | @subsection Display BGP Routes by Community |
| 1061 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 1062 | To show BGP routes which has specific BGP communities attribute, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1063 | @code{show ip bgp} command can be used. The @var{community} value and |
| 1064 | community list can be used for @code{show ip bgp} command. |
| 1065 | |
| 1066 | @deffn Command {show ip bgp community} {} |
| 1067 | @deffnx Command {show ip bgp community @var{community}} {} |
| 1068 | @deffnx Command {show ip bgp community @var{community} exact-match} {} |
| 1069 | @code{show ip bgp community} displays BGP routes which has communities |
| 1070 | attribute. When @var{community} is specified, BGP routes that matches |
| 1071 | @var{community} value is displayed. For this command, @code{internet} |
| 1072 | keyword can't be used for @var{community} value. When |
| 1073 | @code{exact-match} is specified, it display only routes that have an |
| 1074 | exact match. |
| 1075 | @end deffn |
| 1076 | |
| 1077 | @deffn Command {show ip bgp community-list @var{word}} {} |
| 1078 | @deffnx Command {show ip bgp community-list @var{word} exact-match} {} |
| 1079 | This commands display BGP routes that matches community list |
| 1080 | @var{word}. When @code{exact-match} is specified, display only routes |
| 1081 | that have an exact match. |
| 1082 | @end deffn |
| 1083 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 1084 | @node Using BGP Communities Attribute |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1085 | @subsection Using BGP Communities Attribute |
| 1086 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 1087 | Following configuration is the most typical usage of BGP communities |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1088 | attribute. AS 7675 provides upstream Internet connection to AS 100. |
| 1089 | When following configuration exists in AS 7675, AS 100 networks |
| 1090 | operator can set local preference in AS 7675 network by setting BGP |
| 1091 | communities attribute to the updates. |
| 1092 | |
| 1093 | @example |
| 1094 | router bgp 7675 |
| 1095 | neighbor 192.168.0.1 remote-as 100 |
| 1096 | neighbor 192.168.0.1 route-map RMAP in |
| 1097 | ! |
| 1098 | ip community-list 70 permit 7675:70 |
| 1099 | ip community-list 70 deny |
| 1100 | ip community-list 80 permit 7675:80 |
| 1101 | ip community-list 80 deny |
| 1102 | ip community-list 90 permit 7675:90 |
| 1103 | ip community-list 90 deny |
| 1104 | ! |
| 1105 | route-map RMAP permit 10 |
| 1106 | match community 70 |
| 1107 | set local-preference 70 |
| 1108 | ! |
| 1109 | route-map RMAP permit 20 |
| 1110 | match community 80 |
| 1111 | set local-preference 80 |
| 1112 | ! |
| 1113 | route-map RMAP permit 30 |
| 1114 | match community 90 |
| 1115 | set local-preference 90 |
| 1116 | @end example |
| 1117 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 1118 | Following configuration announce 10.0.0.0/8 from AS 100 to AS 7675. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1119 | The route has communities value 7675:80 so when above configuration |
| 1120 | exists in AS 7675, announced route's local preference will be set to |
| 1121 | value 80. |
| 1122 | |
| 1123 | @example |
| 1124 | router bgp 100 |
| 1125 | network 10.0.0.0/8 |
| 1126 | neighbor 192.168.0.2 remote-as 7675 |
| 1127 | neighbor 192.168.0.2 route-map RMAP out |
| 1128 | ! |
| 1129 | ip prefix-list PLIST permit 10.0.0.0/8 |
| 1130 | ! |
| 1131 | route-map RMAP permit 10 |
| 1132 | match ip address prefix-list PLIST |
| 1133 | set community 7675:80 |
| 1134 | @end example |
| 1135 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 1136 | Following configuration is an example of BGP route filtering using |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1137 | communities attribute. This configuration only permit BGP routes |
| 1138 | which has BGP communities value 0:80 or 0:90. Network operator can |
| 1139 | put special internal communities value at BGP border router, then |
| 1140 | limit the BGP routes announcement into the internal network. |
| 1141 | |
| 1142 | @example |
| 1143 | router bgp 7675 |
| 1144 | neighbor 192.168.0.1 remote-as 100 |
| 1145 | neighbor 192.168.0.1 route-map RMAP in |
| 1146 | ! |
| 1147 | ip community-list 1 permit 0:80 0:90 |
| 1148 | ! |
| 1149 | route-map RMAP permit in |
| 1150 | match community 1 |
| 1151 | @end example |
| 1152 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 1153 | Following exmaple filter BGP routes which has communities value 1:1. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1154 | When there is no match community-list returns deny. To avoid |
| 1155 | filtering all of routes, we need to define permit any at last. |
| 1156 | |
| 1157 | @example |
| 1158 | router bgp 7675 |
| 1159 | neighbor 192.168.0.1 remote-as 100 |
| 1160 | neighbor 192.168.0.1 route-map RMAP in |
| 1161 | ! |
| 1162 | ip community-list standard FILTER deny 1:1 |
| 1163 | ip community-list standard FILTER permit |
| 1164 | ! |
| 1165 | route-map RMAP permit 10 |
| 1166 | match community FILTER |
| 1167 | @end example |
| 1168 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 1169 | Communities value keyword @code{internet} has special meanings in |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1170 | standard community lists. In below example @code{internet} act as |
| 1171 | match any. It matches all of BGP routes even if the route does not |
| 1172 | have communities attribute at all. So community list @code{INTERNET} |
| 1173 | is same as above example's @code{FILTER}. |
| 1174 | |
| 1175 | @example |
| 1176 | ip community-list standard INTERNET deny 1:1 |
| 1177 | ip community-list standard INTERNET permit internet |
| 1178 | @end example |
| 1179 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 1180 | Following configuration is an example of communities value deletion. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1181 | With this configuration communities value 100:1 and 100:2 is removed |
| 1182 | from BGP updates. For communities value deletion, only @code{permit} |
| 1183 | community-list is used. @code{deny} community-list is ignored. |
| 1184 | |
| 1185 | @example |
| 1186 | router bgp 7675 |
| 1187 | neighbor 192.168.0.1 remote-as 100 |
| 1188 | neighbor 192.168.0.1 route-map RMAP in |
| 1189 | ! |
| 1190 | ip community-list standard DEL permit 100:1 100:2 |
| 1191 | ! |
| 1192 | route-map RMAP permit 10 |
| 1193 | set comm-list DEL delete |
| 1194 | @end example |
| 1195 | |
| 1196 | @c ----------------------------------------------------------------------- |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 1197 | @node BGP Extended Communities Attribute |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1198 | @section BGP Extended Communities Attribute |
| 1199 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 1200 | BGP extended communities attribute is introduced with MPLS VPN/BGP |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1201 | technology. MPLS VPN/BGP expands capability of network infrastructure |
| 1202 | to provide VPN functionality. At the same time it requires a new |
| 1203 | framework for policy routing. With BGP Extended Communities Attribute |
| 1204 | we can use Route Target or Site of Origin for implementing network |
| 1205 | policy for MPLS VPN/BGP. |
| 1206 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 1207 | BGP Extended Communities Attribute is similar to BGP Communities |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1208 | Attribute. It is an optional transitive attribute. BGP Extended |
| 1209 | Communities Attribute can carry multiple Extended Community value. |
| 1210 | Each Extended Community value is eight octet length. |
| 1211 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 1212 | BGP Extended Communities Attribute provides an extended range |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1213 | compared with BGP Communities Attribute. Adding to that there is a |
| 1214 | type field in each value to provides community space structure. |
| 1215 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 1216 | There are two format to define Extended Community value. One is AS |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1217 | based format the other is IP address based format. |
| 1218 | |
| 1219 | @table @code |
| 1220 | @item AS:VAL |
| 1221 | This is a format to define AS based Extended Community value. |
| 1222 | @code{AS} part is 2 octets Global Administrator subfield in Extended |
| 1223 | Community value. @code{VAL} part is 4 octets Local Administrator |
| 1224 | subfield. @code{7675:100} represents AS 7675 policy value 100. |
| 1225 | @item IP-Address:VAL |
| 1226 | This is a format to define IP address based Extended Community value. |
| 1227 | @code{IP-Address} part is 4 octets Global Administrator subfield. |
| 1228 | @code{VAL} part is 2 octets Local Administrator subfield. |
| 1229 | @code{10.0.0.1:100} represents |
| 1230 | @end table |
| 1231 | |
| 1232 | @menu |
| 1233 | * BGP Extended Community Lists:: |
| 1234 | * BGP Extended Communities in Route Map:: |
| 1235 | @end menu |
| 1236 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 1237 | @node BGP Extended Community Lists |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1238 | @subsection BGP Extended Community Lists |
| 1239 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 1240 | Expanded Community Lists is a user defined BGP Expanded Community |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1241 | Lists. |
| 1242 | |
| 1243 | @deffn Command {ip extcommunity-list standard @var{name} @{permit|deny@} @var{extcommunity}} {} |
| 1244 | This command defines a new standard extcommunity-list. |
| 1245 | @var{extcommunity} is extended communities value. The |
| 1246 | @var{extcommunity} is compiled into extended community structure. We |
| 1247 | can define multiple extcommunity-list under same name. In that case |
| 1248 | match will happen user defined order. Once the extcommunity-list |
| 1249 | matches to extended communities attribute in BGP updates it return |
| 1250 | permit or deny based upon the extcommunity-list definition. When |
| 1251 | there is no matched entry, deny will be returned. When |
| 1252 | @var{extcommunity} is empty it matches to any routes. |
| 1253 | @end deffn |
| 1254 | |
| 1255 | @deffn Command {ip extcommunity-list expanded @var{name} @{permit|deny@} @var{line}} {} |
| 1256 | This command defines a new expanded extcommunity-list. @var{line} is |
| 1257 | a string expression of extended communities attribute. @var{line} can |
| 1258 | include regular expression to match extended communities attribute in |
| 1259 | BGP updates. |
| 1260 | @end deffn |
| 1261 | |
| 1262 | @deffn Command {no ip extcommunity-list @var{name}} {} |
| 1263 | @deffnx Command {no ip extcommunity-list standard @var{name}} {} |
| 1264 | @deffnx Command {no ip extcommunity-list expanded @var{name}} {} |
| 1265 | These commands delete extended community lists specified by |
| 1266 | @var{name}. All of extended community lists shares a single name |
| 1267 | space. So extended community lists can be removed simpley specifying |
| 1268 | the name. |
| 1269 | @end deffn |
| 1270 | |
| 1271 | @deffn {Command} {show ip extcommunity-list} {} |
| 1272 | @deffnx {Command} {show ip extcommunity-list @var{name}} {} |
| 1273 | This command display current extcommunity-list information. When |
| 1274 | @var{name} is specified the community list's information is shown. |
| 1275 | |
| 1276 | @example |
| 1277 | # show ip extcommunity-list |
| 1278 | @end example |
| 1279 | @end deffn |
| 1280 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 1281 | @node BGP Extended Communities in Route Map |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1282 | @subsection BGP Extended Communities in Route Map |
| 1283 | |
| 1284 | @deffn {Route Map} {match extcommunity @var{word}} {} |
| 1285 | @end deffn |
| 1286 | |
| 1287 | @deffn {Route Map} {set extcommunity rt @var{extcommunity}} {} |
| 1288 | This command set Route Target value. |
| 1289 | @end deffn |
| 1290 | |
| 1291 | @deffn {Route Map} {set extcommunity soo @var{extcommunity}} {} |
| 1292 | This command set Site of Origin value. |
| 1293 | @end deffn |
| 1294 | |
| 1295 | @c ----------------------------------------------------------------------- |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 1296 | @node Displaying BGP routes |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1297 | @section Displaying BGP Routes |
| 1298 | |
| 1299 | @menu |
| 1300 | * Show IP BGP:: |
| 1301 | * More Show IP BGP:: |
| 1302 | @end menu |
| 1303 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 1304 | @node Show IP BGP |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1305 | @subsection Show IP BGP |
| 1306 | |
| 1307 | @deffn {Command} {show ip bgp} {} |
| 1308 | @deffnx {Command} {show ip bgp @var{A.B.C.D}} {} |
| 1309 | @deffnx {Command} {show ip bgp @var{X:X::X:X}} {} |
| 1310 | This command displays BGP routes. When no route is specified it |
| 1311 | display all of IPv4 BGP routes. |
| 1312 | @end deffn |
| 1313 | |
| 1314 | @example |
| 1315 | BGP table version is 0, local router ID is 10.1.1.1 |
| 1316 | Status codes: s suppressed, d damped, h history, * valid, > best, i - internal |
| 1317 | Origin codes: i - IGP, e - EGP, ? - incomplete |
| 1318 | |
| 1319 | Network Next Hop Metric LocPrf Weight Path |
| 1320 | *> 1.1.1.1/32 0.0.0.0 0 32768 i |
| 1321 | |
| 1322 | Total number of prefixes 1 |
| 1323 | @end example |
| 1324 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 1325 | @node More Show IP BGP |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1326 | @subsection More Show IP BGP |
| 1327 | |
| 1328 | @deffn {Command} {show ip bgp regexp @var{line}} {} |
| 1329 | This command display BGP routes using AS path regular expression (@pxref{Display BGP Routes by AS Path}). |
| 1330 | @end deffn |
| 1331 | |
| 1332 | @deffn Command {show ip bgp community @var{community}} {} |
| 1333 | @deffnx Command {show ip bgp community @var{community} exact-match} {} |
| 1334 | This command display BGP routes using @var{community} (@pxref{Display |
| 1335 | BGP Routes by Community}). |
| 1336 | @end deffn |
| 1337 | |
| 1338 | @deffn Command {show ip bgp community-list @var{word}} {} |
| 1339 | @deffnx Command {show ip bgp community-list @var{word} exact-match} {} |
| 1340 | This command display BGP routes using community list (@pxref{Display |
| 1341 | BGP Routes by Community}). |
| 1342 | @end deffn |
| 1343 | |
| 1344 | @deffn {Command} {show ip bgp summary} {} |
| 1345 | @end deffn |
| 1346 | |
| 1347 | @deffn {Command} {show ip bgp neighbor [@var{peer}]} {} |
| 1348 | @end deffn |
| 1349 | |
| 1350 | @deffn {Command} {clear ip bgp @var{peer}} {} |
| 1351 | Clear peers which have addresses of X.X.X.X |
| 1352 | @end deffn |
| 1353 | |
| 1354 | @deffn {Command} {clear ip bgp @var{peer} soft in} {} |
| 1355 | Clear peer using soft reconfiguration. |
| 1356 | @end deffn |
| 1357 | |
Alexandre Chappuis | c31e572 | 2011-09-11 16:54:11 +0400 | [diff] [blame] | 1358 | @deffn {Command} {show ip bgp dampened-paths} {} |
| 1359 | Display paths suppressed due to dampening |
| 1360 | @end deffn |
| 1361 | |
| 1362 | @deffn {Command} {show ip bgp flap-statistics} {} |
| 1363 | Display flap statistics of routes |
| 1364 | @end deffn |
| 1365 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1366 | @deffn {Command} {show debug} {} |
| 1367 | @end deffn |
| 1368 | |
| 1369 | @deffn {Command} {debug event} {} |
| 1370 | @end deffn |
| 1371 | |
| 1372 | @deffn {Command} {debug update} {} |
| 1373 | @end deffn |
| 1374 | |
| 1375 | @deffn {Command} {debug keepalive} {} |
| 1376 | @end deffn |
| 1377 | |
| 1378 | @deffn {Command} {no debug event} {} |
| 1379 | @end deffn |
| 1380 | |
| 1381 | @deffn {Command} {no debug update} {} |
| 1382 | @end deffn |
| 1383 | |
| 1384 | @deffn {Command} {no debug keepalive} {} |
| 1385 | @end deffn |
| 1386 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 1387 | @node Capability Negotiation |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1388 | @section Capability Negotiation |
| 1389 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 1390 | When adding IPv6 routing information exchange feature to BGP. There |
| 1391 | were some proposals. @acronym{IETF,Internet Engineering Task Force} |
| 1392 | @acronym{IDR, Inter Domain Routing} @acronym{WG, Working group} adopted |
| 1393 | a proposal called Multiprotocol Extension for BGP. The specification |
| 1394 | is described in @cite{RFC2283}. The protocol does not define new protocols. |
| 1395 | It defines new attributes to existing BGP. When it is used exchanging |
| 1396 | IPv6 routing information it is called BGP-4+. When it is used for |
| 1397 | exchanging multicast routing information it is called MBGP. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1398 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 1399 | @command{bgpd} supports Multiprotocol Extension for BGP. So if remote |
| 1400 | peer supports the protocol, @command{bgpd} can exchange IPv6 and/or |
| 1401 | multicast routing information. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1402 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 1403 | Traditional BGP did not have the feature to detect remote peer's |
| 1404 | capabilities, e.g. whether it can handle prefix types other than IPv4 |
| 1405 | unicast routes. This was a big problem using Multiprotocol Extension |
| 1406 | for BGP to operational network. @cite{RFC2842, Capabilities |
| 1407 | Advertisement with BGP-4} adopted a feature called Capability |
| 1408 | Negotiation. @command{bgpd} use this Capability Negotiation to detect |
| 1409 | the remote peer's capabilities. If the peer is only configured as IPv4 |
| 1410 | unicast neighbor, @command{bgpd} does not send these Capability |
| 1411 | Negotiation packets (at least not unless other optional BGP features |
| 1412 | require capability negotation). |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1413 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 1414 | By default, Quagga will bring up peering with minimal common capability |
| 1415 | for the both sides. For example, local router has unicast and |
| 1416 | multicast capabilitie and remote router has unicast capability. In |
| 1417 | this case, the local router will establish the connection with unicast |
| 1418 | only capability. When there are no common capabilities, Quagga sends |
| 1419 | Unsupported Capability error and then resets the connection. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1420 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 1421 | If you want to completely match capabilities with remote peer. Please |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1422 | use @command{strict-capability-match} command. |
| 1423 | |
| 1424 | @deffn {BGP} {neighbor @var{peer} strict-capability-match} {} |
| 1425 | @deffnx {BGP} {no neighbor @var{peer} strict-capability-match} {} |
| 1426 | Strictly compares remote capabilities and local capabilities. If capabilities |
| 1427 | are different, send Unsupported Capability error then reset connection. |
| 1428 | @end deffn |
| 1429 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 1430 | You may want to disable sending Capability Negotiation OPEN message |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1431 | optional parameter to the peer when remote peer does not implement |
| 1432 | Capability Negotiation. Please use @command{dont-capability-negotiate} |
| 1433 | command to disable the feature. |
| 1434 | |
| 1435 | @deffn {BGP} {neighbor @var{peer} dont-capability-negotiate} {} |
| 1436 | @deffnx {BGP} {no neighbor @var{peer} dont-capability-negotiate} {} |
| 1437 | Suppress sending Capability Negotiation as OPEN message optional |
| 1438 | parameter to the peer. This command only affects the peer is configured |
| 1439 | other than IPv4 unicast configuration. |
| 1440 | @end deffn |
| 1441 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 1442 | When remote peer does not have capability negotiation feature, remote |
| 1443 | peer will not send any capabilities at all. In that case, bgp |
| 1444 | configures the peer with configured capabilities. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1445 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 1446 | You may prefer locally configured capabilities more than the negotiated |
| 1447 | capabilities even though remote peer sends capabilities. If the peer |
| 1448 | is configured by @command{override-capability}, @command{bgpd} ignores |
| 1449 | received capabilities then override negotiated capabilities with |
| 1450 | configured values. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1451 | |
| 1452 | @deffn {BGP} {neighbor @var{peer} override-capability} {} |
| 1453 | @deffnx {BGP} {no neighbor @var{peer} override-capability} {} |
| 1454 | Override the result of Capability Negotiation with local configuration. |
| 1455 | Ignore remote peer's capability value. |
| 1456 | @end deffn |
| 1457 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 1458 | @node Route Reflector |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1459 | @section Route Reflector |
| 1460 | |
| 1461 | @deffn {BGP} {bgp cluster-id @var{a.b.c.d}} {} |
| 1462 | @end deffn |
| 1463 | |
| 1464 | @deffn {BGP} {neighbor @var{peer} route-reflector-client} {} |
| 1465 | @deffnx {BGP} {no neighbor @var{peer} route-reflector-client} {} |
| 1466 | @end deffn |
| 1467 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 1468 | @node Route Server |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1469 | @section Route Server |
| 1470 | |
| 1471 | At an Internet Exchange point, many ISPs are connected to each other by |
| 1472 | external BGP peering. Normally these external BGP connection are done by |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 1473 | @samp{full mesh} method. As with internal BGP full mesh formation, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1474 | this method has a scaling problem. |
| 1475 | |
| 1476 | This scaling problem is well known. Route Server is a method to resolve |
| 1477 | the problem. Each ISP's BGP router only peers to Route Server. Route |
| 1478 | Server serves as BGP information exchange to other BGP routers. By |
| 1479 | applying this method, numbers of BGP connections is reduced from |
| 1480 | O(n*(n-1)/2) to O(n). |
| 1481 | |
| 1482 | Unlike normal BGP router, Route Server must have several routing tables |
| 1483 | for managing different routing policies for each BGP speaker. We call the |
| 1484 | routing tables as different @code{view}s. @command{bgpd} can work as |
| 1485 | normal BGP router or Route Server or both at the same time. |
| 1486 | |
| 1487 | @menu |
| 1488 | * Multiple instance:: |
| 1489 | * BGP instance and view:: |
| 1490 | * Routing policy:: |
| 1491 | * Viewing the view:: |
| 1492 | @end menu |
| 1493 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 1494 | @node Multiple instance |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1495 | @subsection Multiple instance |
| 1496 | |
| 1497 | To enable multiple view function of @code{bgpd}, you must turn on |
| 1498 | multiple instance feature beforehand. |
| 1499 | |
| 1500 | @deffn {Command} {bgp multiple-instance} {} |
| 1501 | Enable BGP multiple instance feature. After this feature is enabled, |
| 1502 | you can make multiple BGP instances or multiple BGP views. |
| 1503 | @end deffn |
| 1504 | |
| 1505 | @deffn {Command} {no bgp multiple-instance} {} |
| 1506 | Disable BGP multiple instance feature. You can not disable this feature |
| 1507 | when BGP multiple instances or views exist. |
| 1508 | @end deffn |
| 1509 | |
| 1510 | When you want to make configuration more Cisco like one, |
| 1511 | |
| 1512 | @deffn {Command} {bgp config-type cisco} {} |
| 1513 | Cisco compatible BGP configuration output. |
| 1514 | @end deffn |
| 1515 | |
| 1516 | When bgp config-type cisco is specified, |
| 1517 | |
| 1518 | ``no synchronization'' is displayed. |
Ivan Moskalyov | 2b09e21 | 2010-03-11 17:14:35 +0300 | [diff] [blame] | 1519 | ``no auto-summary'' is displayed. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1520 | |
| 1521 | ``network'' and ``aggregate-address'' argument is displayed as |
| 1522 | ``A.B.C.D M.M.M.M'' |
| 1523 | |
paul | 7190f4e | 2003-08-12 12:40:20 +0000 | [diff] [blame] | 1524 | Quagga: network 10.0.0.0/8 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1525 | Cisco: network 10.0.0.0 |
| 1526 | |
paul | 7190f4e | 2003-08-12 12:40:20 +0000 | [diff] [blame] | 1527 | Quagga: aggregate-address 192.168.0.0/24 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1528 | Cisco: aggregate-address 192.168.0.0 255.255.255.0 |
| 1529 | |
| 1530 | Community attribute handling is also different. If there is no |
| 1531 | configuration is specified community attribute and extended community |
| 1532 | attribute are sent to neighbor. When user manually disable the |
| 1533 | feature community attribute is not sent to the neighbor. In case of |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 1534 | @command{bgp config-type cisco} is specified, community attribute is not |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1535 | sent to the neighbor by default. To send community attribute user has |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 1536 | to specify @command{neighbor A.B.C.D send-community} command. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1537 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 1538 | @example |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1539 | ! |
| 1540 | router bgp 1 |
| 1541 | neighbor 10.0.0.1 remote-as 1 |
| 1542 | no neighbor 10.0.0.1 send-community |
| 1543 | ! |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1544 | router bgp 1 |
| 1545 | neighbor 10.0.0.1 remote-as 1 |
| 1546 | neighbor 10.0.0.1 send-community |
| 1547 | ! |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 1548 | @end example |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1549 | |
| 1550 | @deffn {Command} {bgp config-type zebra} {} |
paul | 7190f4e | 2003-08-12 12:40:20 +0000 | [diff] [blame] | 1551 | Quagga style BGP configuration. This is default. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1552 | @end deffn |
| 1553 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 1554 | @node BGP instance and view |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1555 | @subsection BGP instance and view |
| 1556 | |
| 1557 | BGP instance is a normal BGP process. The result of route selection |
| 1558 | goes to the kernel routing table. You can setup different AS at the |
| 1559 | same time when BGP multiple instance feature is enabled. |
| 1560 | |
| 1561 | @deffn {Command} {router bgp @var{as-number}} {} |
| 1562 | Make a new BGP instance. You can use arbitrary word for the @var{name}. |
| 1563 | @end deffn |
| 1564 | |
| 1565 | @example |
| 1566 | @group |
| 1567 | bgp multiple-instance |
| 1568 | ! |
| 1569 | router bgp 1 |
| 1570 | neighbor 10.0.0.1 remote-as 2 |
| 1571 | neighbor 10.0.0.2 remote-as 3 |
| 1572 | ! |
| 1573 | router bgp 2 |
| 1574 | neighbor 10.0.0.3 remote-as 4 |
| 1575 | neighbor 10.0.0.4 remote-as 5 |
| 1576 | @end group |
| 1577 | @end example |
| 1578 | |
| 1579 | BGP view is almost same as normal BGP process. The result of |
| 1580 | route selection does not go to the kernel routing table. BGP view is |
| 1581 | only for exchanging BGP routing information. |
| 1582 | |
| 1583 | @deffn {Command} {router bgp @var{as-number} view @var{name}} {} |
| 1584 | Make a new BGP view. You can use arbitrary word for the @var{name}. This |
| 1585 | view's route selection result does not go to the kernel routing table. |
| 1586 | @end deffn |
| 1587 | |
| 1588 | With this command, you can setup Route Server like below. |
| 1589 | |
| 1590 | @example |
| 1591 | @group |
| 1592 | bgp multiple-instance |
| 1593 | ! |
| 1594 | router bgp 1 view 1 |
| 1595 | neighbor 10.0.0.1 remote-as 2 |
| 1596 | neighbor 10.0.0.2 remote-as 3 |
| 1597 | ! |
| 1598 | router bgp 2 view 2 |
| 1599 | neighbor 10.0.0.3 remote-as 4 |
| 1600 | neighbor 10.0.0.4 remote-as 5 |
| 1601 | @end group |
| 1602 | @end example |
| 1603 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 1604 | @node Routing policy |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1605 | @subsection Routing policy |
| 1606 | |
| 1607 | You can set different routing policy for a peer. For example, you can |
| 1608 | set different filter for a peer. |
| 1609 | |
| 1610 | @example |
| 1611 | @group |
| 1612 | bgp multiple-instance |
| 1613 | ! |
| 1614 | router bgp 1 view 1 |
| 1615 | neighbor 10.0.0.1 remote-as 2 |
| 1616 | neighbor 10.0.0.1 distribute-list 1 in |
| 1617 | ! |
| 1618 | router bgp 1 view 2 |
| 1619 | neighbor 10.0.0.1 remote-as 2 |
| 1620 | neighbor 10.0.0.1 distribute-list 2 in |
| 1621 | @end group |
| 1622 | @end example |
| 1623 | |
| 1624 | This means BGP update from a peer 10.0.0.1 goes to both BGP view 1 and view |
| 1625 | 2. When the update is inserted into view 1, distribute-list 1 is |
| 1626 | applied. On the other hand, when the update is inserted into view 2, |
| 1627 | distribute-list 2 is applied. |
| 1628 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 1629 | @node Viewing the view |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1630 | @subsection Viewing the view |
| 1631 | |
| 1632 | To display routing table of BGP view, you must specify view name. |
| 1633 | |
| 1634 | @deffn {Command} {show ip bgp view @var{name}} {} |
| 1635 | Display routing table of BGP view @var{name}. |
| 1636 | @end deffn |
| 1637 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 1638 | @node How to set up a 6-Bone connection |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1639 | @section How to set up a 6-Bone connection |
| 1640 | |
paul | 6a22b1f | 2004-11-07 19:39:13 +0000 | [diff] [blame] | 1641 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1642 | @example |
| 1643 | @group |
| 1644 | zebra configuration |
| 1645 | =================== |
| 1646 | ! |
| 1647 | ! Actually there is no need to configure zebra |
| 1648 | ! |
| 1649 | |
| 1650 | bgpd configuration |
| 1651 | ================== |
| 1652 | ! |
| 1653 | ! This means that routes go through zebra and into the kernel. |
| 1654 | ! |
| 1655 | router zebra |
| 1656 | ! |
| 1657 | ! MP-BGP configuration |
| 1658 | ! |
| 1659 | router bgp 7675 |
| 1660 | bgp router-id 10.0.0.1 |
| 1661 | neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 remote-as @var{as-number} |
| 1662 | ! |
| 1663 | address-family ipv6 |
| 1664 | network 3ffe:506::/32 |
| 1665 | neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 activate |
| 1666 | neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 route-map set-nexthop out |
| 1667 | neighbor 3ffe:1cfa:0:2:2c0:4fff:fe68:a231 remote-as @var{as-number} |
| 1668 | neighbor 3ffe:1cfa:0:2:2c0:4fff:fe68:a231 route-map set-nexthop out |
| 1669 | exit-address-family |
| 1670 | ! |
| 1671 | ipv6 access-list all permit any |
| 1672 | ! |
| 1673 | ! Set output nexthop address. |
| 1674 | ! |
| 1675 | route-map set-nexthop permit 10 |
| 1676 | match ipv6 address all |
| 1677 | set ipv6 nexthop global 3ffe:1cfa:0:2:2c0:4fff:fe68:a225 |
| 1678 | set ipv6 nexthop local fe80::2c0:4fff:fe68:a225 |
| 1679 | ! |
| 1680 | ! logfile FILENAME is obsolete. Please use log file FILENAME |
paul | 7190f4e | 2003-08-12 12:40:20 +0000 | [diff] [blame] | 1681 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1682 | log file bgpd.log |
| 1683 | ! |
| 1684 | @end group |
| 1685 | @end example |
| 1686 | |
paul | 76b89b4 | 2004-11-06 17:13:09 +0000 | [diff] [blame] | 1687 | @node Dump BGP packets and table |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1688 | @section Dump BGP packets and table |
| 1689 | |
Alexis Fasquel | dbe99e0 | 2015-11-16 13:55:16 -0500 | [diff] [blame] | 1690 | @deffn Command {dump bgp all @var{path} [@var{interval}]} {} |
| 1691 | @deffnx Command {dump bgp all-et @var{path} [@var{interval}]} {} |
| 1692 | @deffnx Command {no dump bgp all [@var{path}] [@var{interval}]} {} |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1693 | Dump all BGP packet and events to @var{path} file. |
Alexis Fasquel | dbe99e0 | 2015-11-16 13:55:16 -0500 | [diff] [blame] | 1694 | If @var{interval} is set, a new file will be created for echo @var{interval} of seconds. |
| 1695 | The path @var{path} can be set with date and time formatting (strftime). |
| 1696 | The type ‘all-et’ enables support for Extended Timestamp Header (@pxref{Packet Binary Dump Format}). |
| 1697 | (@pxref{Packet Binary Dump Format}) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1698 | @end deffn |
| 1699 | |
Alexis Fasquel | dbe99e0 | 2015-11-16 13:55:16 -0500 | [diff] [blame] | 1700 | @deffn Command {dump bgp updates @var{path} [@var{interval}]} {} |
| 1701 | @deffnx Command {dump bgp updates-et @var{path} [@var{interval}]} {} |
| 1702 | @deffnx Command {no dump bgp updates [@var{path}] [@var{interval}]} {} |
| 1703 | Dump only BGP updates messages to @var{path} file. |
| 1704 | If @var{interval} is set, a new file will be created for echo @var{interval} of seconds. |
| 1705 | The path @var{path} can be set with date and time formatting (strftime). |
| 1706 | The type ‘updates-et’ enables support for Extended Timestamp Header (@pxref{Packet Binary Dump Format}). |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1707 | @end deffn |
| 1708 | |
Alexis Fasquel | dbe99e0 | 2015-11-16 13:55:16 -0500 | [diff] [blame] | 1709 | @deffn Command {dump bgp routes-mrt @var{path}} {} |
| 1710 | @deffnx Command {dump bgp routes-mrt @var{path} @var{interval}} {} |
| 1711 | @deffnx Command {no dump bgp route-mrt [@var{path}] [@var{interval}]} {} |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1712 | Dump whole BGP routing table to @var{path}. This is heavy process. |
Alexis Fasquel | dbe99e0 | 2015-11-16 13:55:16 -0500 | [diff] [blame] | 1713 | The path @var{path} can be set with date and time formatting (strftime). |
| 1714 | If @var{interval} is set, a new file will be created for echo @var{interval} of seconds. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1715 | @end deffn |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 1716 | |
Alexis Fasquel | dbe99e0 | 2015-11-16 13:55:16 -0500 | [diff] [blame] | 1717 | Note: the interval variable can also be set using hours and minutes: 04h20m00. |
| 1718 | |
| 1719 | |
paul | aa5943f | 2005-11-04 21:53:59 +0000 | [diff] [blame] | 1720 | @node BGP Configuration Examples |
| 1721 | @section BGP Configuration Examples |
| 1722 | |
| 1723 | Example of a session to an upstream, advertising only one prefix to it. |
| 1724 | |
| 1725 | @example |
| 1726 | router bgp 64512 |
| 1727 | bgp router-id 10.236.87.1 |
| 1728 | network 10.236.87.0/24 |
| 1729 | neighbor upstream peer-group |
| 1730 | neighbor upstream remote-as 64515 |
| 1731 | neighbor upstream capability dynamic |
| 1732 | neighbor upstream prefix-list pl-allowed-adv out |
| 1733 | neighbor 10.1.1.1 peer-group upstream |
| 1734 | neighbor 10.1.1.1 description ACME ISP |
| 1735 | ! |
| 1736 | ip prefix-list pl-allowed-adv seq 5 permit 82.195.133.0/25 |
| 1737 | ip prefix-list pl-allowed-adv seq 10 deny any |
| 1738 | |
| 1739 | @end example |
| 1740 | |
| 1741 | A more complex example. With upstream, peer and customer sessions. |
| 1742 | Advertising global prefixes and NO_EXPORT prefixes and providing |
| 1743 | actions for customer routes based on community values. Extensive use of |
| 1744 | route-maps and the 'call' feature to support selective advertising of |
| 1745 | prefixes. This example is intended as guidance only, it has NOT been |
| 1746 | tested and almost certainly containts silly mistakes, if not serious |
| 1747 | flaws. |
| 1748 | |
| 1749 | @example |
| 1750 | router bgp 64512 |
| 1751 | bgp router-id 10.236.87.1 |
| 1752 | network 10.123.456.0/24 |
| 1753 | network 10.123.456.128/25 route-map rm-no-export |
| 1754 | neighbor upstream capability dynamic |
| 1755 | neighbor upstream route-map rm-upstream-out out |
| 1756 | neighbor cust capability dynamic |
| 1757 | neighbor cust route-map rm-cust-in in |
| 1758 | neighbor cust route-map rm-cust-out out |
| 1759 | neighbor cust send-community both |
| 1760 | neighbor peer capability dynamic |
| 1761 | neighbor peer route-map rm-peer-in in |
| 1762 | neighbor peer route-map rm-peer-out out |
| 1763 | neighbor peer send-community both |
| 1764 | neighbor 10.1.1.1 remote-as 64515 |
| 1765 | neighbor 10.1.1.1 peer-group upstream |
| 1766 | neighbor 10.2.1.1 remote-as 64516 |
| 1767 | neighbor 10.2.1.1 peer-group upstream |
| 1768 | neighbor 10.3.1.1 remote-as 64517 |
| 1769 | neighbor 10.3.1.1 peer-group cust-default |
| 1770 | neighbor 10.3.1.1 description customer1 |
| 1771 | neighbor 10.3.1.1 prefix-list pl-cust1-network in |
| 1772 | neighbor 10.4.1.1 remote-as 64518 |
| 1773 | neighbor 10.4.1.1 peer-group cust |
| 1774 | neighbor 10.4.1.1 prefix-list pl-cust2-network in |
| 1775 | neighbor 10.4.1.1 description customer2 |
| 1776 | neighbor 10.5.1.1 remote-as 64519 |
| 1777 | neighbor 10.5.1.1 peer-group peer |
| 1778 | neighbor 10.5.1.1 prefix-list pl-peer1-network in |
| 1779 | neighbor 10.5.1.1 description peer AS 1 |
| 1780 | neighbor 10.6.1.1 remote-as 64520 |
| 1781 | neighbor 10.6.1.1 peer-group peer |
| 1782 | neighbor 10.6.1.1 prefix-list pl-peer2-network in |
| 1783 | neighbor 10.6.1.1 description peer AS 2 |
| 1784 | ! |
| 1785 | ip prefix-list pl-default permit 0.0.0.0/0 |
| 1786 | ! |
| 1787 | ip prefix-list pl-upstream-peers permit 10.1.1.1/32 |
| 1788 | ip prefix-list pl-upstream-peers permit 10.2.1.1/32 |
| 1789 | ! |
| 1790 | ip prefix-list pl-cust1-network permit 10.3.1.0/24 |
| 1791 | ip prefix-list pl-cust1-network permit 10.3.2.0/24 |
| 1792 | ! |
| 1793 | ip prefix-list pl-cust2-network permit 10.4.1.0/24 |
| 1794 | ! |
| 1795 | ip prefix-list pl-peer1-network permit 10.5.1.0/24 |
| 1796 | ip prefix-list pl-peer1-network permit 10.5.2.0/24 |
| 1797 | ip prefix-list pl-peer1-network permit 192.168.0.0/24 |
| 1798 | ! |
| 1799 | ip prefix-list pl-peer2-network permit 10.6.1.0/24 |
| 1800 | ip prefix-list pl-peer2-network permit 10.6.2.0/24 |
| 1801 | ip prefix-list pl-peer2-network permit 192.168.1.0/24 |
| 1802 | ip prefix-list pl-peer2-network permit 192.168.2.0/24 |
| 1803 | ip prefix-list pl-peer2-network permit 172.16.1/24 |
| 1804 | ! |
| 1805 | ip as-path access-list asp-own-as permit ^$ |
| 1806 | ip as-path access-list asp-own-as permit _64512_ |
| 1807 | ! |
| 1808 | ! ################################################################# |
| 1809 | ! Match communities we provide actions for, on routes receives from |
| 1810 | ! customers. Communities values of <our-ASN>:X, with X, have actions: |
| 1811 | ! |
| 1812 | ! 100 - blackhole the prefix |
| 1813 | ! 200 - set no_export |
| 1814 | ! 300 - advertise only to other customers |
| 1815 | ! 400 - advertise only to upstreams |
| 1816 | ! 500 - set no_export when advertising to upstreams |
| 1817 | ! 2X00 - set local_preference to X00 |
| 1818 | ! |
| 1819 | ! blackhole the prefix of the route |
| 1820 | ip community-list standard cm-blackhole permit 64512:100 |
| 1821 | ! |
| 1822 | ! set no-export community before advertising |
| 1823 | ip community-list standard cm-set-no-export permit 64512:200 |
| 1824 | ! |
| 1825 | ! advertise only to other customers |
| 1826 | ip community-list standard cm-cust-only permit 64512:300 |
| 1827 | ! |
| 1828 | ! advertise only to upstreams |
| 1829 | ip community-list standard cm-upstream-only permit 64512:400 |
| 1830 | ! |
| 1831 | ! advertise to upstreams with no-export |
| 1832 | ip community-list standard cm-upstream-noexport permit 64512:500 |
| 1833 | ! |
| 1834 | ! set local-pref to least significant 3 digits of the community |
| 1835 | ip community-list standard cm-prefmod-100 permit 64512:2100 |
| 1836 | ip community-list standard cm-prefmod-200 permit 64512:2200 |
| 1837 | ip community-list standard cm-prefmod-300 permit 64512:2300 |
| 1838 | ip community-list standard cm-prefmod-400 permit 64512:2400 |
| 1839 | ip community-list expanded cme-prefmod-range permit 64512:2... |
| 1840 | ! |
| 1841 | ! Informational communities |
| 1842 | ! |
| 1843 | ! 3000 - learned from upstream |
| 1844 | ! 3100 - learned from customer |
| 1845 | ! 3200 - learned from peer |
| 1846 | ! |
| 1847 | ip community-list standard cm-learnt-upstream permit 64512:3000 |
| 1848 | ip community-list standard cm-learnt-cust permit 64512:3100 |
| 1849 | ip community-list standard cm-learnt-peer permit 64512:3200 |
| 1850 | ! |
| 1851 | ! ################################################################### |
| 1852 | ! Utility route-maps |
| 1853 | ! |
| 1854 | ! These utility route-maps generally should not used to permit/deny |
| 1855 | ! routes, i.e. they do not have meaning as filters, and hence probably |
| 1856 | ! should be used with 'on-match next'. These all finish with an empty |
| 1857 | ! permit entry so as not interfere with processing in the caller. |
| 1858 | ! |
| 1859 | route-map rm-no-export permit 10 |
| 1860 | set community additive no-export |
| 1861 | route-map rm-no-export permit 20 |
| 1862 | ! |
| 1863 | route-map rm-blackhole permit 10 |
| 1864 | description blackhole, up-pref and ensure it cant escape this AS |
| 1865 | set ip next-hop 127.0.0.1 |
| 1866 | set local-preference 10 |
| 1867 | set community additive no-export |
| 1868 | route-map rm-blackhole permit 20 |
| 1869 | ! |
| 1870 | ! Set local-pref as requested |
| 1871 | route-map rm-prefmod permit 10 |
| 1872 | match community cm-prefmod-100 |
| 1873 | set local-preference 100 |
| 1874 | route-map rm-prefmod permit 20 |
| 1875 | match community cm-prefmod-200 |
| 1876 | set local-preference 200 |
| 1877 | route-map rm-prefmod permit 30 |
| 1878 | match community cm-prefmod-300 |
| 1879 | set local-preference 300 |
| 1880 | route-map rm-prefmod permit 40 |
| 1881 | match community cm-prefmod-400 |
| 1882 | set local-preference 400 |
| 1883 | route-map rm-prefmod permit 50 |
| 1884 | ! |
| 1885 | ! Community actions to take on receipt of route. |
| 1886 | route-map rm-community-in permit 10 |
| 1887 | description check for blackholing, no point continuing if it matches. |
| 1888 | match community cm-blackhole |
| 1889 | call rm-blackhole |
| 1890 | route-map rm-community-in permit 20 |
| 1891 | match community cm-set-no-export |
| 1892 | call rm-no-export |
| 1893 | on-match next |
| 1894 | route-map rm-community-in permit 30 |
| 1895 | match community cme-prefmod-range |
| 1896 | call rm-prefmod |
| 1897 | route-map rm-community-in permit 40 |
| 1898 | ! |
| 1899 | ! ##################################################################### |
| 1900 | ! Community actions to take when advertising a route. |
| 1901 | ! These are filtering route-maps, |
| 1902 | ! |
| 1903 | ! Deny customer routes to upstream with cust-only set. |
| 1904 | route-map rm-community-filt-to-upstream deny 10 |
| 1905 | match community cm-learnt-cust |
| 1906 | match community cm-cust-only |
| 1907 | route-map rm-community-filt-to-upstream permit 20 |
| 1908 | ! |
| 1909 | ! Deny customer routes to other customers with upstream-only set. |
| 1910 | route-map rm-community-filt-to-cust deny 10 |
| 1911 | match community cm-learnt-cust |
| 1912 | match community cm-upstream-only |
| 1913 | route-map rm-community-filt-to-cust permit 20 |
| 1914 | ! |
| 1915 | ! ################################################################### |
| 1916 | ! The top-level route-maps applied to sessions. Further entries could |
| 1917 | ! be added obviously.. |
| 1918 | ! |
| 1919 | ! Customers |
| 1920 | route-map rm-cust-in permit 10 |
| 1921 | call rm-community-in |
| 1922 | on-match next |
| 1923 | route-map rm-cust-in permit 20 |
| 1924 | set community additive 64512:3100 |
| 1925 | route-map rm-cust-in permit 30 |
| 1926 | ! |
| 1927 | route-map rm-cust-out permit 10 |
| 1928 | call rm-community-filt-to-cust |
| 1929 | on-match next |
| 1930 | route-map rm-cust-out permit 20 |
| 1931 | ! |
| 1932 | ! Upstream transit ASes |
| 1933 | route-map rm-upstream-out permit 10 |
| 1934 | description filter customer prefixes which are marked cust-only |
| 1935 | call rm-community-filt-to-upstream |
| 1936 | on-match next |
| 1937 | route-map rm-upstream-out permit 20 |
| 1938 | description only customer routes are provided to upstreams/peers |
| 1939 | match community cm-learnt-cust |
| 1940 | ! |
| 1941 | ! Peer ASes |
| 1942 | ! outbound policy is same as for upstream |
| 1943 | route-map rm-peer-out permit 10 |
| 1944 | call rm-upstream-out |
| 1945 | ! |
| 1946 | route-map rm-peer-in permit 10 |
| 1947 | set community additive 64512:3200 |
| 1948 | @end example |