1.\" $OpenBSD: bgpctl.8,v 1.48 2008/12/06 13:18:12 sobrado Exp $ 2.\" 3.\" Copyright (c) 2003 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: December 6 2008 $ 18.Dt BGPCTL 8 19.Os 20.Sh NAME 21.Nm bgpctl 22.Nd control the Border Gateway Protocol daemon 23.Sh SYNOPSIS 24.Nm bgpctl 25.Op Fl n 26.Op Fl s Ar socket 27.Ar command 28.Op Ar argument ... 29.Sh DESCRIPTION 30The 31.Nm 32program controls the 33.Xr bgpd 8 34daemon. 35Commands to switch between displays may be abbreviated to the 36minimum unambiguous prefix; for example, 37.Cm s s 38for 39.Cm show summary . 40.Pp 41The options are as follows: 42.Bl -tag -width Ds 43.It Fl n 44Show neighbors' IP addresses instead of their description. 45.It Fl s Ar socket 46Use 47.Ar socket 48instead of the default 49.Pa /var/run/bgpd.sock 50to communicate with 51.Xr bgpd 8 . 52.El 53.Pp 54The commands are as follows: 55.Bl -tag -width xxxxxx 56.It Cm fib couple 57Insert the learned routes into the Forwarding Information Base 58a.k.a. the kernel routing table. 59.It Cm fib decouple 60Remove the learned routes from the Forwarding Information Base 61a.k.a. the kernel routing table. 62.It Xo 63.Cm irrfilter 64.Op Ar options 65.Ar as 66.Op Ar arguments 67.Xc 68Get the 69.Em aut-num 70object from the 71.Em Internet Routing Registry 72and generate bgpd filters from the policy specified therein. 73The aut-num object as well as the associated as-set and route objects 74have to be in RPSL format. 75.Pp 76The options are as follows: 77.Bl -tag -width Ds 78.It Fl o Ar directory 79Use 80.Ar directory 81to write the filter files to. 82.El 83.It Cm neighbor Ar peer Cm up 84Take the BGP session to the specified neighbor up. 85.Ar peer 86may be the neighbor's address or description. 87.It Cm neighbor Ar peer Cm down 88Take the BGP session to the specified neighbor down. 89.Ar peer 90may be the neighbor's address or description. 91.It Cm neighbor Ar peer Cm clear 92Stop and restart the BGP session to the specified neighbor. 93.Ar peer 94may be the neighbor's address or description. 95.It Cm neighbor Ar peer Cm refresh 96Request the neighbor to re-send all routes. 97Note that the neighbor is not obliged to re-send all routes, or any routes at 98all, even if it announced the route refresh capability. 99.Ar peer 100may be the neighbor's address or description. 101.It Cm network add Ar prefix 102Add the specified prefix to the list of announced networks. 103.It Cm network delete Ar prefix 104Remove the specified prefix from the list of announced networks. 105.It Cm network flush 106Remove all dynamically added prefixes from the list of announced networks. 107.It Cm network show Ar family 108Show all announced networks. 109.Ar family , 110if given, limits the output to the given address family. 111The supported families are 112.Em inet 113and 114.Em inet6 . 115.It Cm reload 116Reload the configuration file. 117.It Cm show fib Ar filter 118Show routes from 119.Xr bgpd 8 Ns 's 120view of the Forwarding Information Base. 121.Ar filter 122can be an IP address, in which case the route to this address is shown, 123or a flag: 124.Pp 125.Bl -tag -width connected -compact 126.It Cm connected 127Show only connected routes. 128.It Cm static 129Show only static routes. 130.It Cm bgp 131Show only routes originating from 132.Xr bgpd 8 133itself. 134.It Cm nexthop 135Show only routes required to reach a BGP nexthop. 136.El 137.It Cm show interfaces 138Show the interface states. 139.It Cm show neighbor Ar peer modifier 140Show detailed information about the neighbor identified by 141.Ar peer , 142which may be the neighbor's address or description, 143according to the given 144.Ar modifier : 145.Pp 146.Bl -tag -width messages -compact 147.It Cm messages 148Show statistics about sent and received BGP messages. 149.It Cm terse 150Show statistics in an easily parseable terse format. 151The printed numbers are the sent and received open, sent and received 152notifications, sent and received updates, sent and received keepalives, and 153sent and received route refresh messages plus the current and maximum 154prefix count, the number of sent and received updates, and withdraws. 155.It Cm timers 156Show the BGP timers. 157.El 158.It Cm show nexthop 159Show the list of BGP nexthops and the result of their validity check. 160.It Xo 161.Cm show rib 162.Op Ar options 163.Ar filter 164.Xc 165Show routes from the 166.Xr bgpd 8 167Routing Information Base. 168.Ar filter 169can be an IP address, a CIDR prefix, an AS filter or nothing: 170.Pp 171.Bl -tag -width "address/len all" -compact 172.It Ar address 173Show best matching route for address. 174.It Ar address Ns Li / Ns Ar len 175Show RIB entry for this CIDR prefix. 176.It Xo 177.Ar address Ns Li / Ns Ar len 178.Cm all 179.Xc 180Show all entries in the specified range. 181.\".It Ar address/len Cm longer-prefixes 182.It Cm as Ar as 183Show all entries with 184.Ar as 185anywhere in the AS path. 186.It Cm source-as Ar as 187Show all entries with 188.Ar as 189as rightmost AS. 190.It Cm transit-as Ar as 191Show all entries with 192.Ar as 193anywhere but rightmost. 194.It Cm peer-as Ar as 195Show all entries with 196.Ar as 197as leftmost AS. 198.It Cm empty-as 199Show all entries that are internal routes with no AS's in the AS path. 200.It Cm community Ar community 201Show all entries with community 202.Ar community . 203.It Cm neighbor Ar peer 204Show only entries from the specified peer. 205.It Cm summary 206This is the same as the 207.Ic show summary 208command. 209.It Cm memory 210Show RIB memory statistics. 211.El 212.Pp 213Additionally, the following 214.Ar options 215are defined: 216.Pp 217.Bl -tag -width "detail" -compact 218.It Cm detail 219Show more detailed output for matched routes. 220.It Ar family 221Limit the output to the given address family. 222.It Cm in 223Show routes from the unfiltered Adj-RIB-In. 224This is only possible if 225.Em softreconfig in 226is enabled for the neighbor. 227.It Cm out 228Show the filtered routes sent to a neighbor also known as Adj-RIB-Out. 229.El 230.Pp 231Options are silently ignored when used together with 232.Ar summary 233or 234.Ar memory . 235Multiple options can be used at the same time and the 236.Ar neighbor 237filter can be combined with other filters. 238.It Cm show summary 239Show a list of all neighbors, including information about the session state 240and message counters. 241.It Cm show summary terse 242Show a list of all neighbors, including information about the session state, 243in a terse format. 244.El 245.Sh FILES 246.Bl -tag -width "/var/run/bgpd.sockXXX" -compact 247.It Pa /etc/bgpd.conf 248default 249.Xr bgpd 8 250configuration file 251.It Pa /var/run/bgpd.sock 252default 253.Xr bgpd 8 254control socket 255.El 256.Sh SEE ALSO 257.Xr bgpd.conf 5 , 258.Xr bgpd 8 , 259.Xr bgplg 8 , 260.Xr bgplgsh 8 261.Rs 262.%R RFC 2622 263.%T "Routing Policy Specification Language (RPSL)" 264.%D June 1999 265.Re 266.Sh HISTORY 267The 268.Nm 269program first appeared in 270.Ox 3.5 . 271irrfilter mode was added in 272.Ox 4.1 . 273