Skip to content

BGP basics

Master BGP Basics with FRRouting (FRR): A Hands-On Guide

Border Gateway Protocol (BGP) is the routing protocol that powers the global internet. While traditionally configured on proprietary network hardware like Cisco, Juniper, or Arista routers, modern open-source software allows you to run BGP directly on Linux platforms.

FRRouting (FRR) is the premier open-source IP routing protocol suite for Linux and Unix platforms. A fork of the Quagga project, FRR is widely used in cloud infrastructure, data centers, and network function virtualization (NFV) environments.

In this guide, we’ll cover the core fundamentals of BGP and walk through setting up a basic BGP peering session using FRR.

What is BGP?

BGP is an Exterior Gateway Protocol (EGP) designed to exchange routing and reachability information among Autonomous Systems (AS) on the internet. An Autonomous System (AS) is a collection of networks under a single administrative control, identified by a unique Autonomous System Number (ASN) (e.g., AS65001).

Key Concepts:

  1. Path-Vector Protocol: Unlike OSPF or IS-IS (Link-State) or RIP (Distance-Vector), BGP makes routing decisions based on paths, network policies, and rule sets rather than technical metrics like bandwidth or hop count.
  2. eBGP vs. iBGP:
  3. eBGP (External BGP): Used to exchange routing information between different Autonomous Systems.
  4. iBGP (Internal BGP): Used to exchange routing information within the same Autonomous System.
  5. TCP Port 179: BGP establishes reliable neighbor relationships over standard TCP on port 179.
  6. Network Advertisement: BGP routers advertise reachability to IP prefixes along with attributes like AS-Path, Next-Hop, and Local Preference.

What is FRRouting (FRR)?

FRR is a high-performance, open-source routing daemon suite. It implements BGP, OSPF, IS-IS, RIP, LDP, PBR, and more.

Why FRR for BGP?

  • Cisco-like CLI (vtysh): Provides a familiar command-line interface identical to traditional network hardware.
  • Container-Friendly: Lightweight and perfect for Docker, Kubernetes (e.g., MetalLB, Cilium BGP Control Plane), and cloud environments.
  • High Performance: Multi-threaded architecture built for high-throughput enterprise and carrier networks.

Setting Up BGP with FRR: A Step-by-Step Scenario

Let's walk through establishing an eBGP session between two routers, Router-A and Router-B.

Scenario Topology:

 +---------------------+                       +---------------------+
 |      Router-A       |                       |      Router-B       |
 |  ASN: 65001         | <--- eBGP Session ---> |  ASN: 65002         |
 |  IP: 10.0.0.1/30    |       10.0.0.0/30     |  IP: 10.0.0.2/30    |
 |  Loopback: 1.1.1.1  |                       |  Loopback: 2.2.2.2  |
 +---------------------+                       +---------------------+

Step 1: Install and Enable FRR

On Ubuntu/Debian platforms:

sudo apt update
sudo apt install -y frr frr-pythontools

By default, the BGP daemon is disabled in FRR. Enable it by editing /etc/frr/daemons:

sudo nano /etc/frr/daemons

Change bgpd=no to bgpd=yes:

bgpd=yes
ospfd=no
ospf6d=no
ripd=no
...

Restart FRR to load the BGP daemon:

sudo systemctl restart frr

Step 2: Configure Router-A (ASN 65001)

Access the FRR unified VTY shell:

sudo vtysh

Enter configuration mode and set up BGP:

Router-A# configure terminal
Router-A(config)# router bgp 65001
Router-A(config-router)# bgp router-id 1.1.1.1
Router-A(config-router)# neighbor 10.0.0.2 remote-as 65002
Router-A(config-router)# neighbor 10.0.0.2 description Peer-to-Router-B
Router-A(config-router)# address-family ipv4 unicast
Router-A(config-router-af)# network 1.1.1.1/32
Router-A(config-router-af)# exit
Router-A(config-router)# exit
Router-A(config)# exit
Router-A# write memory

Step 3: Configure Router-B (ASN 65002)

On Router-B, enter vtysh and apply the matching peer configuration:

Router-B# configure terminal
Router-B(config)# router bgp 65002
Router-B(config-router)# bgp router-id 2.2.2.2
Router-B(config-router)# neighbor 10.0.0.1 remote-as 65001
Router-B(config-router)# neighbor 10.0.0.1 description Peer-to-Router-A
Router-B(config-router)# address-family ipv4 unicast
Router-B(config-router-af)# network 2.2.2.2/32
Router-B(config-router-af)# exit
Router-B(config-router)# exit
Router-B(config)# exit
Router-B# write memory

Step 4: Verification and Verification Commands

Once configured, verify the BGP state using FRR diagnostic commands inside vtysh:

1. Check BGP Summary

Verify if the peer session is established:

Router-A# show ip bgp summary

IPv4 Unicast Summary:
BGP router identifier 1.1.1.1, local AS number 65001 vrf-id 0
BGP table version 2
Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd
10.0.0.2        4 65002      12      12        2    0    0 00:05:32        1
Look for state Established or a numerical count under State/PfxRcd (which indicates received prefixes).

2. Check Received BGP Routes

Check routes learned from neighbor:

Router-A# show ip bgp

BGP table version is 2, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.1/32       0.0.0.0                  0         32768 i
*> 2.2.2.2/32       10.0.0.2                 0             0 65002 i

3. Inspect Specific Neighbor Details

Router-A# show ip bgp neighbors 10.0.0.2

Key Takeaways

  1. BGP is Policy-Driven: Unlike internal routing protocols, BGP excels at controlling traffic flow across different administrative networks.
  2. FRR Makes Linux a Router: With FRR, Linux instances act as fully featured software routers capable of handling full internet routing tables.
  3. vtysh Streamlines Operations: If you know Cisco IOS or Junos, navigating FRR’s command hierarchy will feel intuitive.

Next Steps to Explore

  • Route Filtering: Implement Prefix-Lists and Route-Maps to control advertised and received prefixes.
  • BGP Path Attributes: Experiment with Local-Preference, MED (Multi-Exit Discriminator), and AS-Path Prepending.
  • iBGP & Route Reflectors: Set up internal BGP peering within a single AS.