Today we explore setting up a BGP virtual lab (iBGP and eBGP) using Ubuntu and FRR.
Links
This post was inspired by Lab 10 BGP Route Reflection
Versions
Software | Version |
---|---|
Ubuntu | 20.04 (focal) |
FRR | 7.5.1 |
Diagram
Setup
This lab requires internet access to download FRR packages. As such, each device’s ens2
is connected to a local host interface (NAT). Setup is out of scope for this lab and depends on your local virtualization environment.
Certificates
If certificates are required to access the internet (common in corporate environments), install them.
sudo apt-get install ca-certificates -y
cd /usr/local/share/ca-certificates/
sudo wget http://<URL>.crt
sudo update-ca-certificates
Install FRR with Snap
- Install frr snap
1
sudo snap install frr
- Connect Snap
1
snap connect frr:network-control core:network-control
- Create CLI alias
1
sudo snap alias frr.vtysh vtysh
Install FRR with APT
- Download APT keys
1
curl -s https://deb.frrouting.org/frr/keys.asc | sudo apt-key add -
- Set enviroment variable FRRVER
1
FRRVER="frr-7"
- Create new APT
sources.list
file1
echo deb https://deb.frrouting.org/frr $(lsb_release -s -c) $FRRVER | sudo tee -a /etc/apt/sources.list.d/frr.list
- Update and install frr
1
sudo apt update && sudo apt install frr frr-pythontools
- Enable bgp daemon
1
sed -i 's/bgpd=no/bgpd=yes/g' /etc/frr/daemons
- Restart FRR
1
service frr restart
IPv4 forwarding
Enable IP forwarding so Ubuntu can route traffic through interfaces.
1 | sed -i 's/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/g' /etc/sysctl.conf |
Configuration
IP Addresses
Use Netplan to configure interface IP addresses.
Modify file (name may vary) /etc/netplan/50-cloud-init.yaml
- rtr1
1
2
3
4
5
6
7
8
9
10
11
12
13network:
ethernets:
ens2:
dhcp4: true
ens3:
addresses:
- 192.168.12.1/30
lo:
match:
name: lo
addresses:
- 192.168.1.1/24
version: 2 - rtr2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16network:
ethernets:
ens2:
dhcp4: true
ens3:
addresses:
- 192.168.12.2/30
ens4:
addresses:
- 192.168.23.1/30
lo:
match:
name: lo
addresses:
- 192.168.2.1/24
version: 2 - rtr3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16network:
ethernets:
ens2:
dhcp4: true
ens3:
addresses:
- 192.168.23.2/30
ens4:
addresses:
- 192.168.34.1/30
lo:
match:
name: lo
addresses:
- 192.168.3.1/24
version: 2 - rtr4
1
2
3
4
5
6
7
8
9
10
11
12
13network:
ethernets:
ens2:
dhcp4: true
ens3:
addresses:
- 192.168.34.2/30
lo:
match:
name: lo
addresses:
- 192.168.4.1/24
version: 2
Apply netplan configuration.
1 | netplan apply |
Verify IP addresses.
1 | root@r2:/# ip a |
FRR
Enter FRR’s CLI configuration mode.
1 | vtysh |
- rtr2
1
2
3
4
5
6
7router bgp 200
neighbor 192.168.23.2 remote-as 200
!
address-family ipv4 unicast
network 192.168.2.0/24
network 192.168.23.0/30
exit-address-family - rtr3
1
2
3
4
5
6
7
8
9
10
11router bgp 200
neighbor 192.168.23.1 remote-as 200
neighbor 192.168.34.2 remote-as 200
!
address-family ipv4 unicast
network 192.168.3.0/24
network 192.168.23.0/30
network 192.168.34.0/30
neighbor 192.168.23.1 route-reflector-client
neighbor 192.168.34.2 route-reflector-client
exit-address-family - rtr4
1
2
3
4
5
6
7router bgp 200
neighbor 192.168.34.1 remote-as 200
!
address-family ipv4 unicast
network 192.168.4.0/24
network 192.168.34.0/30
exit-address-family
Save configuration on all devices
1 | end |
Verify
Check that BGP neighbors are online in vtysh.
1 | r2# show ip bgp summary |
Check learned routes in vtysh.
1 | r2# show ip bgp |
Check installed routes in vtysh.
1 | r2# show ip route |
Exit vtysh with exit
and check installed operating system routes.
1 | root@r2:/# ip r |
TODO
Finish lab from page 22.