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