]> git.proxmox.com Git - mirror_frr.git/blame - doc/routemap.texi
tests: fix warnings by removing dead code
[mirror_frr.git] / doc / routemap.texi
CommitLineData
76b89b4a 1@node Route Map
718e3744 2@chapter Route Map
3
aa5943f7 4Route maps provide a means to both filter and/or apply actions to
5route, hence allowing policy to be applied to routes.
718e3744 6
7@menu
b6339267
DS
8* Route Map Command::
9* Route Map Match Command::
aa5943f7 10* Route Map Set Command::
11* Route Map Call Command::
12* Route Map Exit Action Command::
13* Route Map Examples::
718e3744 14@end menu
15
aa5943f7 16Route-maps are an ordered list of route-map entries. Each entry may
17specify up to four distincts sets of clauses:
18
19@table @samp
20@item Matching Policy
21
22This specifies the policy implied if the @samp{Matching Conditions} are
23met or not met, and which actions of the route-map are to be taken, if
24any. The two possibilities are:
25
26@itemize @minus
27@item
28@samp{permit}: If the entry matches, then carry out the @samp{Set
29Actions}. Then finish processing the route-map, permitting the route,
30unless an @samp{Exit Action} indicates otherwise.
31
32@item
33@samp{deny}: If the entry matches, then finish processing the route-map and
34deny the route (return @samp{deny}).
35@end itemize
36
37The @samp{Matching Policy} is specified as part of the command which
38defines the ordered entry in the route-map. See below.
39
40@item Matching Conditions
41
42A route-map entry may, optionally, specify one or more conditions which
43must be matched if the entry is to be considered further, as governed
44by the Match Policy. If a route-map entry does not explicitely specify
45any matching conditions, then it always matches.
46
47@item Set Actions
48
49A route-map entry may, optionally, specify one or more @samp{Set
50Actions} to set or modify attributes of the route.
51
52@item Call Action
53
54Call to another route-map, after any @samp{Set Actions} have been
55carried out. If the route-map called returns @samp{deny} then
56processing of the route-map finishes and the route is denied,
57regardless of the @samp{Matching Policy} or the @samp{Exit Policy}. If
58the called route-map returns @samp{permit}, then @samp{Matching Policy}
59and @samp{Exit Policy} govern further behaviour, as normal.
60
61@item Exit Policy
62
63An entry may, optionally, specify an alternative @samp{Exit Policy} to
64take if the entry matched, rather than the normal policy of exiting the
65route-map and permitting the route. The two possibilities are:
66
67@itemize @minus
68@item
69@samp{next}: Continue on with processing of the route-map entries.
70
71@item
72@samp{goto N}: Jump ahead to the first route-map entry whose order in
73the route-map is >= N. Jumping to a previous entry is not permitted.
74@end itemize
75@end table
76
77The default action of a route-map, if no entries match, is to deny.
78I.e. a route-map essentially has as its last entry an empty @samp{deny}
79entry, which matches all routes. To change this behaviour, one must
80specify an empty @samp{permit} entry as the last entry in the route-map.
81
82To summarise the above:
83
84@multitable {permit} {action} {No Match}
85@headitem @tab Match @tab No Match
86@item @emph{Permit} @tab action @tab cont
87@item @emph{Deny} @tab deny @tab cont
88@end multitable
89
90@table @samp
91
92@item action
93@itemize @minus
94@item
95Apply @emph{set} statements
96
97@item
98If @emph{call} is present, call given route-map. If that returns a @samp{deny}, finish
99processing and return @samp{deny}.
100
101@item
102If @samp{Exit Policy} is @emph{next}, goto next route-map entry
103
104@item
105If @samp{Exit Policy} is @emph{goto}, goto first entry whose order in the list
106is >= the given order.
107
108@item
109Finish processing the route-map and permit the route.
110@end itemize
111
112@item deny
113@itemize @minus
114@item
115The route is denied by the route-map (return @samp{deny}).
116@end itemize
117
118@item cont
119@itemize @minus
120@item
121goto next route-map entry
122@end itemize
123@end table
124
76b89b4a 125@node Route Map Command
126@section Route Map Command
718e3744 127
aa5943f7 128@deffn {Command} {route-map @var{route-map-name} (permit|deny) @var{order}} {}
129
130Configure the @var{order}'th entry in @var{route-map-name} with
131@samp{Match Policy} of either @emph{permit} or @emph{deny}.
132
718e3744 133@end deffn
134
76b89b4a 135@node Route Map Match Command
136@section Route Map Match Command
718e3744 137
138@deffn {Route-map Command} {match ip address @var{access_list}} {}
139Matches the specified @var{access_list}
140@end deffn
141
5165d46f
DS
142@deffn {Route-map Command} {match ip address @var{prefix-list}} {}
143Matches the specified @var{prefix-list}
144@end deffn
145
146@deffn {Route-map Command} {match ip address prefix-len @var{0-32}} {}
147Matches the specified @var{prefix-len}. This is a Zebra specific command.
148@end deffn
149
150@deffn {Route-map Command} {match ipv6 address @var{access_list}} {}
151Matches the specified @var{access_list}
152@end deffn
153
154@deffn {Route-map Command} {match ipv6 address @var{prefix-list}} {}
155Matches the specified @var{prefix-list}
156@end deffn
157
158@deffn {Route-map Command} {match ipv6 address prefix-len @var{0-128}} {}
159Matches the specified @var{prefix-len}. This is a Zebra specific command.
160@end deffn
161
718e3744 162@deffn {Route-map Command} {match ip next-hop @var{ipv4_addr}} {}
163Matches the specified @var{ipv4_addr}.
164@end deffn
165
166@deffn {Route-map Command} {match aspath @var{as_path}} {}
167Matches the specified @var{as_path}.
168@end deffn
169
170@deffn {Route-map Command} {match metric @var{metric}} {}
171Matches the specified @var{metric}.
172@end deffn
173
6347ca16
DS
174@deffn {Route-map Command} {match tag @var{tag}} {}
175Matches the specified tag value associated with the route.
176This tag value can be in the range of (1-4294967295).
177@end deffn
178
af291c15
DS
179@deffn {Route-map Command} {match local-preference @var{metric}} {}
180Matches the specified @var{local-preference}.
181@end deffn
182
718e3744 183@deffn {Route-map Command} {match community @var{community_list}} {}
184Matches the specified @var{community_list}
185@end deffn
186
b6339267
DS
187@deffn {Route-map Command} {match peer @var{ipv4_addr}} {}
188This is a BGP specific match command. Matches the peer ip address
189if the neighbor was specified in this manner.
190@end deffn
191
192@deffn {Route-map Command} {match peer @var{ipv6_addr}} {}
193This is a BGP specific match command. Matches the peer ipv6
194address if the neighbor was specified in this manner.
195@end deffn
196
197@deffn {Route-map Command} {match peer @var{interface_name}} {}
198This is a BGP specific match command. Matches the peer
199interface name specified if the neighbor was specified
200in this manner.
201@end deffn
202
76b89b4a 203@node Route Map Set Command
204@section Route Map Set Command
718e3744 205
6347ca16
DS
206@deffn {Route-map Command} {set tag @var{tag}} {}
207Set a tag on the matched route. This tag value can be from
208(1-4294967295). Additionally if you have compiled with
209the --enable-realms configure option. Tag values from (1-255)
210are sent to the linux kernel as a realm value. Then route
211policy can be applied. See the tc man page.
212@end deffn
213
718e3744 214@deffn {Route-map Command} {set ip next-hop @var{ipv4_address}} {}
215Set the BGP nexthop address.
216@end deffn
217
218@deffn {Route-map Command} {set local-preference @var{local_pref}} {}
65efcfce 219Set the BGP local preference to @var{local_pref}.
718e3744 220@end deffn
221
222@deffn {Route-map Command} {set weight @var{weight}} {}
223Set the route's weight.
224@end deffn
225
226@deffn {Route-map Command} {set metric @var{metric}} {}
d767b4d0 227@anchor{routemap set metric}
718e3744 228Set the BGP attribute MED.
229@end deffn
230
231@deffn {Route-map Command} {set as-path prepend @var{as_path}} {}
232Set the BGP AS path to prepend.
233@end deffn
234
235@deffn {Route-map Command} {set community @var{community}} {}
236Set the BGP community attribute.
237@end deffn
238
239@deffn {Route-map Command} {set ipv6 next-hop global @var{ipv6_address}} {}
240Set the BGP-4+ global IPv6 nexthop address.
241@end deffn
242
243@deffn {Route-map Command} {set ipv6 next-hop local @var{ipv6_address}} {}
244Set the BGP-4+ link local IPv6 nexthop address.
245@end deffn
246
aa5943f7 247@node Route Map Call Command
248@section Route Map Call Command
249
250@deffn {Route-map Command} {call @var{name}} {}
251Call route-map @var{name}. If it returns deny, deny the route and
252finish processing the route-map.
253@end deffn
254
255@node Route Map Exit Action Command
256@section Route Map Exit Action Command
257
258@deffn {Route-map Command} {on-match next} {}
259@deffnx {Route-map Command} {continue} {}
260Proceed on to the next entry in the route-map.
261@end deffn
262
263@deffn {Route-map Command} {on-match goto @var{N}} {}
264@deffnx {Route-map Command} {continue @var{N}} {}
265Proceed processing the route-map at the first entry whose order is >= N
266@end deffn
267
268@node Route Map Examples
269@section Route Map Examples
270
271A simple example of a route-map:
272
273@example
274@group
275route-map test permit 10
276 match ip address 10
277 set local-preference 200
278@end group
279@end example
280
281This means that if a route matches ip access-list number 10 it's
282local-preference value is set to 200.
283
284See @ref{BGP Configuration Examples} for examples of more sophisticated
285useage of route-maps, including of the @samp{call} action.