xref: /openbsd-src/usr.sbin/bgpctl/bgpctl.8 (revision f2da64fbbbf1b03f09f390ab01267c93dfd77c4c)
1.\" $OpenBSD: bgpctl.8,v 1.69 2016/05/25 14:15:59 jmc 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 25 2016 $
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 clear
99Stop and restart the BGP session to the specified neighbor.
100.Ar peer
101may be the neighbor's address or description.
102.It Cm neighbor Ar peer Cm destroy
103Destroy a previously cloned peer.
104The peer must be down before calling this function.
105.Ar peer
106may be the neighbor's address or description.
107.It Cm neighbor Ar peer Cm down
108Take the BGP session to the specified neighbor down.
109.Ar peer
110may be the neighbor's address or description.
111.It Cm neighbor Ar peer Cm refresh
112Request the neighbor to re-send all routes.
113Note that the neighbor is not obliged to re-send all routes, or any routes at
114all, even if it announced the route refresh capability.
115.Ar peer
116may be the neighbor's address or description.
117.It Cm neighbor Ar peer Cm up
118Take the BGP session to the specified neighbor up.
119.Ar peer
120may be the neighbor's address or description.
121.It Cm network add Ar prefix Op Ar arguments
122Add the specified prefix to the list of announced networks.
123It is possible to set various path attributes with additional
124.Ar arguments .
125.It Xo
126.Cm network bulk
127.Op Ar arguments
128.Op Cm add
129.Xc
130Bulk add specified prefixes to the list of announced networks.
131Prefixes should be sent via stdin.
132It is possible to set various path attributes with additional
133.Ar arguments .
134If neither
135.Cm add
136or
137.Cm delete
138is given,
139.Cm add
140is the default.
141.It Cm network bulk delete
142Bulk remove the specified prefixes from the list of announced networks.
143Prefixes should be sent via stdin.
144.It Cm network delete Ar prefix
145Remove the specified prefix from the list of announced networks.
146.It Cm network flush
147Remove all dynamically added prefixes from the list of announced networks.
148.It Cm network mrt file Ar file filter
149Import networks from an MRT table dump for debugging purposes.
150.Ar filter
151can be specified similarly to the
152.Ar show mrt
153command.
154Only networks matching the filter will be imported.
155.It Cm network show Ar family
156Show all announced networks.
157.Ar family ,
158if given, limits the output to the given address family.
159The supported families are
160.Em inet
161and
162.Em inet6 .
163.It Cm reload
164Reload the configuration file.
165.It Cm show fib Ar filter
166Show routes from
167.Xr bgpd 8 Ns 's
168view of the Forwarding Information Base.
169.Ar filter
170can be an IP address, in which case the route to this address is shown,
171or a flag:
172.Pp
173.Bl -tag -width tableXnumber -compact
174.It Cm connected
175Show only connected routes.
176.It Cm static
177Show only static routes.
178.It Cm bgp
179Show only routes originating from
180.Xr bgpd 8
181itself.
182.It Cm nexthop
183Show only routes required to reach a BGP nexthop.
184.It Cm inet
185Show only IPv4 routes.
186.It Cm inet6
187Show only IPv6 routes.
188.It Cm table Ar number
189Show the routing table with ID
190.Ar number
191instead of the default routing table with ID 0.
192.El
193.It Cm show interfaces
194Show the interface states.
195.It Xo
196.Cm show mrt
197.Op Ar options
198.Ar filter
199.Xc
200Show routes from an MRT table dump file.
201.Ar filter
202can be an IP address, a CIDR prefix, an AS filter, a combination or nothing:
203.Pp
204.Bl -tag -width "address/len all" -compact
205.It Ar address
206Show best matching route for address.
207.It Ar address Ns Li / Ns Ar len
208Show RIB entry for this CIDR prefix.
209.It Xo
210.Ar address Ns Li / Ns Ar len
211.Cm all
212.Xc
213Show all entries in the specified range.
214.\".It Ar address/len Cm longer-prefixes
215.It Cm as Ar as
216Show all entries with
217.Ar as
218anywhere in the AS path.
219.It Cm empty-as
220Show all entries that are internal routes with no AS's in the AS path.
221.It Cm neighbor Ar ip
222Show only entries from the specified peer.
223.It Cm peer-as Ar as
224Show all entries with
225.Ar as
226as leftmost AS.
227.It Cm source-as Ar as
228Show all entries with
229.Ar as
230as rightmost AS.
231.It Cm transit-as Ar as
232Show all entries with
233.Ar as
234anywhere but rightmost.
235.El
236.Pp
237Additionally, the following
238.Ar options
239are defined:
240.Pp
241.Bl -tag -width "file name" -compact
242.It Cm detail
243Show more detailed output for matching routes.
244.It Ar family
245Limit the output to the given address family.
246.It Cm file Ar name
247Read the MRT dump from file
248.Ar name
249instead of using stdin.
250.El
251.Pp
252Multiple options and filters can be used at the same time.
253.It Cm show neighbor Ar peer modifier
254Show detailed information about the neighbor identified by
255.Ar peer ,
256which may be the neighbor's address or description,
257according to the given
258.Ar modifier :
259.Pp
260.Bl -tag -width messages -compact
261.It Cm messages
262Show statistics about sent and received BGP messages.
263.It Cm terse
264Show statistics in an easily parseable terse format.
265The printed numbers are the sent and received open, sent and received
266notifications, sent and received updates, sent and received keepalives, and
267sent and received route refresh messages plus the current and maximum
268prefix count, the number of sent and received updates, and withdraws.
269.It Cm timers
270Show the BGP timers.
271.El
272.It Cm show nexthop
273Show the list of BGP nexthops and the result of their validity check.
274.It Xo
275.Cm show rib
276.Op Ar options
277.Ar filter
278.Xc
279Show routes from the
280.Xr bgpd 8
281Routing Information Base.
282.Ar filter
283can be an IP address, a CIDR prefix, an AS filter or nothing:
284.Pp
285.Bl -tag -width "address/len all" -compact
286.It Ar address
287Show best matching route for address.
288.It Ar address Ns Li / Ns Ar len
289Show RIB entry for this CIDR prefix.
290.It Xo
291.Ar address Ns Li / Ns Ar len
292.Cm all
293.Xc
294Show all entries in the specified range.
295.\".It Ar address/len Cm longer-prefixes
296.It Cm as Ar as
297Show all entries with
298.Ar as
299anywhere in the AS path.
300.It Cm community Ar community
301Show all entries with community
302.Ar community .
303.It Cm empty-as
304Show all entries that are internal routes with no AS's in the AS path.
305.It Cm memory
306Show RIB memory statistics.
307.It Cm neighbor Ar peer
308Show only entries from the specified peer.
309.It Cm peer-as Ar as
310Show all entries with
311.Ar as
312as leftmost AS.
313.It Cm source-as Ar as
314Show all entries with
315.Ar as
316as rightmost AS.
317.It Cm summary
318This is the same as the
319.Ic show summary
320command.
321.It Cm table Ar rib
322Show only entries from the specified RIB table.
323.It Cm transit-as Ar as
324Show all entries with
325.Ar as
326anywhere but rightmost.
327.El
328.Pp
329Additionally, the following
330.Ar options
331are defined:
332.Pp
333.Bl -tag -width "detail" -compact
334.It Cm best
335Alias for
336.Ic selected .
337.It Cm selected
338Show only selected routes.
339.It Cm detail
340Show more detailed output for matching routes.
341.It Ar family
342Limit the output to the given address family.
343.It Cm in
344Show routes from the unfiltered Adj-RIB-In.
345This is only possible if
346.Em softreconfig in
347is enabled for the neighbor.
348The
349.Cm neighbor
350needs to be specified.
351.It Cm out
352Show the filtered routes sent to a neighbor.
353The
354.Cm neighbor
355needs to be specified.
356.El
357.Pp
358Options are silently ignored when used together with
359.Ar summary
360or
361.Ar memory .
362Multiple options can be used at the same time and the
363.Ar neighbor
364filter can be combined with other filters.
365.It Cm show summary
366Show a list of all neighbors, including information about the session state
367and message counters:
368.Pp
369.Bl -tag -width xxxxxxxxxxxxxx -compact
370.It Neighbor
371Description of the neighbor.
372.It AS
373Autonomous system number.
374.It MsgRcvd
375Number of messages received from the neighbor.
376.It MsgSent
377Number of messages sent to the neighbor.
378.It OutQ
379Number of outgoing messages queued.
380.It Up/Down
381Number of days and hours that the session has been up.
382.It State/PrfRcvd
383State of the session / Number of routes received.
384The session is up if there is no information for the State column
385(Established is not displayed).
386.El
387.It Cm show summary terse
388Show a list of all neighbors, including information about the session state,
389in a terse format.
390.It Cm show tables
391Show a list of all currently loaded fib routing tables.
392.El
393.Sh FILES
394.Bl -tag -width "/var/run/bgpd.sockXXX" -compact
395.It Pa /etc/bgpd.conf
396default
397.Xr bgpd 8
398configuration file
399.It Pa /var/run/bgpd.sock
400default
401.Xr bgpd 8
402control socket
403.El
404.Sh SEE ALSO
405.Xr bgpd.conf 5 ,
406.Xr bgpd 8 ,
407.Xr bgplg 8 ,
408.Xr bgplgsh 8
409.Sh STANDARDS
410.Rs
411.%A C. Alaettinoglu
412.%A C. Villamizar
413.%A E. Gerich
414.%A D. Kessens
415.%A D. Meyer
416.%A T. Bates
417.%A D. Karrenberg
418.%A M. Terpstra
419.%D June 1999
420.%R RFC 2622
421.%T Routing Policy Specification Language (RPSL)
422.Re
423.Sh HISTORY
424The
425.Nm
426program first appeared in
427.Ox 3.5 .
428irrfilter mode was added in
429.Ox 4.1 .
430