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