Strony

Saturday, 30 May 2020

FRR - installation and configuration

This post is about FRRouting (FRR).
FRR is IP routing protocol suite for Linux and Unix platforms.

Topics which will be covered:
- FRR installation on Ubuntu server
- establishing BGP session between two FRR routers and advertising network via it

Installation:

Install packages used in process of adding FRR repository: 
sudo apt install gnupg2 curl

Add FRR repository key:
curl -s https://deb.frrouting.org/frr/keys.asc | sudo apt-key add -

Add FRR repository:
FRRVER="frr-stable"
echo deb https://deb.frrouting.org/frr $(lsb_release -s -c) $FRRVER | sudo tee -a /etc/apt/sources.list.d/frr.list


Install FRR:
sudo apt update
sudo apt install frr frr-pythontools


Enable bgpd in file /etc/frr/daemons (original file is kept as /etc/frr/daemons.org):
sudo sed -i.org 's/bgpd=no/bgpd=yes/' /etc/frr/daemons

Enable FRR to start at boot and restart it:
systemctl enable frr
systemctl restart frr

Configuration:

Two ubuntu servers with installed FRR are present in test scenraio:
- frr01 (192.168.122.101)
- frr02 (192.168.122.102)

BGP session will be established between frr01 and frr02.
Router frr01 will advertise via BGP network 1.2.3.0/24.

FRR configuration file is located in file /etc/frr/frr.conf .

Sample configuration for router frr01:
frr defaults traditional
hostname frr01
log syslog informational
no ip forwarding
no ipv6 forwarding
service integrated-vtysh-config
!
router bgp 65001
 neighbor 192.168.122.102 remote-as 65002
 !
 address-family ipv4 unicast
  network 1.2.3.0/24
 exit-address-family
!
line vty
!

Sample configuration for router frr02:
frr defaults traditional
hostname frr02
log syslog informational
no ip forwarding
no ipv6 forwarding
service integrated-vtysh-config
!
router bgp 65002
 neighbor 192.168.122.101 remote-as 65001
!
line vty
!

Relaod FRR after modifying configuration file:
sudo systemctl reload frr

Verification:

With vtysh tool we can interact with frr.

Information from frr02 about BGP session with frr01:
test@frr02:~$ sudo vtysh

Hello, this is FRRouting (version 7.3).
Copyright 1996-2005 Kunihiro Ishiguro, et al.

frr02# show ip bgp summary

IPv4 Unicast Summary:
BGP router identifier 192.168.122.102, local AS number 65002 vrf-id 0
BGP table version 1
RIB entries 1, using 184 bytes of memory
Peers 1, using 20 KiB of memory

Neighbor        V         AS MsgRcvd MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd
192.168.122.101 4      65001       5       5        0    0    0 00:01:39            1

Total number of neighbors 1

Route 1.2.3.0/24 is received via BGP:
frr02# show ip bgp
BGP table version is 1, local router ID is 192.168.122.102, vrf id 0
Default local pref 100, local AS 65002
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 1.2.3.0/24       192.168.122.101          0             0 65001 i

Displayed  1 routes and 1 total paths
frr02# show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued route, r - rejected route

K>* 0.0.0.0/0 [0/0] via 192.168.122.1, enp1s0, 00:03:33
B>* 1.2.3.0/24 [20/0] via 192.168.122.101, enp1s0, 00:03:30
C>* 192.168.122.0/24 is directly connected, enp1s0, 00:03:33
frr02# exit

Route received via BGP is present in routing table of Ubuntu server:
test@frr02:~$ ip route
default via 192.168.122.1 dev enp1s0 proto static
1.2.3.0/24 via 192.168.122.101 dev enp1s0 proto bgp metric 20
192.168.122.0/24 dev enp1s0 proto kernel scope link src 192.168.122.102

Links:

https://frrouting.org/
https://deb.frrouting.org/

No comments:

Post a Comment