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