xref: /openbsd-src/usr.sbin/bgpd/bgpd.8 (revision fde16b570da51552327c7a739c616268c19bf7a2)
1.\" $OpenBSD: bgpd.8,v 1.84 2025/01/17 12:38:14 claudio Exp $
2.\"
3.\" Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: January 17 2025 $
18.Dt BGPD 8
19.Os
20.Sh NAME
21.Nm bgpd
22.Nd Border Gateway Protocol (BGP) routing daemon
23.Sh SYNOPSIS
24.Nm bgpd
25.Bk -words
26.Op Fl cdnvV
27.Op Fl D Ar macro Ns = Ns Ar value
28.Op Fl f Ar file
29.Ek
30.Sh DESCRIPTION
31.Nm
32is a Border Gateway Protocol
33.Pq BGP
34daemon which manages the network routing tables.
35Its main purpose is to exchange information
36concerning
37.Qq network reachability
38with other BGP systems.
39.Nm
40uses the Border Gateway Protocol, Version 4,
41as described in RFC 4271.
42.Pp
43BGP is an exterior gateway protocol using a multiple step decision process
44to find the best path.
45Advanced filtering can be used to influence the route
46decision for traffic engineering.
47The session engine of
48.Nm
49is responsible for maintaining the TCP session with each neighbor.
50Updates are passed to the Route Decision Engine (RDE) where the paths
51are filtered and used to compute a Routing Information Base (RIB).
52The parent process is responsible for keeping the RIB in sync with
53the kernel routing table.
54.Pp
55The route decision process selects the best path by evaluating all paths to
56the same destination.
57The decision process continues to the next step if paths have equal attributes.
58Paths that are less preferred are taken out of consideration until there is
59only one path left.
60.Bl -enum -width 42 -offset bula
61.It
62All paths with errors or loops are not eligible.
63.It
64Paths with an unreachable nexthop are not eligible.
65After this step all remaining paths are valid.
66.It
67The path with the highest
68.Em LOCAL_PREF
69is selected.
70.It
71The path with the shortest
72.Em AS path
73attribute is selected.
74.It
75The
76.Em ORIGIN
77attribute is compared.
78The order is IGP before EGP before incomplete origins.
79.It
80The path with the lowest
81.Em MULTI_EXIT_DISC
82metric is selected.
83Normally, this value is only considered when choosing between multiple
84routes sent by the same neighbouring AS.
85However, if
86.Dq Li rde med compare always
87is set in the configuration, the metric is compared for routes sent by any AS.
88.It
89Comparison of the BGP session type.
90Paths learned over an external (EBGP) session are preferred over those
91learned via an internal (IBGP) session.
92.It
93The path with the highest local
94.Em weight
95is selected.
96.It
97If
98.Dq Li rde route-age evaluate
99is set then the oldest path is selected.
100.It
101The path coming from the neighbor with the lowest
102.Em BGP ID
103wins.
104If the
105.Em ORIGINATOR_ID
106attribute is present, that value will be used in the comparison instead.
107.It
108The path with the shortest
109.Em CLUSTER_LIST
110attribute is selected.
111If it is not present then a length of 0 is used in the comparison.
112.It
113The path coming from the peer with the lowest IP address is selected.
114IPv4 sessions will be preferred over IPv6 ones.
115.El
116.Pp
117Attributes set by filters can be used to tip the decision process to prefer
118particular paths over others.
119This can be achieved by changing the
120.Em localpref ,
121.Em med ,
122or
123.Em weight
124attributes.
125AS path prepending or changing the
126.Em med
127or
128.Em origin
129attribute can be used to influence the routing behaviour on remote systems.
130.Pp
131To have
132.Nm
133enabled at boot time, use
134.Dq rcctl enable bgpd ,
135which sets
136.Pp
137.Dl bgpd_flags=\(dq\(dq
138.Pp
139in
140.Xr rc.conf.local 8 .
141.Pp
142When
143.Nm
144starts up, it reads settings from a configuration file,
145typically
146.Xr bgpd.conf 5 .
147A running
148.Nm
149process can be controlled using the
150.Xr bgpctl 8
151utility.
152.Pp
153The options are as follows:
154.Bl -tag -width "-f fileXXX"
155.It Fl c
156Force
157.Nm
158to do
159.Xr carp 4
160demotion at startup when the
161.Em demote
162functionality is used.
163Normally,
164.Nm
165will only do demotion at startup when the demotion counter for the group
166in question is already greater than 0.
167.Nm
168will start handling demotion after all sessions with demotion configured for
169the given group have been successfully established.
170At system startup,
171.Xr rc 8
172has the demotion counter for the group
173.Em carp
174increased until after
175.Nm
176is started, so this option should
177.Em not
178be used in
179.Xr rc.conf 8 .
180.It Fl D Ar macro Ns = Ns Ar value
181Define
182.Ar macro
183to be set to
184.Ar value
185on the command line.
186Overrides the definition of
187.Ar macro
188in the configuration file.
189.It Fl d
190Do not daemonize.
191If this option is specified,
192.Nm
193will run in the foreground and log to
194.Em stderr .
195.It Fl f Ar file
196Use
197.Ar file
198as the configuration file,
199instead of the default
200.Pa /etc/bgpd.conf .
201.It Fl n
202Configtest mode.
203Only check the configuration file for validity.
204.It Fl v
205Produce more verbose output.
206.It Fl V
207Show the version and exit.
208.El
209.Sh FILES
210.Bl -tag -width "/var/run/bgpd.sock.<rdomain>" -compact
211.It Pa /etc/bgpd.conf
212Default
213.Nm
214configuration file.
215.It Pa /var/run/bgpd.sock.<rdomain>
216Default
217.Nm
218control socket, where
219.Ar <rdomain>
220is the routing domain in which
221.Nm
222has been started.
223.El
224.Sh SEE ALSO
225.Xr bgpd.conf 5 ,
226.Xr bgpctl 8 ,
227.Xr bgplg 8 ,
228.Xr bgplgsh 8
229.Sh STANDARDS
230.Rs
231.%D August 1996
232.%R RFC 1997
233.%T BGP Communities Attribute
234.Re
235.Pp
236.Rs
237.%D August 1998
238.%R RFC 2385
239.%T Protection of BGP Sessions via the TCP MD5 Signature Option
240.Re
241.Pp
242.Rs
243.%D March 1999
244.%R RFC 2545
245.%T Use of BGP-4 Multiprotocol Extensions for IPv6 Inter-Domain Routing
246.Re
247.Pp
248.Rs
249.%D September 2000
250.%R RFC 2918
251.%T Route Refresh Capability for BGP-4
252.Re
253.Pp
254.Rs
255.%D April 2004
256.%R RFC 3765
257.%T NOPEER Community for Border Gateway Protocol (BGP) Route Scope Control
258.Re
259.Pp
260.Rs
261.%D January 2006
262.%R RFC 4271
263.%T A Border Gateway Protocol 4 (BGP-4)
264.Re
265.Pp
266.Rs
267.%D February 2006
268.%R RFC 4360
269.%T BGP Extended Communities Attribute
270.Re
271.Pp
272.Rs
273.%D February 2006
274.%R RFC 4364
275.%T BGP/MPLS IP Virtual Private Networks (VPNs)
276.Re
277.Pp
278.Rs
279.%D April 2006
280.%R RFC 4456
281.%T "BGP Route Reflection: An Alternative to Full Mesh Internal BGP (IBGP)"
282.Re
283.Pp
284.Rs
285.%D April 2006
286.%R RFC 4486
287.%T Subcodes for BGP Cease Notification Message
288.Re
289.Pp
290.Rs
291.%D January 2007
292.%R RFC 4724
293.%T Graceful Restart Mechanism for BGP
294.Re
295.Pp
296.Rs
297.%D January 2007
298.%R RFC 4760
299.%T Multiprotocol Extensions for BGP-4
300.Re
301.Pp
302.Rs
303.%D October 2007
304.%R RFC 5082
305.%T The Generalized TTL Security Mechanism (GTSM)
306.Re
307.Pp
308.Rs
309.%D February 2009
310.%R RFC 5492
311.%T Capabilities Advertisement with BGP-4
312.Re
313.Pp
314.Rs
315.%D October 2009
316.%R RFC 5668
317.%T 4-Octet AS Specific BGP Extended Community
318.Re
319.Pp
320.Rs
321.%D June 2011
322.%R RFC 6286
323.%T Autonomous-System-Wide Unique BGP Identifier for BGP-4
324.Re
325.Pp
326.Rs
327.%D May 2012
328.%R RFC 6608
329.%T Subcodes for BGP Finite State Machine Error
330.Re
331.Pp
332.Rs
333.%D Dec 2012
334.%R RFC 6793
335.%T BGP Support for Four-Octet Autonomous System (AS) Number Space
336.Re
337.Pp
338.Rs
339.%D August 2015
340.%R RFC 7606
341.%T Revised Error Handling for BGP UPDATE Messages
342.Re
343.Pp
344.Rs
345.%D October 2011
346.%R RFC 6396
347.%T Multi-Threaded Routing Toolkit (MRT) Routing Information Export Format
348.Re
349.Pp
350.Rs
351.%D May 2012
352.%R RFC 6608
353.%T Subcodes for BGP Finite State Machine Error
354.Re
355.Pp
356.Rs
357.%D July 2014
358.%R RFC 7313
359.%T Enhanced Route Refresh Capability for BGP-4
360.Re
361.Pp
362.Rs
363.%D August 2015
364.%R RFC 7607
365.%T Codification of AS 0 Processing
366.Re
367.Pp
368.Rs
369.%D July 2016
370.%R RFC 7911
371.%T Advertisement of Multiple Paths in BGP
372.Re
373.Pp
374.Rs
375.%D September 2016
376.%R RFC 7947
377.%T Internet Exchange BGP Route Server
378.Re
379.Pp
380.Rs
381.%D May 2017
382.%R RFC 8050
383.%T Multi-Threaded Routing Toolkit (MRT) Routing Information Export Format with BGP Additional Path Extensions
384.Re
385.Pp
386.Rs
387.%D February 2017
388.%R RFC 8092
389.%T BGP Large Communities Attribute
390.Re
391.Pp
392.Rs
393.%D March 2017
394.%R RFC 8097
395.%T BGP Prefix Origin Validation State Extended Community
396.Re
397.Pp
398.Rs
399.%D July 2017
400.%R RFC 8203
401.%T BGP Administrative Shutdown Communication
402.Re
403.Pp
404.Rs
405.%D September 2017
406.%R RFC 8210
407.%T The Resource Public Key Infrastructure (RPKI) to Router Protocol, Version 1
408.Re
409.Pp
410.Rs
411.%D July 2017
412.%R RFC 8212
413.%T Default External BGP (EBGP) Route Propagation Behavior without Policies
414.Re
415.Pp
416.Rs
417.%D March 2018
418.%R RFC 8326
419.%T Graceful BGP Session Shutdown
420.Re
421.Pp
422.Rs
423.%D March 2019
424.%R RFC 8538
425.%T Notification Message Support for BGP Graceful Restart
426.Re
427.Pp
428.Rs
429.%D October 2019
430.%R RFC 8654
431.%T Extended Message Support for BGP
432.Re
433.Pp
434.Rs
435.%D November 2020
436.%R RFC 8950
437.%T Advertising IPv4 Network Layer Reachability Information (NLRI) with an IPv6 Next Hop
438.Re
439.Pp
440.Rs
441.%D December 2020
442.%R RFC 8955
443.%T Dissemination of Flow Specification Rules
444.Re
445.Pp
446.Rs
447.%D December 2020
448.%R RFC 8956
449.%T Dissemination of Flow Specification Rules for IPv6
450.Re
451.Pp
452.Rs
453.%D July 2021
454.%R RFC 9072
455.%T Extended Optional Parameters Length for BGP OPEN Message
456.Re
457.Pp
458.Rs
459.%D May 2022
460.%R RFC 9234
461.%T Route Leak Prevention and Detection Using Roles in UPDATE and OPEN Messages
462.Re
463.Pp
464.Rs
465.%D November 2024
466.%R RFC 9687
467.%T Border Gateway Protocol 4 (BGP-4) Send Hold Timer
468.Re
469.Pp
470.Rs
471.%D October 2022
472.%R draft-ietf-sidrops-aspa-verification
473.%T BGP AS_PATH Verification Based on Resource Public Key Infrastructure (RPKI) Autonomous System Provider Authorization (ASPA) Objects
474.Re
475.Sh HISTORY
476The
477.Nm
478program first appeared in
479.Ox 3.5 .
480