BGPv4 Component

Configuration Overview

The BGPv4 configuration is held under the top level bgp object in /etc/flockd/flockd.json. If the bgp object exists BGPv4 will be enabled and the BGPv4 master thread will be spawned.

In the minimal configuration file below;

  • The router is in AS 65016 with a BGP router id of 172.16.10.1

  • The router originates the 172.16.0.0/16 network

  • The router has a single iBGP neighbor 172.16.10.2

    • The iBGP connection source is 172.16.10.1
    • Routes are advertised over iBGP with a next hop of 172.16.10.1 (next_hop_self)
  • The router has a single eBGP neighbor 172.17.20.1 in remote AS 65017

      "bgp": {
          "local": {
              "id": "172.16.10.1",
              "asn": 65016,
              "network": [
              {
                  "ip_prefix": "172.16.0.0/16"
              }
              ]
          },
          "as": [
              {
              "asn": 65016,
              "next_hop_self": true,
              "neighbor": [
                  {
                  "ip": "172.16.10.2",
                  "local_ip": "172.16.10.1"
                  }
              ]
              },
              {
              "asn": 65017,
              "neighbor": [
                  {
                  "ip": "172.17.20.1"
                  }
              ]
              }
          ]
      }
    

Operational State Overview

Check BGPv4 is enabled

Check BGPv4 is listed in the enabled_protocols field.

flock@flocknet$ flockc system
"hostname": "flocknet"
"software": "Flock Networks Routing Suite"
"version": "20.4.0"
"model": "Multi-threaded"
"pid": 2423
"compile_mode": "Release"
"log_level": "info"
"uptime": Uptime { days: 0, hours: 0, mins: 0, secs: 19 }
"enabled_protocols": ["BGPv4"]
"fpm_state": "disabled"
flock@flocknet:~$

Show BGPv4 Overview

flock@r01:~$ flockc bgp
{"id":"60.0.100.61","asn":60,"routes":{"ipv4_unicast":4271}}

Show all neighbors (in all Autonomous Systems)

BGPv4 runs two Finite State Machines (FSM's) per neighbor. One FSM handles the Outgoing TCP connection and the other handles the Incoming TCP connection. The Flock Routing Suite does not hide this from the operator. In the final working state each neighbor should have one FSM in the Established state, and one FSM in the Idle state.

The last error to cause a BGP Notify Message is held in each FSM's last_notify field. This field is never cleared, it is only overwritten with the last error. So a value of null means there have been no errors that have caused a notify message since flockd was started.

flock@r61:~$ flockc bgp -n
{"asn":50}
{"ipv4_addr":"50.0.20.50","local_ipv4_addr":"60.0.20.61","asn":50,"bgp_id":"50.0.100.50","neigh_type":"External","outgoing":{"state":"Established","last_notify":null},"incoming":{"state":"Idle","last_notify":null}}
{"asn":60}
{"ipv4_addr":"60.0.60.60","asn":60,"bgp_id":"60.0.100.60","neigh_type":"Internal","outgoing":{"state":"Established","last_notify":null},"incoming":{"state":"Idle","last_notify":null}}

Show BGPv4 RIB prefix's

Note that this is not the System RIB. The BGPv4 RIB records routes from all neighbors and sends the 'best entry' route to the System RIB.

Show all prefix's. Only the 'best entry' for each prefix is shown, along with the reason why it was the best.

flock@r01:~$ flockc bgp -p
{"ip_net":"50.0.0.0/8","best_entry":{"neigh":{"neigh_ipv4_addr":"50.0.20.50","attrs":{"origin":"Igp","as_path":{"segments":[{"segment_type":"AsSequence","segment_value":[50]}]},"next_hop":"50.0.20.50","med":null,"local_pref":null,"atomic_aggregate":false,"aggregator":null}},"reason":"OnlyValidPeer"}}
{"ip_net":"60.0.0.0/8","best_entry":{"reason":"SelfOriginated"}}

Show a specific prefix. The 'best entry' and all the candidate entries are shown.

flock@r61:~$ flockc bgp -p 50.0.0.0/8
{"best_entry":{"neigh":{"neigh_ipv4_addr":"50.0.20.50","attrs":{"origin":"Igp","as_path":{"segments":[{"segment_type":"AsSequence","segment_value":[50]}]},"next_hop":"50.0.20.50","med":null,"local_pref":null,"atomic_aggregate":false,"aggregator":null}},"reason":"OnlyValidPeer"},"neighboring_as":[{"med_origin_asn":50,"via_neighs":[{"neigh_ipv4_addr":"50.0.20.50","neigh_bgp_id":"50.0.100.50","neigh_type":"External","attrs":{"origin":"Igp","as_path":{"segments":[{"segment_type":"AsSequence","segment_value":[50]}]},"next_hop":"50.0.20.50","med":null,"local_pref":null,"atomic_aggregate":false,"aggregator":null}}]}]}