BGP

Published on:

Most important commands to remember

  • vtysh -c … — inspect FRRouting BGP state.
  • ip -4 route show — inspect installed IPv4 forwarding routes.

Commands and flags

Command or argument Meaning
sudo vtysh -c 'show bgp ipv4 unicast summary' Query peer state and prefix counters through FRRouting’s CLI.
sudo vtysh -c 'show bgp ipv4 unicast' Show BGP’s IPv4 unicast paths.
ip -4 route show Show the kernel’s main IPv4 routing table.

-c executes one quoted CLI command; the quotes keep its words together. No advertisement or session is changed.

The concepts that matter

1. BGP exchanges reachability between peers

BGP, the Border Gateway Protocol, exchanges routes between configured peers. An autonomous system (AS) is a routing domain identified by an ASN. External BGP connects different ASes; internal BGP distributes BGP information within one AS.

A BGP session uses TCP, normally port 179. Establishing that session enables route exchange; it does not by itself announce every interface address or make all remote networks reachable.

2. Advertisements contain prefixes and attributes

An advertisement says that a prefix is reachable with particular path attributes. These can include the next hop and AS path, a sequence describing the ASes traversed by the advertisement. Withdrawal removes previously advertised reachability.

The AS path helps detect loops and influences selection, but it is not a packet-by-packet traceroute. A prefix identifies a network range, not an individual application or its health.

3. Policy shapes which path wins

BGP is policy-driven. Import rules decide what to accept; export rules decide what to advertise. Attributes such as local preference and AS path affect best-path selection. Implementations apply a sequence of decisions rather than simply choosing the geographically shortest route.

A valid session with no accepted prefixes can be intentional policy. Conversely, announcing the wrong prefix can affect other networks. This lesson reads state and does not experiment with live advertisements.

4. Learning a path and forwarding through it are separate

A path can appear in BGP without becoming the selected route or the kernel’s installed forwarding entry. Next-hop reachability, competing route sources, and route installation all matter.

After a change, peers need time to exchange updates and recalculate. This convergence can temporarily alter reachability. A stable BGP session and a selected prefix still do not prove that firewalls, the return path, or an application work.

One small example

Optional: use an existing FRRouting lab router. The commands require its local routing daemons and control permissions.

sudo vtysh -c 'show bgp ipv4 unicast summary'
sudo vtysh -c 'show bgp ipv4 unicast'
ip -4 route show

In the summary, compare neighbor address, remote AS, uptime, and the state/prefix-count field. A number commonly means an established session with that many accepted prefixes; a state name indicates session progress or failure. Zero prefixes is different from a disconnected peer.

In the path table, use the printed legend to identify valid and best paths, then read next hop and AS path. Compare the selected prefix with ip route, remembering that the kernel table is a different view and policy tables may also exist.

No peers, no routes, or a local daemon error are possible. Do not invent a working session from empty output. No routing configuration is changed and no cleanup is needed.

Keep this idea: BGP exchanges candidate reachability; policy selects paths, and forwarding still depends on installation and a usable next hop.