1.\" $OpenBSD: bgpd.8,v 1.48 2013/08/14 06:32:36 jmc 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: August 14 2013 $ 18.Dt BGPD 8 19.Os 20.Sh NAME 21.Nm bgpd 22.Nd Border Gateway Protocol daemon 23.Sh SYNOPSIS 24.Nm bgpd 25.Bk -words 26.Op Fl cdnv 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 lowest 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.It 116In case of locally announced prefixes 117.Nm 118will prefer statically set prefixes over dynamically inserted ones. 119.El 120.Pp 121Attributes set by filters can be used to tip the decision process to prefer 122particular paths over others. 123This can be achieved by changing the 124.Em localpref , 125.Em med , 126or 127.Em weight 128attributes. 129AS path prepending or changing the 130.Em med 131or 132.Em origin 133attribute can be used to influence the routing behaviour on remote systems. 134.Pp 135.Nm 136is usually started at boot time, and can be enabled by 137setting the following in 138.Pa /etc/rc.conf.local : 139.Pp 140.Dl bgpd_flags=\&"\&" 141.Pp 142See 143.Xr rc 8 144and 145.Xr rc.conf 8 146for more information on the boot process 147and enabling daemons. 148.Pp 149When 150.Nm 151starts up, it reads settings from a configuration file, 152typically 153.Xr bgpd.conf 5 . 154A running 155.Nm 156process can be controlled using the 157.Xr bgpctl 8 158utility. 159.Pp 160The options are as follows: 161.Bl -tag -width "-f fileXXX" 162.It Fl c 163Force 164.Nm 165to do 166.Xr carp 4 167demotion at startup when the 168.Em demote 169functionality is used. 170Normally, 171.Nm 172will only do demotion at startup when the demotion counter for the group 173in question is already greater than 0. 174.Nm 175will start handling demotion after all sessions with demotion configured for 176the given group have been successfully established. 177At system startup, 178.Xr rc 8 179has the demotion counter for the group 180.Em carp 181increased until after 182.Nm 183is started, so this option should 184.Em not 185be used in 186.Xr rc.conf 8 . 187.It Fl D Ar macro Ns = Ns Ar value 188Define 189.Ar macro 190to be set to 191.Ar value 192on the command line. 193Overrides the definition of 194.Ar macro 195in the configuration file. 196.It Fl d 197Do not daemonize. 198If this option is specified, 199.Nm 200will run in the foreground and log to 201.Em stderr . 202.It Fl f Ar file 203Use 204.Ar file 205as the configuration file, 206instead of the default 207.Pa /etc/bgpd.conf . 208.It Fl n 209Configtest mode. 210Only check the configuration file for validity. 211.It Fl v 212Produce more verbose output. 213.El 214.Sh FILES 215.Bl -tag -width "/var/run/bgpd.sockXXX" -compact 216.It Pa /etc/bgpd.conf 217default 218.Nm 219configuration file 220.It Pa /var/run/bgpd.sock 221default 222.Nm 223control socket 224.El 225.Sh SEE ALSO 226.Xr bgpd.conf 5 , 227.Xr bgpctl 8 , 228.Xr bgplg 8 , 229.Xr bgplgsh 8 230.Sh STANDARDS 231.Rs 232.%A R. Chandra 233.%A P. Traina 234.%A "T. Li" 235.%D August 1996 236.%R RFC 1997 237.%T BGP Communities Attribute 238.Re 239.Pp 240.Rs 241.%A A. Heffernan 242.%D August 1998 243.%R RFC 2385 244.%T Protection of BGP Sessions via the TCP MD5 Signature Option 245.Re 246.Pp 247.Rs 248.%A P. Marques 249.%A F. Dupont 250.%D March 1999 251.%R RFC 2545 252.%T Use of BGP-4 Multiprotocol Extensions for IPv6 Inter-Domain Routing 253.Re 254.Pp 255.Rs 256.%A E. Chen 257.%D September 2000 258.%R RFC 2918 259.%T Route Refresh Capability for BGP-4 260.Re 261.Pp 262.Rs 263.%A G. Huston 264.%D April 2004 265.%R RFC 3765 266.%T NOPEER Community for Border Gateway Protocol (BGP) Route Scope Control 267.Re 268.Pp 269.Rs 270.%A Y. Rekhter 271.%A "T. Li" 272.%A S. Hares 273.%D January 2006 274.%R RFC 4271 275.%T A Border Gateway Protocol 4 (BGP-4) 276.Re 277.Pp 278.Rs 279.%A S. Sangli 280.%A D. Tappan 281.%A Y. Rekhter 282.%D February 2006 283.%R RFC 4360 284.%T BGP Extended Communities Attribute 285.Re 286.Pp 287.Rs 288.%A E. Rosen 289.%A Y. Rekhter 290.%D February 2006 291.%R RFC 4364 292.%T BGP/MPLS IP Virtual Private Networks (VPNs) 293.Re 294.Pp 295.Rs 296.%A T. Bates 297.%A E. Chen 298.%A R. Chandra 299.%D April 2006 300.%R RFC 4456 301.%T "BGP Route Reflection: An Alternative to Full Mesh Internal BGP (IBGP)" 302.Re 303.Pp 304.Rs 305.%A E. Chen 306.%A V. Gillet 307.%D April 2006 308.%R RFC 4486 309.%T Subcodes for BGP Cease Notification Message 310.Re 311.Pp 312.Rs 313.%A T. Bates 314.%A R. Chandra 315.%A D. Katz 316.%A Y. Rekhter 317.%D January 2007 318.%R RFC 4760 319.%T Multiprotocol Extensions for BGP-4 320.Re 321.Pp 322.Rs 323.%A Q. Vohra 324.%A E. Chen 325.%D May 2007 326.%R RFC 4893 327.%T BGP Support for Four-octet AS Number Space 328.Re 329.Pp 330.Rs 331.%A V. Gill 332.%A J. Heasley 333.%A D. Meyer 334.%A P. Savola 335.%A C. Pignatoro 336.%D October 2007 337.%R RFC 5082 338.%T The Generalized TTL Security Mechanism (GTSM) 339.Re 340.Pp 341.Rs 342.%A J. Scudder 343.%A R. Chandra 344.%D February 2009 345.%R RFC 5492 346.%T Capabilities Advertisement with BGP-4 347.Re 348.Pp 349.Rs 350.%D April 2009 351.%R draft-ietf-idr-optional-transitive-00 352.%T Error Handling for Optional Transitive BGP Attributes 353.Re 354.Pp 355.Rs 356.%D August 2011 357.%R draft-ietf-grow-mrt-17 358.%T MRT routing information export format 359.Re 360.Pp 361.Rs 362.%A J. Dong 363.%A M. Chen 364.%A A. Suryanarayana 365.%D May 2012 366.%R RFC 6608 367.%T Subcodes for BGP Finite State Machine Error 368.Re 369.Sh HISTORY 370The 371.Nm 372program first appeared in 373.Ox 3.5 . 374