Installing FRRouting (FRR) on your CentOS KVM/Libvirt host and setting up BGP
So I had this idea when looking at FRRouting. As it's a Linux package, you can install it on a box running KVM/Libvirt, then you can enable BGP and redistribute the connected networks. This makes spinning up new virtual networks on the hypervisor very easy as you do not need to rely on static routes and as soon as you spin up a new virtual network it's advertising to the rest of your network.
What is FRRouting (FRR)
FRRouting (FRR) is a fork of Quagga. It's used in Cumulus networks OS as the routing suite.
This guide is based on an install of CentOS 7.5.
Step 1 Install FRR
Install the latest FRR rpm from https://github.com/FRRouting/frr/releases.
yum install -y https://github.com/FRRouting/frr/releases/download/frr-5.0.1/frr-5.0.1-2018070501.el7.centos.x86_64.rpm
Edit the daemons file and change the routing protocols you want from no to yes (you must always enable zebra) in this case zebra and bgpd.
Start FRR and set to start on boot.
systemctl enable frr && systemctl start frr
Check status of FRR - should show as active (running).
systemctl status frr
Step 2 configure FRR and BGP
open the FRR shell by typing the command.
Enter configuration mode.
This step is optional this command puts all the FRR configuration into one file.
Configure BGP on the KVM host.
I am configuring a route-map used to prevent some routes from being redistributed also will tag a BGP community for all the permitted routes you do not need to do this but it gives you more control and tagging the route helps with visibility.
ip prefix-list PL_BGP_DENY_CONNECTED seq 5 permit 10.25.10.0/24
route-map RM_BGP_REDISTRIBUTED_CONNECTED deny 10
match ip address prefix-list PL_BGP_DENY_CONNECTED
route-map RM_BGP_REDISTRIBUTED_CONNECTED permit 9999
set community 65010:10100
Here we are configuring the BGP process AS/router id/tuning the timers from the default to 2/6 and configuring the neighbour.
router bgp 65010
bgp router-id 10.25.10.100
timers bgp 2 6
neighbor 10.25.10.1 remote-as 65000
Now to configure the redistribute connected command and set the route map we have created.
address-family ipv4 unicast
redistribute connected route-map RM_BGP_REDISTRIBUTED_CONNECTED
Exit and save the configuration.
Step 3 Verify BGP is up and that we have routes
Here we can see that the BGP session is up.
Below we can see that have two connected virtual networks in BGP and are receiving a default route from the router we are connected to.