BGPv4 Component

Configuration Overview

/etc/flockd/bgpv4.toml is the configuration file. If this file exists BGPv4 is enabled, otherwise BGPv4 remains disabled. The default flockd debian package install will not create this file, so BGPv4 will not be enabled as part of the install. During the package install, an example configuration file is copied to /etc/flockd/bgpv4.toml.example.

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

      [local]
      id = "172.16.10.1" # BGP ID of this router
      as_id = 65016 # Autonomous System this router is part of
      # Originate networks into BGP
      [[local.network]]
      ip_prefix = "172.16.0.0/16"
    
      # iBGP neighbors (as_id == local.as_id)
      [[as]]
      as_id = 65016
      # Allow iBGP neighbors to not have eBGP subnets in their IPv4 RIB
      next_hop_self = true
      [[as.neighbor]]
      ip = "172.16.10.2"
      local_ip = "172.16.10.1"
    
      # AS65017 eBGP neighbors (as_id != local.as_id)
      [[as]]
      as_id = 65017
      [[as.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.2.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"]
flock@flocknet:~$

Show BGPv4 Overview

flock@r01:~$ flockc bgp
{"id":"60.0.100.61","as_id":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
{"as_id":50}
{"ipv4_addr":"50.0.20.50","local_ipv4_addr":"60.0.20.61","as_id":50,"bgp_id":"50.0.100.50","neigh_type":"External","outgoing":{"state":"Established","last_notify":null},"incoming":{"state":"Idle","last_notify":null}}
{"as_id":60}
{"ipv4_addr":"60.0.60.60","as_id":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_as_id":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}}]}]}