1BGPD(8) BSD System Manager's Manual BGPD(8)
2
4 bgpd — Border Gateway Protocol daemon
5
7 bgpd [-cdnvV] [-D macro=value] [-f file]
8
10 bgpd is a Border Gateway Protocol (BGP) daemon which manages the network
11 routing tables. Its main purpose is to exchange information concerning
12 "network reachability" with other BGP systems. bgpd uses the Border
13 Gateway Protocol, Version 4, as described in RFC 4271.
14
15 BGP is an exterior gateway protocol using a multiple step decision
16 process to find the best path. Advanced filtering can be used to influ‐
17 ence the route decision for traffic engineering. The session engine of
18 bgpd is responsible for maintaining the TCP session with each neighbor.
19 Updates are passed to the Route Decision Engine (RDE) where the paths are
20 filtered and used to compute a Routing Information Base (RIB). The par‐
21 ent process is responsible for keeping the RIB in sync with the kernel
22 routing table.
23
24 The route decision process selects the best path by evaluating all paths
25 to the same destination. The decision process continues to the next step
26 if paths have equal attributes. Paths that are less preferred are taken
27 out of consideration until there is only one path left.
28
29 1. All paths with errors or loops are not eligible.
30
31 2. Paths with an unreachable nexthop are not eligible. After this
32 step all remaining paths are valid.
33
34 3. The path with the highest LOCAL_PREF is selected.
35
36 4. The path with the shortest AS path attribute is selected.
37
38 5. The ORIGIN attribute is compared. The order is IGP before EGP
39 before incomplete origins.
40
41 6. The path with the lowest MULTI_EXIT_DISC metric is selected.
42 Normally, this value is only considered when choosing between
43 multiple routes sent by the same neighbouring AS. However, if
44 “rde med compare always” is set in the configuration, the metric
45 is compared for routes sent by any AS.
46
47 7. Comparison of the BGP session type. Paths learned over an exter‐
48 nal (EBGP) session are preferred over those learned via an inter‐
49 nal (IBGP) session.
50
51 8. The path with the highest local weight is selected.
52
53 9. If “rde route-age evaluate” is set then the oldest path is se‐
54 lected.
55
56 10. The path coming from the neighbor with the lowest BGP ID wins.
57 If the ORIGINATOR_ID attribute is present, that value will be
58 used in the comparison instead.
59
60 11. The path with the shortest CLUSTER_LIST attribute is selected.
61 If it is not present then a length of 0 is used in the compari‐
62 son.
63
64 12. The path coming from the peer with the lowest IP address is se‐
65 lected. IPv4 sessions will be preferred over IPv6 ones.
66
67 Attributes set by filters can be used to tip the decision process to pre‐
68 fer particular paths over others. This can be achieved by changing the
69 localpref, med, or weight attributes. AS path prepending or changing the
70 med or origin attribute can be used to influence the routing behaviour on
71 remote systems.
72
73 To have bgpd enabled at boot time, use “rcctl enable bgpd”, which sets
74
75 bgpd_flags=""
76
77 in rc.conf.local(8).
78
79 When bgpd starts up, it reads settings from a configuration file, typi‐
80 cally bgpd.conf(5). A running bgpd process can be controlled using the
81 bgpctl(8) utility.
82
83 The options are as follows:
84
85 -c Force bgpd to do carp(4) demotion at startup when the demote
86 functionality is used. Normally, bgpd will only do demotion
87 at startup when the demotion counter for the group in ques‐
88 tion is already greater than 0. bgpd will start handling de‐
89 motion after all sessions with demotion configured for the
90 given group have been successfully established. At system
91 startup, rc(8) has the demotion counter for the group carp
92 increased until after bgpd is started, so this option should
93 not be used in rc.conf(8).
94
95 -D macro=value
96 Define macro to be set to value on the command line. Over‐
97 rides the definition of macro in the configuration file.
98
99 -d Do not daemonize. If this option is specified, bgpd will run
100 in the foreground and log to stderr.
101
102 -f file Use file as the configuration file, instead of the default
103 /etc/bgpd.conf.
104
105 -n Configtest mode. Only check the configuration file for va‐
106 lidity.
107
108 -v Produce more verbose output.
109
110 -V Show the version and exit.
111
113 /etc/bgpd.conf Default bgpd configuration file.
114 /run/bgpd/bgpd.sock.<rdomain> Default bgpd control socket, where
115 <rdomain> is the routing domain in which
116 bgpd has been started.
117
119 bgpd.conf(5), bgpctl(8), bgplg(8), bgplgsh(8)
120
122 R. Chandra, P. Traina, and T. Li, BGP Communities Attribute, RFC 1997,
123 August 1996.
124
125 A. Heffernan, Protection of BGP Sessions via the TCP MD5 Signature
126 Option, RFC 2385, August 1998.
127
128 P. Marques and F. Dupont, Use of BGP-4 Multiprotocol Extensions for IPv6
129 Inter-Domain Routing, RFC 2545, March 1999.
130
131 E. Chen, Route Refresh Capability for BGP-4, RFC 2918, September 2000.
132
133 G. Huston, NOPEER Community for Border Gateway Protocol (BGP) Route Scope
134 Control, RFC 3765, April 2004.
135
136 Y. Rekhter, T. Li, and S. Hares, A Border Gateway Protocol 4 (BGP-4), RFC
137 4271, January 2006.
138
139 S. Sangli, D. Tappan, and Y. Rekhter, BGP Extended Communities Attribute,
140 RFC 4360, February 2006.
141
142 E. Rosen and Y. Rekhter, BGP/MPLS IP Virtual Private Networks (VPNs), RFC
143 4364, February 2006.
144
145 T. Bates, E. Chen, and R. Chandra, BGP Route Reflection: An Alternative
146 to Full Mesh Internal BGP (IBGP), RFC 4456, April 2006.
147
148 E. Chen and V. Gillet, Subcodes for BGP Cease Notification Message, RFC
149 4486, April 2006.
150
151 T. Bates, R. Chandra, D. Katz, and Y. Rekhter, Multiprotocol Extensions
152 for BGP-4, RFC 4760, January 2007.
153
154 V. Gill, J. Heasley, D. Meyer, P. Savola, and C. Pignataro, The
155 Generalized TTL Security Mechanism (GTSM), RFC 5082, October 2007.
156
157 J. Scudder and R. Chandra, Capabilities Advertisement with BGP-4, RFC
158 5492, February 2009.
159
160 E. Chen and J. Yuan, Autonomous-System-Wide Unique BGP Identifier for
161 BGP-4, RFC 6286, June 2011.
162
163 Q. Vohra and E. Chen, BGP Support for Four-Octet Autonomous System (AS)
164 Number Space, RFC 6793, Dec 2012.
165
166 E. Chen, J. Scudder, P. Mohapatra, and K. Patel, Revised Error Handling
167 for BGP UPDATE Messages, RFC 7606, August 2015.
168
169 L. Blunk, M. Karir, and C. Labovitz, Multi-Threaded Routing Toolkit (MRT)
170 Routing Information Export Format, RFC 6396, October 2011.
171
172 J. Dong, M. Chen, and A. Suryanarayana, Subcodes for BGP Finite State
173 Machine Error, RFC 6608, May 2012.
174
175 K. Patel, E. Chen, and B. Venkatachalapathy, Enhanced Route Refresh
176 Capability for BGP-4, RFC 7313, July 2014.
177
178 W. Kumari, R. Bush, H. Schiller, and K. Patel, Codification of AS 0
179 Processing, RFC 7607, August 2015.
180
181 D. Walton, A. Retana, E. Chen, and J. Scudder, Advertisement of Multiple
182 Paths in BGP, RFC 7911, July 2016.
183
184 C. Petrie and T. King, Multi-Threaded Routing Toolkit (MRT) Routing
185 Information Export Format with BGP Additional Path Extensions, RFC 8050,
186 May 2017.
187
188 J. Heitz, J. Snijders, K. Patel, I. Bagdonas, and N. Hilliard, BGP Large
189 Communities Attribute, RFC 8092, February 2017.
190
191 P. Mohapatra, K. Patel, J. Scudder, D. Ward, and R. Bush, BGP Prefix
192 Origin Validation State Extended Community, RFC 8097, March 2017.
193
194 J. Snijders, J. Heitz, and J. Scudder, BGP Administrative Shutdown
195 Communication, RFC 8203, July 2017.
196
197 R. Bush and R. Austein, The Resource Public Key Infrastructure (RPKI) to
198 Router Protocol, Version 1, RFC 8210, September 2017.
199
200 J. Mauch, J. Snijders, and G. Hankins, Default External BGP (EBGP) Route
201 Propagation Behavior without Policies, RFC 8212, July 2017.
202
203 P. Francois, B. Decraene, C. Pelsser, K. Patel, and C. Filsfils, Graceful
204 BGP Session Shutdown, RFC 8326, March 2018.
205
206 E. Chen and J. Scudder, Extended Optional Parameters Length for BGP OPEN
207 Message, RFC 9072, July 2021.
208
209 A. Azimov, E. Bogomazov, R. Bush, K. Patel, and K. Sriram, Route Leak
210 Prevention and Detection Using Roles in UPDATE and OPEN Messages, RFC
211 9234, May 2022.
212
214 The bgpd program first appeared in OpenBSD 3.5.
215
216BSD July 12, 2022 BSD