BGPCTL(8)

πŸ’… BGPCTL πŸ’… β€” like, the control page for the BGP routing daemon, from the System Manager's Manual (section 8, bestie)

okay so. you know bgpd(8)? the BGP routing daemon? this is its remote control. that's the whole vibe. πŸŽ€


✨ NAME ✨

bgpctl β€” control the BGP routing daemon πŸ¦‹


✨ SYNOPSIS ✨

bgpctl [-jnV] [-s socket] command [argument ...]

✨ DESCRIPTION ✨

so bgpctl is the program that controls the bgpd(8) daemon. main character energy, but make it sysadmin. πŸ‘‘

and here's the little life hack: commands can be abbreviated β€” just give the minimum unambiguous prefix. like, s su is a totally valid way to say show summary. not me typing three letters instead of twelve bestie, it's called efficiency. πŸ’…

the options, bestie

  • -j β€” make the output a JSON object. yes, machine-readable. slay. 🧚
  • -n β€” show the neighbors' IP addresses instead of their description. raw facts only.
  • -s socket β€” use socket to talk to bgpd(8) instead of the default /run/bgpd/bgpd.sock.<rdomain>, where <rdomain> is the routing domain bgpctl is running in. wanna administer bgpd(8) in a different routing domain? then run bgpctl in that routing domain. that's it, that's the rule. 🫢
  • -V β€” show the version and dip. bye. ✌️

the commands, and yes there are a LOT of them

🩡 fib

  • fib [table number] couple β€” insert the learned routes into the specified Forwarding Information Base, a.k.a. the kernel routing table. couple them up, they're in love now πŸ’–
  • fib [table number] decouple β€” remove the learned routes from the specified Forwarding Information Base, a.k.a. the kernel routing table. it's giving breakup era 😭

🌸 flowspec

  • flowspec add family rule [set argument ...] β€” add the specified flowspec rule to the list of announced rules. right now family can be either inet or inet6. you can set various path attributes with the extra arguments. and heads up: adding a rule will replace an existing equal rule, including rules loaded from the configuration. check bgpd.conf(5) for how to actually write a flowspec rule. πŸ‘€
  • flowspec delete family rule β€” remove the specified flowspec rule from the list of announced rules. gone. ghosted. πŸ’€
  • flowspec flush β€” remove all dynamically added flowspec rules (i.e. the ones you added with bgpctl flowspec add) from the list of announced rules.
  • flowspec show family β€” show all announced flowspec rules. family, if given, limits the output to that address family. supported families are inet and inet6.

πŸ¦‹ log

  • log brief β€” disable verbose debug logging. turn it off. quiet luxury.
  • log verbose β€” enable verbose debug logging. turn it on. loud era.

πŸ’œ neighbor

  • neighbor peer clear [reason] β€” stop and restart the BGP session to the specified neighbor. if you give a reason, that reason gets sent as an Administrative Shutdown Communication to the neighbor. peer may be the neighbor's address, the neighbor's description, or the word group followed by a group description.
  • neighbor peer destroy β€” destroy a previously cloned peer. ⚠️ the peer must be down before you call this one, no exceptions. peer may be the neighbor's address, the neighbor's description, or the word group followed by a group description.
  • neighbor peer down [reason] β€” take the BGP session to the specified neighbor down. if you give a reason, it's sent as an Administrative Shutdown Communication to the neighbor. peer may be the neighbor's address, the neighbor's description, or the word group followed by a group description.
  • neighbor peer refresh β€” ask the neighbor to re-send all routes. but lowkey important: the neighbor is not obliged to re-send all routes, or any routes at all, even if it announced the route refresh capability. so. yeah. don't count on it bestie. πŸ™ˆ peer may be the neighbor's address, the neighbor's description, or the word group followed by a group description.
  • neighbor peer up β€” bring the BGP session to the specified neighbor up. rise and shine ✨ peer may be the neighbor's address, the neighbor's description, or the word group followed by a group description.

