BGPCTL - Base Setup: Difference between revisions
imported>Z (Created page with "Category:Post-It == Connecting to bgpctl == To connect to bgpctl, simply type the following command in the terminal: <nowiki> bgpctl</nowiki> You will be prompted t...") |
No edit summary |
||
Line 55: | Line 55: | ||
You can also use the `show summary` command to view a summary of all BGP sessions, or the `show rib` command to view the Routing Information Base (RIB) | You can also use the `show summary` command to view a summary of all BGP sessions, or the `show rib` command to view the Routing Information Base (RIB) | ||
== Manpage == | |||
<nowiki> | |||
BGPCTL(8) System Manager's Manual BGPCTL(8) | |||
NAME | |||
bgpctl — control the Border Gateway Protocol daemon | |||
SYNOPSIS | |||
bgpctl [-n] [-s socket] command [argument ...] | |||
DESCRIPTION | |||
The bgpctl program controls the bgpd(8) daemon. Commands may be abbreviated to the minimum unambiguous prefix; for example, s s for show summary. | |||
The options are as follows: | |||
-n | |||
Show neighbors' IP addresses instead of their description. | |||
-s socket | |||
Use socket instead of the default /var/run/bgpd.sock to communicate with bgpd(8). | |||
The commands are as follows: | |||
fib [table number] couple | |||
Insert the learned routes into the specified Forwarding Information Base a.k.a. the kernel routing table. | |||
fib [table number] decouple | |||
Remove the learned routes from the specified Forwarding Information Base a.k.a. the kernel routing table. | |||
irrfilter [options] as [arguments] | |||
Get the aut-num object from the 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. | |||
The options are as follows: | |||
-o directory | |||
Use directory to write the filter files to. | |||
-4 | |||
Fetch only IPv4 prefixes from the registry. | |||
-6 | |||
Fetch only IPv6 prefixes from the registry. | |||
log brief | |||
Disable verbose debug logging. | |||
log verbose | |||
Enable verbose debug logging. | |||
neighbor peer up | |||
Take the BGP session to the specified neighbor up. peer may be the neighbor's address or description. | |||
neighbor peer down | |||
Take the BGP session to the specified neighbor down. peer may be the neighbor's address or description. | |||
neighbor peer clear | |||
Stop and restart the BGP session to the specified neighbor. peer may be the neighbor's address or description. | |||
neighbor peer 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. peer may be the neighbor's address or description. | |||
network add prefix [arguments] | |||
Add the specified prefix to the list of announced networks. It is possible to set various path attributes with additional arguments. | |||
network delete prefix | |||
Remove the specified prefix from the list of announced networks. | |||
network flush | |||
Remove all dynamically added prefixes from the list of announced networks. | |||
network show family | |||
Show all announced networks. family, if given, limits the output to the given address family. The supported families are inet and inet6. | |||
reload | |||
Reload the configuration file. | |||
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 this address is shown, or a flag: | |||
connected | |||
Show only connected routes. | |||
static | |||
Show only static routes. | |||
bgp | |||
Show only routes originating from bgpd(8) itself. | |||
nexthop | |||
Show only routes required to reach a BGP nexthop. | |||
inet | |||
Show only IPv4 routes. | |||
inet6 | |||
Show only IPv6 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. | |||
show neighbor peer modifier | |||
Show detailed information about the neighbor identified by peer, which may be the neighbor's address or description, 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, and withdraws. | |||
timers | |||
Show the BGP timers. | |||
show nexthop | |||
Show the list of BGP nexthops and the result of their validity check. | |||
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 | |||
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. | |||
as as | |||
Show all entries with as anywhere in the AS path. | |||
source-as as | |||
Show all entries with as as rightmost AS. | |||
transit-as as | |||
Show all entries with as anywhere but rightmost. | |||
peer-as as | |||
Show all entries with as as leftmost AS. | |||
empty-as | |||
Show all entries that are internal routes with no AS's in the AS path. | |||
community community | |||
Show all entries with community community. | |||
neighbor peer | |||
Show only entries from the specified peer. | |||
table rib | |||
Show only entries from the specified RIB table. | |||
summary | |||
This is the same as the show summary command. | |||
memory | |||
Show RIB memory statistics. | |||
Additionally, the following options are defined: | |||
detail | |||
Show more detailed output for matched routes. | |||
family | |||
Limit the output to the given address family. | |||
in | |||
Show routes from the unfiltered Adj-RIB-In. This is only possible if softreconfig in is enabled for the neighbor. | |||
out | |||
Show the filtered routes sent to a neighbor also known as Adj-RIB-Out. | |||
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. | |||
show summary | |||
Show a list of all neighbors, including information about the session state and message counters. | |||
show summary terse | |||
Show a list of all neighbors, including information about the session state, in a terse format. | |||
show tables | |||
Show a list of all currently loaded fib routing tables. | |||
FILES | |||
/etc/bgpd.conf | |||
default bgpd(8) configuration file | |||
/var/run/bgpd.sock | |||
default bgpd(8) control socket | |||
SEE ALSO | |||
bgpd.conf(5), bgpd(8), bgplg(8), bgplgsh(8) | |||
Routing Policy Specification Language (RPSL), RFC 2622, June 1999. | |||
HISTORY | |||
The bgpctl program first appeared in OpenBSD 3.5. irrfilter mode was added in OpenBSD 4.1. | |||
May 3, 2010 Debian</nowiki> |
Latest revision as of 10:53, 8 June 2024
Connecting to bgpctl
To connect to bgpctl, simply type the following command in the terminal:
bgpctl
You will be prompted to enter your username and password.
Configuring a BGP session
Once connected to bgpctl, you can configure a BGP session by using the appropriate command. For example, to configure a BGP session with a peer:
bgpctl configure neighbor 192.0.2.1 as 65000
You can then use the `description` command to add a description for this session, and the `announce` command to set the prefixes that should be announced to the peer.
Enabling/Disabling a BGP session
You can use the `disable` command to disable a BGP session and the `enable` command to enable it again.
For example, to disable a BGP session with peer 192.0.2.1:
bgpctl configure neighbor 192.0.2.1 disable
To enable the session again:
bgpctl configure neighbor 192.0.2.1 enable
Viewing BGP information
You can use the `show neighbor` command to view the BGP sessions. For example:
bgpctl show neighbor
You can also use the `show summary` command to view a summary of all BGP sessions, or the `show rib` command to view the Routing Information Base (RIB)
Manpage
BGPCTL(8) System Manager's Manual BGPCTL(8) NAME bgpctl — control the Border Gateway Protocol daemon SYNOPSIS bgpctl [-n] [-s socket] command [argument ...] DESCRIPTION The bgpctl program controls the bgpd(8) daemon. Commands may be abbreviated to the minimum unambiguous prefix; for example, s s for show summary. The options are as follows: -n Show neighbors' IP addresses instead of their description. -s socket Use socket instead of the default /var/run/bgpd.sock to communicate with bgpd(8). The commands are as follows: fib [table number] couple Insert the learned routes into the specified Forwarding Information Base a.k.a. the kernel routing table. fib [table number] decouple Remove the learned routes from the specified Forwarding Information Base a.k.a. the kernel routing table. irrfilter [options] as [arguments] Get the aut-num object from the 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. The options are as follows: -o directory Use directory to write the filter files to. -4 Fetch only IPv4 prefixes from the registry. -6 Fetch only IPv6 prefixes from the registry. log brief Disable verbose debug logging. log verbose Enable verbose debug logging. neighbor peer up Take the BGP session to the specified neighbor up. peer may be the neighbor's address or description. neighbor peer down Take the BGP session to the specified neighbor down. peer may be the neighbor's address or description. neighbor peer clear Stop and restart the BGP session to the specified neighbor. peer may be the neighbor's address or description. neighbor peer 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. peer may be the neighbor's address or description. network add prefix [arguments] Add the specified prefix to the list of announced networks. It is possible to set various path attributes with additional arguments. network delete prefix Remove the specified prefix from the list of announced networks. network flush Remove all dynamically added prefixes from the list of announced networks. network show family Show all announced networks. family, if given, limits the output to the given address family. The supported families are inet and inet6. reload Reload the configuration file. 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 this address is shown, or a flag: connected Show only connected routes. static Show only static routes. bgp Show only routes originating from bgpd(8) itself. nexthop Show only routes required to reach a BGP nexthop. inet Show only IPv4 routes. inet6 Show only IPv6 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. show neighbor peer modifier Show detailed information about the neighbor identified by peer, which may be the neighbor's address or description, 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, and withdraws. timers Show the BGP timers. show nexthop Show the list of BGP nexthops and the result of their validity check. 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 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. as as Show all entries with as anywhere in the AS path. source-as as Show all entries with as as rightmost AS. transit-as as Show all entries with as anywhere but rightmost. peer-as as Show all entries with as as leftmost AS. empty-as Show all entries that are internal routes with no AS's in the AS path. community community Show all entries with community community. neighbor peer Show only entries from the specified peer. table rib Show only entries from the specified RIB table. summary This is the same as the show summary command. memory Show RIB memory statistics. Additionally, the following options are defined: detail Show more detailed output for matched routes. family Limit the output to the given address family. in Show routes from the unfiltered Adj-RIB-In. This is only possible if softreconfig in is enabled for the neighbor. out Show the filtered routes sent to a neighbor also known as Adj-RIB-Out. 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. show summary Show a list of all neighbors, including information about the session state and message counters. show summary terse Show a list of all neighbors, including information about the session state, in a terse format. show tables Show a list of all currently loaded fib routing tables. FILES /etc/bgpd.conf default bgpd(8) configuration file /var/run/bgpd.sock default bgpd(8) control socket SEE ALSO bgpd.conf(5), bgpd(8), bgplg(8), bgplgsh(8) Routing Policy Specification Language (RPSL), RFC 2622, June 1999. HISTORY The bgpctl program first appeared in OpenBSD 3.5. irrfilter mode was added in OpenBSD 4.1. May 3, 2010 Debian