Border Gateway Protocol – BGP

Configuring BGP in SONiC

For the BGP basics, please refer to https://en.wikipedia.org/wiki/Border_Gateway_Protocol

To configure BGP on a switch, at minimum, you need to:

  • Assign an ASN to identify this BGP node.
  • Assign a unique router ID, which is a 32-bit value and is typically the address of the loopback interface on the switch.
  • Specify where to distribute routing information by providing the IP address and ASN of the neighbor.
    • This is the IP address of the interface between the two peers; the interface must be a layer 3 access port.
    • The ASN can be a number, or internal for a neighbor in the same AS or external for a neighbor in a different AS.
  • Specify which prefixes to originate from this BGP node.

Example model & SONiC version:

  • Aurora 615/715
  • Netberg SONiC: sonic-202012-nb-inno-211121

iBGP configuration

ibgp_session

Figure 1. Network topology
  1. Configure IP addresses following the topology.
  2. Configure BGP in FRRouting

    Aurora 615

    admin@nba615:~$ vtysh
    
    Hello, this is FRRouting (version 7.5.1-sonic).
    Copyright 1996-2005 Kunihiro Ishiguro, et al.
    
    nba615# configure
    nba615(config)# router-id 1.1.1.1
    nba615(config)# router bgp 65101
    nba615(config-router)# neighbor 10.0.1.0 remote-as 65101
    nba615(config-router)# neighbor 10.0.1.0 description NBA715
    nba615(config-router)# exit
    nba615(config)# exit
    nba615#

    Aurora 715

    admin@nba715:~$ vtysh
    
    Hello, this is FRRouting (version 7.5.1-sonic).
    Copyright 1996-2005 Kunihiro Ishiguro, et al.
    
    nba715# configure
    nba715(config)# router-id 2.2.2.2
    nba715(config)# router bgp 65101
    nba715(config-router)# neighbor 10.0.1.1 remote-as 65101
    nba715(config-router)# neighbor 10.0.1.1 description NBA615
    nba715(config-router)# exit
    nba715(config)# exit
  3. Check the BGP status
    nba615# show bgp summary
    
    IPv4 Unicast Summary:
    BGP router identifier 1.1.1.1, local AS number 65101 vrf-id 0
    BGP table version 0
    RIB entries 0, using 0 bytes of memory
    Peers 1, using 21 KiB of memory
    
    Neighbor        V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt
    10.0.1.0        4      65101         4         4        0    0    0 00:01:20            0        0
    
    Total number of neighbors 1
    
    nba615# show bgp neighbors
    BGP neighbor is 10.0.1.0, remote AS 65101, local AS 65101, internal link
      Description: NBA715
    Hostname: nba715
      BGP version 4, remote router ID 2.2.2.2, local router ID 1.1.1.1
      BGP state = Established, up for 00:01:50
      Last read 00:00:50, Last write 00:00:50
      Hold time is 180, keepalive interval is 60 seconds
      Neighbor capabilities:
        4 Byte AS: advertised and received
        AddPath:
          IPv4 Unicast: RX advertised IPv4 Unicast and received
        Route refresh: advertised and received(old & new)
        Address Family IPv4 Unicast: advertised and received
        Hostname Capability: advertised (name: nba615,domain name: n/a) received (name: nba715,domain name: n/a)
        Graceful Restart Capability: advertised and received
          Remote Restart timer is 120 seconds
          Address families by peer:
            none
      Graceful restart information:
        End-of-RIB send: IPv4 Unicast
        End-of-RIB received: IPv4 Unicast
        Local GR Mode: Helper*
        Remote GR Mode: Helper
        R bit: True
        Timers:
          Configured Restart Time(sec): 120
          Received Restart Time(sec): 120
        IPv4 Unicast:
          F bit: False
          End-of-RIB sent: Yes
          End-of-RIB sent after update: Yes
          End-of-RIB received: Yes
          Timers:
            Configured Stale Path Time(sec): 360
      Message statistics:
       Inq depth is 0
       Outq depth is 0
                            Sent       Rcvd
       Opens:                  1          1
       Notifications:          0          0
       Updates:                1          1
       Keepalives:             2          2
       Route Refresh:          0          0
       Capability:             0          0
       Total:                  4          4
     Minimum time between advertisement runs is 0 seconds
    
    For address family: IPv4 Unicast
     Update group 1, subgroup 1
     Packet Queue length 0
     Community attribute sent to this neighbor(all)
     0 accepted prefixes
     Connections established 1; dropped 0
     Last reset 00:04:39,  No AFI/SAFI activated for peer
    Local host: 10.0.11.1, Local port: 179
    Foreign host: 10.0.1.0, Foreign port: 52656
    Nexthop: 10.0.1.1
    Nexthop global: fe80::72b3:d5ff:fecc:fb00
    Nexthop local: fe80::72b3:d5ff:fecc:fb00
    BGP connection: shared network
    BGP Connect Retry Timer in Seconds: 120
    Estimated round trip time: 5 ms
    Read thread: on  Write thread: on  FD used: 27
    nba715# show bgp summary
    
    IPv4 Unicast Summary:
    BGP router identifier 2.2.2.2, local AS number 65101 vrf-id 0
    BGP table version 0
    RIB entries 0, using 0 bytes of memory
    Peers 1, using 21 KiB of memory
    
    Neighbor        V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt
    10.0.1.1        4      65101         4         4        0    0    0 00:01:29            0        0
    
    Total number of neighbors 1
    
    nba715# show bgp neighbors
    BGP neighbor is 10.0.1.1, remote AS 65101, local AS 65101, internal link
     Description: NBA615
    Hostname: nba615
      BGP version 4, remote router ID 1.1.1.1, local router ID 2.2.2.2
      BGP state = Established, up for 00:02:19
      Last read 00:00:19, Last write 00:00:19
      Hold time is 180, keepalive interval is 60 seconds
      Neighbor capabilities:
       4 Byte AS: advertised and received
       AddPath:
         IPv4 Unicast: RX advertised IPv4 Unicast and received
       Route refresh: advertised and received(old & new)
       Address Family IPv4 Unicast: advertised and received
       Hostname Capability: advertised (name: nba715,domain name: n/a) received (name: nba615,domain name: n/a)
       Graceful Restart Capability: advertised and received
         Remote Restart timer is 120 seconds
         Address families by peer:
           none
     Graceful restart information:
       End-of-RIB send: IPv4 Unicast
       End-of-RIB received: IPv4 Unicast
       Local GR Mode: Helper*
       Remote GR Mode: Helper
       R bit: False
       Timers:
         Configured Restart Time(sec): 120
         Received Restart Time(sec): 120
       IPv4 Unicast:
         F bit: False
         End-of-RIB sent: Yes
         End-of-RIB sent after update: Yes
         End-of-RIB received: Yes
         Timers:
           Configured Stale Path Time(sec): 360
     Message statistics:
       Inq depth is 0
       Outq depth is 0
                            Sent       Rcvd
       Opens:                  1          1
       Notifications:          0          0
       Updates:                1          1
       Keepalives:             3          3
       Route Refresh:          0          0
       Capability:             0          0
       Total:                  5          5
     Minimum time between advertisement runs is 0 seconds
    
    For address family: IPv4 Unicast
     Update group 1, subgroup 1
     Packet Queue length 0
     Community attribute sent to this neighbor(all)
     0 accepted prefixes
    
     Connections established 1; dropped 0
     Last reset 00:02:20,  Waiting for peer OPEN
    Local host: 10.0.1.0, Local port: 52656
    Foreign host: 10.0.1.1, Foreign port: 179
    Nexthop: 10.0.1.0
    Nexthop global: fe80::72b3:d5ff:fecc:f7f3
    Nexthop local: fe80::72b3:d5ff:fecc:f7f3
    BGP connection: shared network
    BGP Connect Retry Timer in Seconds: 120
    Estimated round trip time: 3 ms
    Read thread: on  Write thread: on  FD used: 26