πŸŽ€ network

  • network add prefix [argument ...] β€” add the specified prefix to the list of announced networks. you can set various path attributes with the extra arguments. and fyi: adding a prefix will replace an existing equal prefix, including prefixes loaded from the configuration.
  • network bulk add [argument ...] β€” bulk add the specified prefixes to the list of announced networks. prefixes should be sent via stdin. you can set various path attributes with the extra arguments. mass add, main character behaviour πŸ‘‘
  • network bulk delete β€” bulk remove the specified prefixes from the list of announced networks. prefixes should be sent via stdin.
  • network delete prefix β€” remove the specified prefix from the list of announced networks.
  • network flush β€” remove all dynamically added prefixes (i.e. the ones you added with bgpctl network add) from the list of announced networks.
  • network mrt file file filter β€” import networks from an MRT table dump, for debugging purposes. filter can be specified the same way as with the show mrt command. only networks matching the filter will be imported.
  • network show family β€” show all announced networks. family, if given, limits the output to that address family. supported families are inet and inet6.

πŸ’« reload

  • reload [reason] β€” reload the configuration file. ⚠️ changes to these neighbor options in bgpd.conf(5) only take effect when the session is reset: ipsec and tcp md5sig. so don't come crying to me when your config reload didn't do the thing, bestie.

🌈 show

  • show fib filter β€” show routes from bgpd(8)'s view of the Forwarding Information Base. filter can be an IP address β€” in which case the route to that address is shown β€” or a flag:
    • bgp β€” show only routes originating from bgpd(8) itself.
    • connected β€” show only connected routes.
    • inet β€” show only IPv4 routes.
    • inet6 β€” show only IPv6 routes.
    • nexthop β€” show only routes required to reach a BGP nexthop.
    • static β€” show only static routes.
    • table number β€” show the routing table with ID number instead of the default routing table with ID 0.
  • show interfaces β€” show the interface states. the vibe check, but for interfaces.
  • show metrics β€” dump various BGP statistics in OpenMetrics format. numbers numbers numbers πŸ“Š
  • show mrt [options] filter β€” show routes from an MRT table dump file. filter can be an IP address, a CIDR prefix, an AS filter, a combination, or literally nothing:
    • address β€” show best matching route for address.
    • address/len β€” show RIB entry for this CIDR prefix.
    • address/len all β€” show all entries in the specified range.
    • address/len or-shorter β€” show all entries covering and including the specified prefix.
    • as as β€” show all entries with as anywhere in the AS path.
    • empty-as β€” show all entries that are internal routes with no AS's in the AS path.
    • neighbor ip β€” show only entries from the specified peer.
    • peer-as as β€” show all entries with as as leftmost AS.
    • source-as as β€” show all entries with as as rightmost AS.
    • transit-as as β€” show all entries with as anywhere but rightmost.

also, these options exist too:

  • detail β€” show more detailed output for matching routes.
  • family β€” limit the output to the given address family.
  • file name β€” read the MRT dump from file name instead of using stdin.
  • peers β€” print the neighbor table of MRT TABLE_DUMP_V2 dumps. using this on other table dumps will only show the neighbor of the first entry.

multiple options and filters can be used at the same time. mix and match, it's a lewk. πŸ’…

  • show neighbor peer modifier β€” show detailed information about the neighbor identified by peer, according to the given modifier:
    • messages β€” show statistics about sent and received BGP messages.
    • 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, sent and received withdraws, the neighbor's address (or subnet, for a template), AS number, and finally description. that's a lot of numbers bestie, hydrate. πŸ“
    • timers β€” show the BGP timers.

