blob: cfe904127fae92609060d589a8cf460cdbd2351d [file] [log] [blame]
paulfbaf39e2004-11-15 00:45:44 +00001@c -*-texinfo-*-
2@c @value{COPYRIGHT_STR}
3@c See file quagga.texi for copying conditions.
4@c
5@c This file is a modified version of Jose Luis Rubio's TeX sources
6@c of his RS-Manual document
7
8@node Configuring Quagga as a Route Server
9@chapter Configuring Quagga as a Route Server
10
11The purpose of a Route Server is to centralize the peerings between BGP
12speakers. For example if we have an exchange point scenario with four BGP
13speakers, each of which maintaining a BGP peering with the other three
Paul Jakma7ecc5f52017-03-08 23:31:03 +000014we can convert it into a centralized scenario where
15each of the four establishes a single BGP peering against the Route Server.
paulfbaf39e2004-11-15 00:45:44 +000016
17We will first describe briefly the Route Server model implemented by Quagga.
18We will explain the commands that have been added for configuring that
19model. And finally we will show a full example of Quagga configured as Route
20Server.
21
22@menu
23* Description of the Route Server model::
24* Commands for configuring a Route Server::
25* Example of Route Server Configuration::
26@end menu
27
28@node Description of the Route Server model
29@section Description of the Route Server model
30
31First we are going to describe the normal processing that BGP announcements
32suffer inside a standard BGP speaker, as shown in @ref{fig:normal-processing},
33it consists of three steps:
34
Paul Jakmaab2416a2006-04-03 21:24:27 +000035@itemize @bullet
36@item
37When an announcement is received from some peer, the `In' filters
paulfbaf39e2004-11-15 00:45:44 +000038configured for that peer are applied to the announcement. These filters can
39reject the announcement, accept it unmodified, or accept it with some of its
40attributes modified.
41
Paul Jakmaab2416a2006-04-03 21:24:27 +000042@item
43The announcements that pass the `In' filters go into the
paulfbaf39e2004-11-15 00:45:44 +000044Best Path Selection process, where they are compared to other
45announcements referred to the same destination that have been
46received from different peers (in case such other
47announcements exist). For each different destination, the announcement
48which is selected as the best is inserted into the BGP speaker's Loc-RIB.
49
Paul Jakmaab2416a2006-04-03 21:24:27 +000050@item
51The routes which are inserted in the Loc-RIB are
paulfbaf39e2004-11-15 00:45:44 +000052considered for announcement to all the peers (except the one
53from which the route came). This is done by passing the routes
54in the Loc-RIB through the `Out' filters corresponding to each
55peer. These filters can reject the route,
56accept it unmodified, or accept it with some of its attributes
57modified. Those routes which are accepted by the `Out' filters
58of a peer are announced to that peer.
59@end itemize
60
61@float Figure,fig:normal-processing
Paul Jakma974511e2017-03-08 22:01:37 +000062@center @image{fig-normal-processing,400pt,,Normal announcement processing}
paulfbaf39e2004-11-15 00:45:44 +000063@caption{Announcement processing inside a ``normal'' BGP speaker}
64@end float
65
paulfbaf39e2004-11-15 00:45:44 +000066Of course we want that the routing tables obtained in each of the routers
67are the same when using the route server than when not. But as a consequence
68of having a single BGP peering (against the route server), the BGP speakers
69can no longer distinguish from/to which peer each announce comes/goes.
70@anchor{filter-delegation}This means that the routers connected to the route
71server are not able to apply by themselves the same input/output filters
72as in the full mesh scenario, so they have to delegate those functions to
73the route server.
74
Paul Jakmaab2416a2006-04-03 21:24:27 +000075Even more, the ``best path'' selection must be also performed inside
76the route server on behalf of its clients. The reason is that if, after
77applying the filters of the announcer and the (potential) receiver, the
78route server decides to send to some client two or more different
79announcements referred to the same destination, the client will only
80retain the last one, considering it as an implicit withdrawal of the
81previous announcements for the same destination. This is the expected
82behavior of a BGP speaker as defined in @cite{RFC1771}, and even though
83there are some proposals of mechanisms that permit multiple paths for
84the same destination to be sent through a single BGP peering, none are
85currently supported by most existing BGP implementations.
paulfbaf39e2004-11-15 00:45:44 +000086
87As a consequence a route server must maintain additional information and
88perform additional tasks for a RS-client that those necessary for common BGP
89peerings. Essentially a route server must:
90
91@anchor{Route Server tasks}
Paul Jakmaab2416a2006-04-03 21:24:27 +000092@itemize @bullet
93@item
94Maintain a separated Routing Information Base (Loc-RIB)
paulfbaf39e2004-11-15 00:45:44 +000095for each peer configured as RS-client, containing the routes
96selected as a result of the ``Best Path Selection'' process
97that is performed on behalf of that RS-client.
98
Paul Jakmaab2416a2006-04-03 21:24:27 +000099@item
100Whenever it receives an announcement from a RS-client,
paulfbaf39e2004-11-15 00:45:44 +0000101it must consider it for the Loc-RIBs of the other RS-clients.
102
103@anchor{Route-server path filter process}
Paul Jakmaab2416a2006-04-03 21:24:27 +0000104@itemize @bullet
paulfbaf39e2004-11-15 00:45:44 +0000105@item
106This means that for each of them the route server must pass the
107announcement through the appropriate `Out' filter of the
108announcer.
109
110@item
111Then through the appropriate `In' filter of
112the potential receiver.
113
114@item
115Only if the announcement is accepted by both filters it will be passed
116to the ``Best Path Selection'' process.
117
118@item
119Finally, it might go into the Loc-RIB of the receiver.
120@end itemize
paulfbaf39e2004-11-15 00:45:44 +0000121@end itemize
paulfbaf39e2004-11-15 00:45:44 +0000122
123When we talk about the ``appropriate'' filter, both the announcer and the
124receiver of the route must be taken into account. Suppose that the route
125server receives an announcement from client A, and the route server is
126considering it for the Loc-RIB of client B. The filters that should be
127applied are the same that would be used in the full mesh scenario, i.e.,
128first the `Out' filter of router A for announcements going to router B, and
129then the `In' filter of router B for announcements coming from router A.
130
131We call ``Export Policy'' of a RS-client to the set of `Out' filters that
132the client would use if there was no route server. The same applies for the
133``Import Policy'' of a RS-client and the set of `In' filters of the client
134if there was no route server.
135
136It is also common to demand from a route server that it does not
137modify some BGP attributes (next-hop, as-path and MED) that are usually
138modified by standard BGP speakers before announcing a route.
139
140The announcement processing model implemented by Quagga is shown in
141@ref{fig:rs-processing}. The figure shows a mixture of RS-clients (B, C and D)
142with normal BGP peers (A). There are some details that worth additional
143comments:
144
Paul Jakmaab2416a2006-04-03 21:24:27 +0000145@itemize @bullet
146@item
147Announcements coming from a normal BGP peer are also
paulfbaf39e2004-11-15 00:45:44 +0000148considered for the Loc-RIBs of all the RS-clients. But
149logically they do not pass through any export policy.
150
Paul Jakmaab2416a2006-04-03 21:24:27 +0000151@item
152Those peers that are configured as RS-clients do not
paulfbaf39e2004-11-15 00:45:44 +0000153receive any announce from the `Main' Loc-RIB.
154
Paul Jakmaab2416a2006-04-03 21:24:27 +0000155@item
156Apart from import and export policies,
paulfbaf39e2004-11-15 00:45:44 +0000157`In' and `Out' filters can also be set for RS-clients. `In'
158filters might be useful when the route server has also normal
159BGP peers. On the other hand, `Out' filters for RS-clients are
160probably unnecessary, but we decided not to remove them as
161they do not hurt anybody (they can always be left empty).
162@end itemize
163
164@float Figure,fig:rs-processing
Paul Jakma974511e2017-03-08 22:01:37 +0000165@center @image{fig-rs-processing,430pt,,Route Server Processing Model}
paulfbaf39e2004-11-15 00:45:44 +0000166@caption{Announcement processing model implemented by the Route Server}
167@end float
168
169@node Commands for configuring a Route Server
170@section Commands for configuring a Route Server
171
172Now we will describe the commands that have been added to quagga
173in order to support the route server features.
174
175@deffn {Route-Server} {neighbor @var{peer-group} route-server-client} {}
176@deffnx {Route-Server} {neighbor @var{A.B.C.D} route-server-client} {}
177@deffnx {Route-Server} {neighbor @var{X:X::X:X} route-server-client} {}
178This command configures the peer given by @var{peer}, @var{A.B.C.D} or
179@var{X:X::X:X} as an RS-client.
180
181Actually this command is not new, it already existed in standard Quagga. It
182enables the transparent mode for the specified peer. This means that some
183BGP attributes (as-path, next-hop and MED) of the routes announced to that
184peer are not modified.
185
186With the route server patch, this command, apart from setting the
187transparent mode, creates a new Loc-RIB dedicated to the specified peer
188(those named `Loc-RIB for X' in @ref{fig:rs-processing}.). Starting from
189that moment, every announcement received by the route server will be also
190considered for the new Loc-RIB.
191@end deffn
192
193@deffn {Route-Server} {neigbor @{A.B.C.D|X.X::X.X|peer-group@} route-map WORD @{import|export@}} {}
194This set of commands can be used to specify the route-map that
195represents the Import or Export policy of a peer which is
196configured as a RS-client (with the previous command).
197@end deffn
198
199@deffn {Route-Server} {match peer @{A.B.C.D|X:X::X:X@}} {}
200This is a new @emph{match} statement for use in route-maps, enabling them to
201describe import/export policies. As we said before, an import/export policy
202represents a set of input/output filters of the RS-client. This statement
203makes possible that a single route-map represents the full set of filters
204that a BGP speaker would use for its different peers in a non-RS scenario.
205
206The @emph{match peer} statement has different semantics whether it is used
207inside an import or an export route-map. In the first case the statement
208matches if the address of the peer who sends the announce is the same that
209the address specified by @{A.B.C.D|X:X::X:X@}. For export route-maps it
210matches when @{A.B.C.D|X:X::X:X@} is the address of the RS-Client into whose
211Loc-RIB the announce is going to be inserted (how the same export policy is
212applied before different Loc-RIBs is shown in @ref{fig:rs-processing}.).
213@end deffn
214
215@deffn {Route-map Command} {call @var{WORD}} {}
216This command (also used inside a route-map) jumps into a different
217route-map, whose name is specified by @var{WORD}. When the called
218route-map finishes, depending on its result the original route-map
219continues or not. Apart from being useful for making import/export
220route-maps easier to write, this command can also be used inside
221any normal (in or out) route-map.
222@end deffn
223
224@node Example of Route Server Configuration
225@section Example of Route Server Configuration
226
227Finally we are going to show how to configure a Quagga daemon to act as a
228Route Server. For this purpose we are going to present a scenario without
229route server, and then we will show how to use the configurations of the BGP
230routers to generate the configuration of the route server.
231
232All the configuration files shown in this section have been taken
233from scenarios which were tested using the VNUML tool
234@uref{http://www.dit.upm.es/vnuml,VNUML}.
235
236@menu
237* Configuration of the BGP routers without Route Server::
238* Configuration of the BGP routers with Route Server::
239* Configuration of the Route Server itself::
240* Further considerations about Import and Export route-maps::
241@end menu
242
243@node Configuration of the BGP routers without Route Server
244@subsection Configuration of the BGP routers without Route Server
245
246We will suppose that our initial scenario is an exchange point with three
247BGP capable routers, named RA, RB and RC. Each of the BGP speakers generates
248some routes (with the @var{network} command), and establishes BGP peerings
249against the other two routers. These peerings have In and Out route-maps
250configured, named like ``PEER-X-IN'' or ``PEER-X-OUT''. For example the
251configuration file for router RA could be the following:
252
Paul Jakmaf912cb42006-07-27 23:30:16 +0000253@exampleindent 0
paulfbaf39e2004-11-15 00:45:44 +0000254@example
255#Configuration for router 'RA'
256!
257hostname RA
258password ****
259!
260router bgp 65001
261 no bgp default ipv4-unicast
262 neighbor 2001:0DB8::B remote-as 65002
263 neighbor 2001:0DB8::C remote-as 65003
264!
265 address-family ipv6
266 network 2001:0DB8:AAAA:1::/64
267 network 2001:0DB8:AAAA:2::/64
268 network 2001:0DB8:0000:1::/64
269 network 2001:0DB8:0000:2::/64
270
271 neighbor 2001:0DB8::B activate
272 neighbor 2001:0DB8::B soft-reconfiguration inbound
273 neighbor 2001:0DB8::B route-map PEER-B-IN in
274 neighbor 2001:0DB8::B route-map PEER-B-OUT out
275
276 neighbor 2001:0DB8::C activate
277 neighbor 2001:0DB8::C soft-reconfiguration inbound
278 neighbor 2001:0DB8::C route-map PEER-C-IN in
279 neighbor 2001:0DB8::C route-map PEER-C-OUT out
280 exit-address-family
281!
282ipv6 prefix-list COMMON-PREFIXES seq 5 permit 2001:0DB8:0000::/48 ge 64 le 64
283ipv6 prefix-list COMMON-PREFIXES seq 10 deny any
284!
285ipv6 prefix-list PEER-A-PREFIXES seq 5 permit 2001:0DB8:AAAA::/48 ge 64 le 64
286ipv6 prefix-list PEER-A-PREFIXES seq 10 deny any
287!
288ipv6 prefix-list PEER-B-PREFIXES seq 5 permit 2001:0DB8:BBBB::/48 ge 64 le 64
289ipv6 prefix-list PEER-B-PREFIXES seq 10 deny any
290!
291ipv6 prefix-list PEER-C-PREFIXES seq 5 permit 2001:0DB8:CCCC::/48 ge 64 le 64
292ipv6 prefix-list PEER-C-PREFIXES seq 10 deny any
293!
294route-map PEER-B-IN permit 10
295 match ipv6 address prefix-list COMMON-PREFIXES
296 set metric 100
297route-map PEER-B-IN permit 20
298 match ipv6 address prefix-list PEER-B-PREFIXES
299 set community 65001:11111
300!
301route-map PEER-C-IN permit 10
302 match ipv6 address prefix-list COMMON-PREFIXES
303 set metric 200
304route-map PEER-C-IN permit 20
305 match ipv6 address prefix-list PEER-C-PREFIXES
306 set community 65001:22222
307!
308route-map PEER-B-OUT permit 10
309 match ipv6 address prefix-list PEER-A-PREFIXES
310!
311route-map PEER-C-OUT permit 10
312 match ipv6 address prefix-list PEER-A-PREFIXES
313!
314line vty
315!
316@end example
317
318@node Configuration of the BGP routers with Route Server
319@subsection Configuration of the BGP routers with Route Server
320
321To convert the initial scenario into one with route server, first we must
322modify the configuration of routers RA, RB and RC. Now they must not peer
323between them, but only with the route server. For example, RA's
324configuration would turn into:
325
326@example
327# Configuration for router 'RA'
328!
329hostname RA
330password ****
331!
332router bgp 65001
333 no bgp default ipv4-unicast
334 neighbor 2001:0DB8::FFFF remote-as 65000
335!
336 address-family ipv6
337 network 2001:0DB8:AAAA:1::/64
338 network 2001:0DB8:AAAA:2::/64
339 network 2001:0DB8:0000:1::/64
340 network 2001:0DB8:0000:2::/64
341
342 neighbor 2001:0DB8::FFFF activate
343 neighbor 2001:0DB8::FFFF soft-reconfiguration inbound
344 exit-address-family
345!
346line vty
347!
348@end example
349
350Which is logically much simpler than its initial configuration, as it now
351maintains only one BGP peering and all the filters (route-maps) have
352disappeared.
353
354@node Configuration of the Route Server itself
355@subsection Configuration of the Route Server itself
356
357As we said when we described the functions of a route server
358(@pxref{Description of the Route Server model}), it is in charge of all the
359route filtering. To achieve that, the In and Out filters from the RA, RB and
360RC configurations must be converted into Import and Export policies in the
361route server.
362
363This is a fragment of the route server configuration (we only show
364the policies for client RA):
365
366@example
367# Configuration for Route Server ('RS')
368!
369hostname RS
370password ix
371!
372bgp multiple-instance
373!
374router bgp 65000 view RS
375 no bgp default ipv4-unicast
376 neighbor 2001:0DB8::A remote-as 65001
377 neighbor 2001:0DB8::B remote-as 65002
378 neighbor 2001:0DB8::C remote-as 65003
379!
380 address-family ipv6
381 neighbor 2001:0DB8::A activate
382 neighbor 2001:0DB8::A route-server-client
383 neighbor 2001:0DB8::A route-map RSCLIENT-A-IMPORT import
384 neighbor 2001:0DB8::A route-map RSCLIENT-A-EXPORT export
385 neighbor 2001:0DB8::A soft-reconfiguration inbound
386
387 neighbor 2001:0DB8::B activate
388 neighbor 2001:0DB8::B route-server-client
389 neighbor 2001:0DB8::B route-map RSCLIENT-B-IMPORT import
390 neighbor 2001:0DB8::B route-map RSCLIENT-B-EXPORT export
391 neighbor 2001:0DB8::B soft-reconfiguration inbound
392
393 neighbor 2001:0DB8::C activate
394 neighbor 2001:0DB8::C route-server-client
395 neighbor 2001:0DB8::C route-map RSCLIENT-C-IMPORT import
396 neighbor 2001:0DB8::C route-map RSCLIENT-C-EXPORT export
397 neighbor 2001:0DB8::C soft-reconfiguration inbound
398 exit-address-family
399!
400ipv6 prefix-list COMMON-PREFIXES seq 5 permit 2001:0DB8:0000::/48 ge 64 le 64
401ipv6 prefix-list COMMON-PREFIXES seq 10 deny any
402!
403ipv6 prefix-list PEER-A-PREFIXES seq 5 permit 2001:0DB8:AAAA::/48 ge 64 le 64
404ipv6 prefix-list PEER-A-PREFIXES seq 10 deny any
405!
406ipv6 prefix-list PEER-B-PREFIXES seq 5 permit 2001:0DB8:BBBB::/48 ge 64 le 64
407ipv6 prefix-list PEER-B-PREFIXES seq 10 deny any
408!
409ipv6 prefix-list PEER-C-PREFIXES seq 5 permit 2001:0DB8:CCCC::/48 ge 64 le 64
410ipv6 prefix-list PEER-C-PREFIXES seq 10 deny any
411!
412route-map RSCLIENT-A-IMPORT permit 10
413 match peer 2001:0DB8::B
414 call A-IMPORT-FROM-B
415route-map RSCLIENT-A-IMPORT permit 20
416 match peer 2001:0DB8::C
417 call A-IMPORT-FROM-C
418!
419route-map A-IMPORT-FROM-B permit 10
420 match ipv6 address prefix-list COMMON-PREFIXES
421 set metric 100
422route-map A-IMPORT-FROM-B permit 20
423 match ipv6 address prefix-list PEER-B-PREFIXES
424 set community 65001:11111
425!
426route-map A-IMPORT-FROM-C permit 10
427 match ipv6 address prefix-list COMMON-PREFIXES
428 set metric 200
429route-map A-IMPORT-FROM-C permit 20
430 match ipv6 address prefix-list PEER-C-PREFIXES
431 set community 65001:22222
432!
433route-map RSCLIENT-A-EXPORT permit 10
434 match peer 2001:0DB8::B
435 match ipv6 address prefix-list PEER-A-PREFIXES
436route-map RSCLIENT-A-EXPORT permit 20
437 match peer 2001:0DB8::C
438 match ipv6 address prefix-list PEER-A-PREFIXES
439!
440...
441...
442...
443@end example
444
445If you compare the initial configuration of RA with the route server
446configuration above, you can see how easy it is to generate the Import and
447Export policies for RA from the In and Out route-maps of RA's original
448configuration.
449
450When there was no route server, RA maintained two peerings, one with RB and
451another with RC. Each of this peerings had an In route-map configured. To
452build the Import route-map for client RA in the route server, simply add
453route-map entries following this scheme:
454
455@example
456route-map <NAME> permit 10
457 match peer <Peer Address>
458 call <In Route-Map for this Peer>
459route-map <NAME> permit 20
460 match peer <Another Peer Address>
461 call <In Route-Map for this Peer>
462@end example
463
464This is exactly the process that has been followed to generate the route-map
465RSCLIENT-A-IMPORT. The route-maps that are called inside it (A-IMPORT-FROM-B
466and A-IMPORT-FROM-C) are exactly the same than the In route-maps from the
467original configuration of RA (PEER-B-IN and PEER-C-IN), only the name is
468different.
469
470The same could have been done to create the Export policy for RA (route-map
471RSCLIENT-A-EXPORT), but in this case the original Out route-maps where so
472simple that we decided not to use the @var{call WORD} commands, and we
473integrated all in a single route-map (RSCLIENT-A-EXPORT).
474
475The Import and Export policies for RB and RC are not shown, but
476the process would be identical.
477
478@node Further considerations about Import and Export route-maps
479@subsection Further considerations about Import and Export route-maps
480
481The current version of the route server patch only allows to specify a
482route-map for import and export policies, while in a standard BGP speaker
483apart from route-maps there are other tools for performing input and output
484filtering (access-lists, community-lists, ...). But this does not represent
485any limitation, as all kinds of filters can be included in import/export
486route-maps. For example suppose that in the non-route-server scenario peer
487RA had the following filters configured for input from peer B:
488
489@example
490 neighbor 2001:0DB8::B prefix-list LIST-1 in
491 neighbor 2001:0DB8::B filter-list LIST-2 in
492 neighbor 2001:0DB8::B route-map PEER-B-IN in
493 ...
494 ...
495route-map PEER-B-IN permit 10
496 match ipv6 address prefix-list COMMON-PREFIXES
497 set local-preference 100
498route-map PEER-B-IN permit 20
499 match ipv6 address prefix-list PEER-B-PREFIXES
500 set community 65001:11111
501@end example
502
503It is posible to write a single route-map which is equivalent to
504the three filters (the community-list, the prefix-list and the
505route-map). That route-map can then be used inside the Import
506policy in the route server. Lets see how to do it:
507
508@example
509 neighbor 2001:0DB8::A route-map RSCLIENT-A-IMPORT import
510 ...
511!
512...
513route-map RSCLIENT-A-IMPORT permit 10
514 match peer 2001:0DB8::B
515 call A-IMPORT-FROM-B
516...
517...
518!
519route-map A-IMPORT-FROM-B permit 1
520 match ipv6 address prefix-list LIST-1
521 match as-path LIST-2
522 on-match goto 10
523route-map A-IMPORT-FROM-B deny 2
524route-map A-IMPORT-FROM-B permit 10
525 match ipv6 address prefix-list COMMON-PREFIXES
526 set local-preference 100
527route-map A-IMPORT-FROM-B permit 20
528 match ipv6 address prefix-list PEER-B-PREFIXES
529 set community 65001:11111
530!
531...
532...
533@end example
534
535The route-map A-IMPORT-FROM-B is equivalent to the three filters
536(LIST-1, LIST-2 and PEER-B-IN). The first entry of route-map
537A-IMPORT-FROM-B (sequence number 1) matches if and only if both
538the prefix-list LIST-1 and the filter-list LIST-2 match. If that
539happens, due to the ``on-match goto 10'' statement the next
540route-map entry to be processed will be number 10, and as of that
541point route-map A-IMPORT-FROM-B is identical to PEER-B-IN. If
542the first entry does not match, `on-match goto 10'' will be
543ignored and the next processed entry will be number 2, which will
544deny the route.
545
546Thus, the result is the same that with the three original filters,
547i.e., if either LIST-1 or LIST-2 rejects the route, it does not
548reach the route-map PEER-B-IN. In case both LIST-1 and LIST-2
549accept the route, it passes to PEER-B-IN, which can reject, accept
550or modify the route.