Save the settings:

nba615# write
Note: this version of vtysh never writes vtysh.conf

Warning: attempting direct configuration write without watchfrr.
File permissions and ownership may be incorrect, or write may fail.

Building Configuration...
Integrated configuration saved to /etc/frr/frr.conf
[OK]

eBGP configuration

ebgp_session

Figure 2. Network topology
  1. Configure IP addresses following the topology.
  2. Configure BGP in FRRouting

    Aurora 615

    admin@nba615:~$ vtysh
    
    Hello, this is FRRouting (version 7.5.1-sonic).
    Copyright 1996-2005 Kunihiro Ishiguro, et al.
    
    nba615# configure
    nba615(config)# router bgp 65100
    nba615(config-router)# neighbor 10.0.1.0 remote-as 65101
    nba615(config-router)# neighbor 10.0.1.0 description NBA715
    nba615(config-router)# exit
    nba615(config)# exit

    Aurora 715

    admin@nba715:~$ vtysh
    
    Hello, this is FRRouting (version 7.5.1-sonic).
    Copyright 1996-2005 Kunihiro Ishiguro, et al.
    
    nba715# configure
    nba715(config)# router-id 2.2.2.2
    nba715(config)# router bgp 65101
    nba715(config-router)# neighbor 10.0.1.1 remote-as 65100
    nba715(config-router)# neighbor 10.0.1.1 description NBA615
    nba715(config-router)# exit
    nba715(config)# exit
  3. Check the BGP status
    nba615# show bgp summary
    
    IPv4 Unicast Summary:
    BGP router identifier 1.1.1.1, local AS number 65100 vrf-id 0
    BGP table version 0
    RIB entries 0, using 0 bytes of memory
    Peers 1, using 21 KiB of memory
    
    Neighbor        V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt
    10.0.1.0        4      65101        18        13        0    0    0 00:00:03       Active        0
    
    Total number of neighbors 1
    nba715# show bgp summary
    
    IPv4 Unicast Summary:
    BGP router identifier 2.2.2.2, local AS number 65101 vrf-id 0
    BGP table version 0
    RIB entries 0, using 0 bytes of memory
    Peers 1, using 21 KiB of memory
    
    Neighbor        V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt
    10.0.1.1        4      65100        22        20        0    0    0 00:01:14       Active        0
    
    Total number of neighbors 1