peer may be the neighbor's address, the neighbor's description, or the word group followed by a group description.

  • show nexthop β€” show the list of BGP nexthops and the result of their validity check. are they valid? are they a mess? find out. πŸ”₯
  • show rib [options] filter β€” show routes from the bgpd(8) Routing Information Base. filter can be an IP address, a CIDR prefix, an AS filter or nothing:
  • address β€” shows the best matching route for address. like, the one route that wins for that IP πŸ’…
  • address/len β€” shows the RIB entry for this CIDR prefix.
  • address/len all β€” shows every entry in the specified range.
  • address/len or-shorter β€” shows all entries covering and including the specified prefix. so the prefix itself plus everything more general πŸ¦‹
  • as as β€” shows all entries with as anywhere in the AS path.
  • avs (valid | unknown | invalid) β€” shows all entries with a matching ASAP Validation State (AVS).
  • community community β€” shows all entries with community community.
  • empty-as β€” shows all entries that are internal routes with no AS's in the AS path.
  • large-community large-community β€” shows all entries with large-community large-community.
  • memory β€” shows RIB memory statistics.
  • neighbor peer β€” shows only entries from the specified peer.
  • neighbor group description β€” shows only entries from the specified peer group.
  • ovs (valid | not-found | invalid) β€” shows all entries with a matching Origin Validation State (OVS).
  • path-id pathid β€” shows only entries which match the specified pathid. ⚠️ must be used together with either neighbor or out, no solo runs bestie.
  • peer-as as β€” shows all entries with as as the leftmost AS.
  • source-as as β€” shows all entries with as as the rightmost AS.
  • summary β€” this is the same as the show summary command.
  • table rib β€” shows only entries from the specified RIB table.
  • transit-as as β€” shows all entries with as anywhere but the rightmost position.

Additionally, the following options are defined:

  • best β€” alias for selected.
  • detail β€” show more detailed output for matching routes.
  • disqualified β€” show only routes which are not eligible.
  • error β€” show only prefixes which are marked invalid and were treated as withdrawn.
  • family β€” limit the output to the given address family.
  • filtered β€” show only routes which were filtered out. needs rde rib Loc-RIB include filtered to be set in the config, no cap.
  • in β€” show routes from the unfiltered Adj-RIB-In. the neighbor needs to be specified.
  • leaked β€” show only routes where a route leak was detected.
  • out β€” show the filtered routes sent to a neighbor. the neighbor needs to be specified.
  • selected β€” show only selected routes.
  • ssv β€” show each RIB entry as a single line, with fields separated by semicolons. only works if detail is specified.
Options are silently ignored when used together with summary or memory. multiple options can be used at the same time and the neighbor filter can be combined with other filters. so yeah, stack them besties πŸ’…

✨ show rtr ✨

Show a list of all RPKI-to-Router (RTR) sessions, including information about the session state. it's giving peek behind the RTR curtain πŸ¦‹

✨ show sets ✨

Show a list summarizing all roa-set, as-set, prefix-set, and origin-set tables. all the sets, one lil summary, obsessed πŸŽ€

✨ show summary ✨

Show a list of all neighbors, including information about the session state and message counters:

  • Neighbor β€” description of the neighbor.
  • AS β€” autonomous system number.
  • MsgRcvd β€” number of messages received from the neighbor.
  • MsgSent β€” number of messages sent to the neighbor.
  • OutQ β€” number of outgoing messages queued.
  • Up/Down β€” number of days and hours that the session has been up.
  • State/PrfRcvd β€” state of the session / number of routes received. the session is up if there is no information for the State column (Established is not displayed). so like, no news = good news 🌸

✨ show summary terse ✨

Show a list of all neighbors, including information about the session state, in a terse format. short queen energy πŸ‘‘

✨ show tables ✨

Show a list of all currently loaded fib routing tables.


πŸ“ FILES πŸ“

  • /etc/bgpd.conf β€” default bgpd(8) configuration file
  • /run/bgpd/bgpd.sock β€” default bgpd(8) control socket

πŸ‘€ SEE ALSO πŸ‘€

rdomain(4), route(4), bgpd.conf(5), bgpd(8), bgplg(8), bgplgd(8), bgplgsh(8), route(8), rpki-client(8), rtrctl(8), rtrd(8)


🌈 HISTORY 🌈

The bgpctl program first appeared in OpenBSD 3.5. a true vintage icon, been serving since way back πŸ’–


and that's a wrap bestie!! 🫢 this Debian page was dated September 21, 2026 and it's the BGPCTL(8) man page β€” go forth and inspect those routes, you absolute legend πŸ’…βœ¨

πŸ“¦ where this page comes from