summaryrefslogtreecommitdiff
path: root/usr.sbin/ospfd/ospfd.conf.5
blob: 6a39ea341794d088dbf61ab13c99ff09dac291a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
.\"	$OpenBSD: ospfd.conf.5,v 1.62 2020/05/16 16:58:12 jmc Exp $
.\"
.\" Copyright (c) 2005 Esben Norby <norby@openbsd.org>
.\" Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org>
.\" Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
.\" Copyright (c) 2002 Daniel Hartmeier <dhartmei@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: May 16 2020 $
.Dt OSPFD.CONF 5
.Os
.Sh NAME
.Nm ospfd.conf
.Nd Open Shortest Path First daemon configuration file
.Sh DESCRIPTION
The
.Xr ospfd 8
daemon implements the Open Shortest Path First protocol version 2 as described
in RFC 2328.
.Pp
The
.Nm
config file is divided into the following main sections:
.Bl -tag -width xxxx
.It Sy Macros
User-defined variables may be defined and used later, simplifying the
configuration file.
.It Sy Global Configuration
Global settings for
.Xr ospfd 8 .
A number of global settings can be overruled in specific areas or interfaces.
.It Sy Areas
An OSPF router must be a member of at least one area.
Areas are used to group interfaces, simplifying configuration.
.El
.Pp
Argument names not beginning with a letter, digit, or underscore
must be quoted.
.Pp
Additional configuration files can be included with the
.Ic include
keyword, for example:
.Bd -literal -offset indent
include "/etc/ospfd.sub.conf"
.Ed
.Sh MACROS
Macros can be defined that will later be expanded in context.
Macro names must start with a letter, digit, or underscore,
and may contain any of those characters.
Macro names may not be reserved words (for example,
.Ic area ,
.Ic interface ,
or
.Ic hello-interval ) .
Macros are not expanded inside quotes.
.Pp
For example:
.Bd -literal -offset indent
hi="5"
area 0.0.0.0 {
	interface em0 {
		hello-interval $hi
	}
}
.Ed
.Pp
The same can be accomplished by specifying the hello-interval
globally or within the area declaration.
.Sh GLOBAL CONFIGURATION
All interface related settings can be configured globally, per area and per
interface.
The only settings that can be set globally and not overruled are listed below.
.Pp
.Bl -tag -width Ds -compact
.It Ic fib-priority Ar prio
Set the routing priority to
.Ar prio .
The default is 32.
.Pp
.It Xo
.Ic fib-update
.Pq Ic yes Ns | Ns Ic no
.Xc
If set to
.Ic \&no ,
do not update the Forwarding Information Base, a.k.a. the kernel
routing table.
The default is
.Ic yes .
Setting
.Ic fib-update
to
.Ic \&no
will implicitly set the
.Ic stub router
option to ensure that no traffic tries to transit via this router.
.Pp
.It Ic rdomain Ar tableid
Specifies the routing table
.Xr ospfd 8
should modify.
Table 0 is the default table.
.Pp
.It Xo
.Op Ic no
.Ic redistribute
.Sm off
.Pq Ic static | connected | default
.Sm on
.Op Ic set ...
.Bk -words
.Op Ic depend on Ar interface
.Ek
.Xc
.It Xo
.Op Ic no
.Ic redistribute Ar prefix
.Op Ic set ...
.Op Ic depend on Ar interface
.Xc
.It Xo
.Op Ic no
.Ic redistribute rtlabel Ar label
.Op Ic set ...
.Op Ic depend on Ar interface
.Xc
If set to
.Ic connected ,
routes to directly attached networks will be announced over OSPF.
If set to
.Ic static ,
static routes will be announced over OSPF.
If set to
.Ic default ,
a default route pointing to this router will be announced over OSPF.
It is possible to specify a network range with
.Ar prefix ;
networks need to be part of that range to be redistributed.
Additionally it is possible to redistribute based on route labels
using the
.Ic rtlabel
keyword.
By default no additional routes will be announced over OSPF.
.Pp
.Ic redistribute
statements are evaluated in sequential order, from first to last.
The first matching rule decides if a route should be redistributed or not.
Matching rules starting with
.Ic no
will force the route to be not announced.
The only exception is
.Ic default ,
which will be set no matter what, and additionally
.Ic no
cannot be used together with it.
.Pp
With the
.Ic depend on
option, redistributed routes will have a metric of 65535 if the specified
.Ar interface
is down or in state backup.
This is especially useful on a carp cluster to ensure all traffic goes to
the carp master.
.Pp
It is possible to set the route
.Ic metric
and
.Ic type
for each redistribute rule.
.Ic type
is either 1 or 2.
The default value for
.Ic type
is 1 and for
.Ic metric
is 100.
Setting more than one option needs curly brackets:
.Bd -literal -offset indent
redistribute static set { metric 300 type 2 }
.Ed
.Pp
The use of
.Ic redistribute Ar prefix | rtlabel
can result in higher CPU usage, since
.Xr ospfd 8
will need to process more route updates.
.Pp
.It Xo
.Ic rfc1583compat
.Pq Ic yes Ns | Ns Ic no
.Xc
If set to
.Ic yes ,
decisions regarding AS-external routes are evaluated according to RFC 2328.
The default is
.Ic no .
.Pp
.It Ic router-id Ar address
Set the router ID; if not specified, the numerically lowest IP address of
the router will be used.
.Pp
.It Ic rtlabel Ar label Ic external-tag Ar number
Map route labels to external route tags and vice versa.
The external route tag is a non-negative 32-bit number attached to
AS-external OSPF LSAs.
.Pp
.It Xo
.Ic spf-delay
.Po Ar seconds Ns | Ns
.Ic msec Ar milliseconds Pc
.Xc
Set the SPF delay.
The delay between receiving an update to the link
state database and starting the shortest path first calculation.
The default value is 1 second; valid range is 10 milliseconds\-10 seconds.
.Pp
.It Xo
.Ic spf-holdtime
.Po Ar seconds Ns | Ns
.Ic msec Ar milliseconds Pc
.Xc
Set the SPF holdtime.
The minimum time between two consecutive
shortest path first calculations.
The default value is 5 seconds; the valid range is 10 milliseconds\-5 seconds.
.Pp
.It Xo
.Ic stub router
.Pq Ic yes Ns | Ns Ic no
.Xc
If set to
.Ic yes ,
all interfaces with active neighbors will have a metric of infinity.
This ensures that the other routers prefer routes around this router while
still being able to reach directly connected IP prefixes.
The
.Ic stub router
option is automatically enabled if either the
.Xr sysctl 8
variable
.Va net.inet.ip.forwarding
is set to a value other than 1 or if the FIB is not coupled.
.El
.Sh AREAS
Areas are used for grouping interfaces.
All interface-specific parameters can
be configured per area, overruling the global settings.
These interface-specific parameters need to be defined before the interfaces.
.Bl -tag -width Ds
.It Ic area Ar id | address
Specify an area section, grouping one or more interfaces.
.Bd -literal -offset indent
area 0.0.0.0 {
	hello-interval 3
	interface em0
	interface em1 {
		metric 10
	}
}
.Ed
.El
.Pp
Area specific parameters are listed below.
.Bl -tag -width Ds
.It Ic demote Ar group Op Ar count
Increase the
.Xr carp 4
demotion counter by
.Ar count
on the given interface group, usually
.Ar carp ,
when no neighbor in the area is in an active state.
The demotion counter will be decreased when one neighbor in that
area is in an active state.
The default value for
.Ar count
is 1.
.Pp
For more information on interface groups,
see the
.Ic group
keyword in
.Xr ifconfig 8 .
.It Xo
.Ic stub
.Op Ic redistribute default
.Op Ic set ...
.Xc
Mark the area as
.Ar stub .
Stub areas will not be flooded by as-ext LSA, resulting in smaller routing
tables.
Area border routers should redistribute a default network LSA; this can be
enabled by specifying the default redistribute option.
A default summary LSA will only be redistributed if the router has an active
connection to the backbone area 0.0.0.0.
.El
.Sh INTERFACES
Each interface can have several parameters configured individually, otherwise
they are inherited.
An interface is specified by its name.
If multiple networks are configured an additional IP address can be supplied.
By default the first IP address is used.
.Bd -literal -offset indent
interface em0 {
	auth-type crypt
	auth-md 1 "yotVoo_Heypp"
	auth-md-keyid 1
}
interface fxp0:192.168.1.3
.Ed
.Pp
Interface-specific parameters are listed below.
.Bl -tag -width Ds
.It Ic auth-key Ar key
Set the authentication key for
.Ic simple
authentication.
Up to 8 characters can be specified.
.It Ic auth-md Ar key-id key
Set the authentication
.Ar key-id
and
.Ar key
for
.Ic crypt
authentication.
The valid range for
.Ar key-id
is 0\-255.
Up to 16 characters can be specified for
.Ar key .
Multiple keys may be specified.
.It Ic auth-md-keyid Ar key-id
Configure the
.Ar key-id
to use for
.Ic crypt
authentication.
The valid range for
.Ar key-id
is 0\-255.
The default key-id is 1.
While key-id 0 is valid, it is unavailable on various other implementations.
.It Xo
.Ic auth-type
.Po Ic none Ns | Ns
.Ic simple Ns | Ns Ic crypt Pc
.Xc
Set the authentication type.
The default is
.Ic none .
Simple authentication uses a plaintext password, up to 8 characters.
Crypt authentication uses an MD5 hash.
.It Ic demote Ar group
Increase the
.Xr carp 4
demotion counter by 1 on the given interface group, usually
.Ar carp ,
when the interface state is going down.
The demotion counter will be decreased when the interface
state is active again.
.It Ic depend on Ar interface
A metric of 65535 is used if the specified interface is down or in status
backup.
.It Ic fast-hello-interval msec Ar milliseconds
If the interface is configured to use
.Ic router-dead-time minimal ,
hello packets will be sent using this timer.
The default value is 333; valid range is 50\-333 milliseconds.
.It Ic hello-interval Ar seconds
Set the hello interval.
The default value is 10; valid range is 1\-65535 seconds.
.It Ic metric Ar cost
Set the interface metric a.k.a. cost.
The default value is 10; valid range is 1\-65535.
A metric of 65535 is used for
.Xr carp 4
interfaces with status backup.
.It Ic passive
Prevent transmission and reception of OSPF packets on this interface.
The specified interface will be announced as a stub network.
Passive mode is enforced for
.Xr carp 4
interfaces.
.It Ic retransmit-interval Ar seconds
Set retransmit interval.
The default value is 5 seconds; valid range is 5\-3600 seconds.
.It Xo
.Ic router-dead-time
.Pq Ar seconds Ns | Ns Ic minimal
.Xc
Set the router dead time, a.k.a. neighbor inactivity timer.
The default value is 40 seconds; valid range is 2\-2147483647 seconds.
If the router dead time has been set to
.Ic minimal ,
the timer is set to 1 second and hello packets are sent using the interval
specified by
.Ic fast-hello-interval .
When a neighbor has been
inactive for router-dead-time its state is set to DOWN.
Neighbors
that have been inactive for more than 24 hours are completely removed.
.It Ic router-priority Ar priority
Set the router priority.
The default value is 1; valid range is 0\-255.
If set
to 0 the router is not eligible as a Designated Router or Backup Designated
Router.
.It Ic transmit-delay Ar seconds
Set the transmit delay.
The default value is 1; valid range is 1\-3600 seconds.
.It Ic type p2p
Set the interface type to point to point.
This disables the election of a DR and BDR for the given interface.
.El
.Sh FILES
.Bl -tag -width /etc/examples/ospfd.conf -compact
.It Pa /etc/ospfd.conf
.Xr ospfd 8
configuration file.
.It Pa /etc/examples/ospfd.conf
Example configuration file.
.El
.Sh SEE ALSO
.Xr ospfctl 8 ,
.Xr ospfd 8 ,
.Xr rc.conf.local 8
.Sh HISTORY
The
.Nm
file format first appeared in
.Ox 3.7 .