Save the settings:

nba615# write
Note: this version of vtysh never writes vtysh.conf

Warning: attempting direct configuration write without watchfrr.
File permissions and ownership may be incorrect, or write may fail.

Building Configuration...
Integrated configuration saved to /etc/frr/frr.conf
[OK]

Peer groups and route reflectors

A BGP peer group reduces the load on system resources by allowing the routing table to be checked only once and updates to be replicated to
all peer group members instead of being done individually for each peer in the peer group.

In a data center network using iBGP, routes learned from an iBGP peer cannot be sent to another iBGP peer. The concept of a route reflector introduces a
workaround that allows an iBGP speaker to send iBGP learned routes to other iBGP peers.

In this example, Aurora 715 acts as a route reflector. Two Aurora 615 are route reflector clients. Any route that Aurora 715 learns from a route reflector
client is sent to other route reflector clients.

bgp_peer

Figure 3. Network topology

Set the’ neighbor route-reflector-client’ option to configure the BGP node as a route reflector for a BGP peer. Only the Aurora 715 switch has to be configured.
No configuration is required on the client.

nba715(config-router)# neighbor Lab-Leaf peer-group
nba715(config-router)# neighbor Lab-Leaf remote-as internal
nba715(config-router)# neighbor 10.0.1.1 peer-group Lab-Leaf
nba715(config-router)# address-family ipv4
nba715(config-router-af)# neighbor 10.0.1.1 route-reflector-client
nba715(config-router-af)# end
nba715# write
NEWS

Latest news