Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Zebra API
Zebra (RIB)
Kernel (FIB)
ZAPI -vs- NETLINK
● Needed interprocess communication before NETLINK existed
● Have data communication needs that NETLINK doesn’t care about
○ ZEBRA_REDISTRIBUTE_XXX
○ ZEBRA_ROUTER_ID_XXX
○ ZEBRA_BFD_DEST_XXX
○ ZEBRA_NEXTHOP_XXX
○ ZEBRA_CAPABILITIES
● lib/zclient.[ch]
● Stream of data with each message type being sent as a packet
● Named Sockets
○ Only talk to FRR so we can change format as needed
Sources of Information
● Website
○ https://frrouting.org/
● Wiki
○ https://github.com/FRRouting/frr/wiki
● Documentation
○ http://docs.frrouting.org
● Email Aliases
○ https://lists.frrouting.org/listinfo
● GitHub
○ https://github.com/FRRouting
Basic Routing
Basic Routing
● Why?
● RIB -vs- FIB
● Metric
● Administrative Distance
● VRF
● Basic Topology and Config being used
● BGP Overview
● OSPF Overview
● IS-IS Overview
Why Routing?
● Networks are Complex beasts
○ static routes are not going to cut it in a complex network
● Not getting simpler with what people want to do with them
○ VM’s, Containers, etc.
● Routing allows us to control this chaos
○ Linux now has the ability to interact with the entirety of the network via a standards based
approach
BGP OSPF ISIS RIP NHRP LDP
RIB -vs- FIB
● Routing Information Base
○ A.k.a ‘Control Plane’ Zebra (RIB)
○ This is in FRRouting
● Forwarding Information Base
○ A.k.a ‘Data plane’ Kernel (FIB)
○ This is in the Kernel
FRR Kernel
robot# show ip route sharpd@robot ~> ip route show
Codes: K - kernel route, C - connected, S - static, R - RIP, default via 10.0.2.2 dev enp0s3 proto static metric 100
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP, 4.3.2.1 dev enp0s8 scope link metric 14000
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP, 4.3.2.1 dev enp0s9 scope link metric 4278198272
F - PBR,
> - selected route, * - FIB route
/* no entry/default: 150 */
};
Admin Distance: Determining what to install
FRR Kernel
robot# conf t sharpd@robot ~> ip route show
robot(config)# ip route 4.3.2.1/32 enp0s10 default via 10.0.2.2 dev enp0s3 proto static metric 100
robot(config)# end 4.3.2.1 dev enp0s10 proto static metric 20
robot# show ip route 4.3.2.1 dev enp0s9 scope link metric 4278198272
Codes: K - kernel route, C - connected, S - static, R - RIP, 10.0.2.0/24 dev enp0s3 proto kernel scope link src 10.0.2.15
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP, metric 100
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP, 192.168.208.0/24 dev enp0s8 proto kernel scope link src
F - PBR, 192.168.208.1 metric 100
> - selected route, * - FIB route 192.168.209.0/24 dev enp0s9 proto kernel scope link src
192.168.209.1 metric 100
K>* 0.0.0.0/0 [0/100] via 10.0.2.2, enp0s3, 00:04:13 192.168.210.0/24 dev enp0s10 proto kernel scope link src
S>* 4.3.2.1/32 [1/0] is directly connected, enp0s10, 00:00:04 192.168.210.1 metric 100
K * 4.3.2.1/32 [255/8192] is directly connected, enp0s9, 00:03:15
C>* 10.0.2.0/24 is directly connected, enp0s3, 00:04:13
C>* 192.168.208.0/24 is directly connected, enp0s8, 00:04:13
C>* 192.168.209.0/24 is directly connected, enp0s9, 00:04:13
C>* 192.168.210.0/24 is directly connected, enp0s10, 00:04:13
robot# exit
How FRRouting interprets non-FRR route metrics
● Kernel has no concept of Admin Distance
● 4 Bytes of metric
○ High-Order byte becomes Admin Distance
○ Low-Order 3 bytes becomes Metric
● ip route add 4.3.2.1/32 dev enp0s9 metric 4278198272
https://www.netdevconf.org/1.1/proceedings/slides/ahern-vrf-tutorial.pdf
VRF Choices
● VRF Device
○ Creates a master device that you attach devices to
○ Route lookup by new rule inserted in kernel to allow usage of l3mdev to point at correct table
○ Allows route leaking via just installing a route with the appropriate outgoing nexthop, lookups
are easy from a RIB perspective
● Namespace
○ Create a network Namespace and insert devices into it
○ Route lookup by normal kernel table lookup
○ Route leaking can only be done by creating a new bridge and inserting taps into the
appropriate namespaces -or- running a physical cable from interfaces in different vrf’s
○ A heavyweight concept for table separation
○ Not actually a VRF, can be used like one
Basic Topology And Configuration
Topology Setup for Examples
192.168.211.0/24
r2 r3
192.168.210.0/24 192.168.212.0/24
192.168.213.0/24
r1 r4
192.168.215.0/24
192.168.214.0/24
r1 = .1 on all interfaces
r2 = .2 on all interfaces
r5 r3 = .3 on all interfaces
r4 = .4 on all interfaces
r5 = .5 on all interfaces
Loopbacks are 192.168.240.X/32
# r2 # r3
#The loopback network interface # The loopback network interface
auto lo auto lo
iface lo inet loopback iface lo inet loopback
address 192.168.240.2/32 address 192.168.240.3/32
# r1 # r4
# The loopback network interface # The loopback network interface
auto lo auto lo
iface lo inet loopback iface lo inet loopback
address 192.168.240.1/32 address 192.168.240.4/32
# r5 auto swp1
auto swp1
# The loopback network iface swp1
iface swp1
interface address 192.168.212.4/24
address 192.168.210.1/24
auto lo
iface lo inet loopback auto swp2
auto swp2
address 192.168.240.5/32 iface swp2
iface swp2
address 192.168.213.1/24 address 192.168.213.4/24
auto swp1
iface swp1 auto swp3
auto swp3
address 192.168.214.5/24 iface swp3
iface swp3
address 192.168.214.1/24 address 192.168.215.4/24
auto swp2
iface swp2
address 192.168.215.5/24
BGP Overview
● Used for routing on the Internet
○ Connects AS (Autonomous Systems) together
○ Policy Language is rich and featureful to allow operators a great level of control
● 2 modes of operation
○ IBGP (Route Reflector or Full Mesh)
○ EBGP
● Considered a path vector protocol
○ Uses AS Path to determine routes to install
○ AS Path also used for loop avoidance (don’t accept a path our our AS in it)
○ What route chosen is a complicated process and simplified here for purposes of discussion
● Uses TCP/IP for connections
● “BGP in the Data Center”, Dinesh Dutt (O’Reilly)
● https://tools.ietf.org/html/rfc1771 - This is the starter RFC, too many to list
BGP AS Path determination for Routing r1-r2
r2 r3
AS 10 AS 15
r1 r4
AS 5 AS 20
From r1:
To r2: (10),
r5
(20, 15, 10)
AS 25
(25, 20, 15, 10)
r1 r4
AS 5 AS 20
From r1:
ECMP Shortest
AS-Path Wins
BGP AS Path determination for Routing r1-r2
r2 r3
AS 10 AS 15
r1 r4
AS 5 AS 20
From r1:
r5 To r4: (20)
AS 25 (10, 15, 20)
(25, 20)
r1 r4
AS 5 AS 20
From r1:
r5 To r5: (25)
AS 25 (10, 15, 20, 25)
(20, 25)
r2 60 r3
60 5
r1 100 r4
60 60 From r1:
To r2: (60)
r5 (100+5+60=165)
(60+60+5+60=125)
r2 60 r3
60 5
r1 100 r4
60 60 From r1:
r5 To r3: (100+5=105)
(60+60=120)
(60+60+5=125)
r2 60 r3
60 5
r1 100 r4
60 60 From r1:
r5 To r4: (100)
(60+60=120)
(60+60+5=125)
r2 60 r3
60 5
r1 100 r4
60 60 From r1:
To r5: (60)
r5
(100+60=160)
(60+60+5+60=185)
Neighbor ID Pri State Dead Time Address Interface RXmtL RqstL DBsmL
192.168.240.2 1 Full/Backup 39.325s 192.168.210.2 swp1:192.168.210.1 0 0 0
192.168.240.4 1 Full/Backup 35.278s 192.168.213.4 swp2:192.168.213.1 0 0 0
192.168.240.5 1 Full/Backup 31.861s 192.168.214.5 swp3:192.168.214.1 0 0 0
!
router isis EVA
net 47.0023.0000.0000.0000.0000.0000.0000.1900.0004.00
metric-style wide
is-type level-1
!
IS-IS Configured
r1.rdu.cumulusnetworks.com# show ip route root@r1:/home/cumulus# ip route show
Codes: K - kernel route, C - connected, S - static, R - RIP, default via 10.50.11.1 dev eth0
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP, 10.50.11.0/24 dev eth0 proto kernel scope link src 10.50.11.194
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP, 192.168.210.0/24 dev swp1 proto kernel scope link src 192.168.210.1
F - PBR, 192.168.211.0/24 via 192.168.210.2 dev swp1 proto isis metric 20
> - selected route, * - FIB route 192.168.212.0/24 via 192.168.213.4 dev swp2 proto isis metric 20
192.168.213.0/24 dev swp2 proto kernel scope link src 192.168.213.1
K>* 0.0.0.0/0 [0/0] via 10.50.11.1, eth0, 00:10:36 192.168.214.0/24 dev swp3 proto kernel scope link src 192.168.214.1
C>* 10.50.11.0/24 is directly connected, eth0, 00:10:36 192.168.215.0/24 proto isis metric 20
I 192.168.210.0/24 [115/20] via 192.168.210.2, swp1 inactive, 00:04:31 nexthop via 192.168.213.4 dev swp2 weight 1
C>* 192.168.210.0/24 is directly connected, swp1, 00:10:36 nexthop via 192.168.214.5 dev swp3 weight 1
I>* 192.168.211.0/24 [115/20] via 192.168.210.2, swp1, 00:04:31 192.168.240.2 via 192.168.210.2 dev swp1 proto isis metric 20
I>* 192.168.212.0/24 [115/20] via 192.168.213.4, swp2, 00:04:31 192.168.240.3 proto isis metric 20
I 192.168.213.0/24 [115/20] via 192.168.213.4, swp2 inactive, 00:04:31 nexthop via 192.168.210.2 dev swp1 weight 1
C>* 192.168.213.0/24 is directly connected, swp2, 00:10:36 nexthop via 192.168.213.4 dev swp2 weight 1
I 192.168.214.0/24 [115/20] via 192.168.214.5, swp3 inactive, 00:04:31 192.168.240.4 via 192.168.213.4 dev swp2 proto isis metric 20
C>* 192.168.214.0/24 is directly connected, swp3, 00:10:36 192.168.240.5 via 192.168.214.5 dev swp3 proto isis metric 20
I>* 192.168.215.0/24 [115/20] via 192.168.213.4, swp2, 00:04:31
* via 192.168.214.5, swp3, 00:04:31
C>* 192.168.240.1/32 is directly connected, lo, 00:10:36
I>* 192.168.240.2/32 [115/20] via 192.168.210.2, swp1, 00:04:31
I>* 192.168.240.3/32 [115/30] via 192.168.210.2, swp1, 00:03:55
* via 192.168.213.4, swp2, 00:03:55
I>* 192.168.240.4/32 [115/20] via 192.168.213.4, swp2, 00:04:31
I>* 192.168.240.5/32 [115/20] via 192.168.214.5, swp3, 00:04:31
IS-IS Debugging
● show isis interface
○ What interfaces is IS-IS using?
● show isis neighbor
○ What neighbors has IS-IS formed?
● show isis database
○ Dump the IS-IS database
● debug isis adj-packets
○ Debug IS-IS adjacency formation
● debug isis route-events
○ Debug IS-IS route related events
IS-IS Debugging Example
r1.rdu.cumulusnetworks.com# show isis neighbor
Area EVA:
System Id Interface L State Holdtime SNPA
r2.rdu.cumulusnetworks.comswp1 1 Up 28 2020.2020.2020
r4.rdu.cumulusnetworks.comswp2 1 Up 28 2020.2020.2020
r5.rdu.cumulusnetworks.comswp3 1 Up 28 2020.2020.2020
a.rdu.cumulusnetworks.com# show isis database
Area EVA:
IS-IS Level-1 link-state database:
LSP ID PduLen SeqNumber Chksum Holdtime ATT/P/OL
r4.rdu.cumulusn.00-00 155 0x00000004 0xee92 775 0/0/0
r1.rdu.cumulusn.00-00 * 155 0x00000006 0x7f11 745 0/0/0
r2.rdu.cumulusn.00-00 136 0x00000003 0x46e5 472 0/0/0
r5.rdu.cumulusn.00-00 136 0x00000003 0x6ab0 743 0/0/0
r3.rdu.cumulusn.00-00 136 0x00000004 0x2303 716 0/0/0
5 LSPs
What Routing Protocol to Use?
● Use what is most familiar and meets your needs
● BGP Scales better
○ This is mostly due to lack of link state flooding
● BGP can handle many afi/safi combinations that are missing in other routing
protocols
○ Can be used as both Overlay and Underlay for vpn networks
Which Routing Protocol should I use?
● PIM
○ If you want to do non Link Local Multicast Routing (224.0.0.0/4)
● RIP/EIGRP
○ RIP is ancient and limited in scope, EIGRP is not production ready
● NHRP
○ Wickedly complicated and has a special use case that is not common
● PBR
○ Policy Based Routing, limited use cases - “static routing with a twist”
● BABEL
○ Wireless mesh and home routing
● LDP
○ Label distribution for MPLS
What does FRR Provide?
● Provides ability to run routing anywhere in your network
○ Hosts
○ VM’s
○ Containers
● Connect to closed source vendors
○ Using standards based routing protocols
Advanced Data Center Routing
Advanced Data Center Design
● Modern Data Center Architecture
● RFC 5549
● BGP EVPN
Modern Data Center Architecture
auto swp2
for the interface.
iface swp2
● New keyword for neighbor statement
auto swp1
iface swp1 ○ remote-as <internal|external>
auto swp3
iface swp3 ● Allows cut ‘n paste BGP configuration for large
root@r1:/home/cumulus# vtysh -c ‘show run’ swaths of your DC
!
router bgp 5
bgp bestpath as-path multipath-relax
neighbor swp1 interface remote-as external
neighbor swp2 interface remote-as external
neighbor swp3 interface remote-as external
!
address-family ipv4 unicast
redistribute connected
!
BGP 5549 RIB -vs- FIB
r1.rdu.cumulusnetworks.com# show ip route root@r1:/home/cumulus# ip route show
Codes: K - kernel route, C - connected, S - static, R - RIP, default via 10.50.11.1 dev eth0
O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP, 10.50.11.0/24 dev eth0 proto kernel scope link src 10.50.11.194
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP, 192.168.240.2 via 169.254.0.1 dev swp1 proto bgp metric 20 onlink
F - PBR, 192.168.240.3 proto bgp metric 20
> - selected route, * - FIB route nexthop via 169.254.0.1 dev swp1 weight 1 onlink
nexthop via 169.254.0.1 dev swp2 weight 1 onlink
K>* 0.0.0.0/0 [0/0] via 10.50.11.1, eth0, 00:08:15 192.168.240.4 via 169.254.0.1 dev swp2 proto bgp metric 20 onlink
C>* 10.50.11.0/24 is directly connected, eth0, 00:08:15 192.168.240.5 via 169.254.0.1 dev swp3 proto bgp metric 20 onlink
C>* 192.168.240.1/32 is directly connected, lo, 00:08:15
B>* 192.168.240.2/32 [20/0] via fe80::a00:27ff:fe70:65bc, swp1, 00:06:19 root@r1:/home/cumulus# ip neigh show | grep 169.254
B>* 192.168.240.3/32 [20/0] via fe80::a00:27ff:fe70:65bc, swp1, 00:01:58 169.254.0.1 dev swp1 lladdr 08:00:27:70:65:bc PERMANENT
* via fe80::a00:27ff:fe42:f484, swp2, 00:01:58 169.254.0.1 dev swp2 lladdr 08:00:27:42:f4:84 PERMANENT
B>* 192.168.240.4/32 [20/0] via fe80::a00:27ff:fe42:f484, swp2, 00:01:58 169.254.0.1 dev swp3 lladdr 08:00:27:46:bc:5f PERMANENT
B>* 192.168.240.5/32 [20/0] via fe80::a00:27ff:fe46:bc5f, swp3, 00:00:08
OSPF Unnumbered
● Poorly Named
● Creates routes w/ ifindexes and onlink to get this to work.
r1# show run # The loopback network interface
interface swp1 auto lo
ip ospf area 0.0.0.0 iface lo inet loopback
● Note different config than earlier
ip ospf network point-to-point address 192.168.240.1/32 example
!
interface swp2 auto swp2 ● Must configure point-to-point
ip ospf area 0.0.0.0 iface swp2
ip ospf network point-to-point address 192.168.240.1/32
!
interface swp3 auto swp1
ip ospf area 0.0.0.0 iface swp1
ip ospf network point-to-point address 192.168.240.1/32
!
interface lo auto swp3
ip ospf area 0.0.0.0 iface swp3
! address 192.168.240.1/32
router ospf
!
https://docs.cumulusnetworks.com/display/DOCS/Open+Shortest+Path+First+-+OSPF+-+Protocol
OSPF Routing Results
r1 r4
192.168.214.0/24
https://cumulusnetworks.com/lp/evpn-data-center-oreilly/
https://www.netdevconf.org/2.2/slides/prabhu-linuxbridge-tutorial.pdf
#r2
BGP EVPN Setup !
router bgp 10
neighbor swp1 interface remote-as external
neighbor swp2 interface remote-as external
!
address-family ipv4 unicast
redistribute connected
#r1
exit-address-family
!
!
router bgp 5
address-family l2vpn evpn
neighbor swp1 interface remote-as external
neighbor swp1 activate
!
neighbor swp2 activate
address-family ipv4 unicast
exit-address-family
redistribute connected
!
exit-address-family
!
address-family l2vpn evpn
neighbor swp1 activate #r3
advertise-all-vni !
exit-address-family router bgp 15
! neighbor swp1 interface remote-as 10
!
address-family ipv4 unicast
redistribute connected
exit-address-family
!
address-family l2vpn evpn
neighbor swp1 activate
advertise-all-vni
exit-address-family
!
BGP EVPN Configured
r1.rdu.cumulusnetworks.com# show bgp l2vpn evpn summ
BGP router identifier 192.168.240.1, local AS number 5 vrf-id 0
BGP table version 0
RIB entries 3, using 456 bytes of memory
Peers 1, using 19 KiB of memory
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
r2.rdu.cumulusnetworks.com(swp1) 4 10 1732 1729 0 0 0 01:21:29 2
*> [2]:[0]:[0]:[48]:[08:00:27:70:38:6e]
192.168.240.3 0 10 15 i
*> [3]:[0]:[32]:[192.168.240.3]
192.168.240.3 0 10 15 i
Super Special Thanks to Roopa Prabhu, David Ahern and Nikolay Aleksandrov for putting up with all my kernel questions!
Thanks to Don Slice, Quentin Young, and Eric Pulvino for talking me down when I worked on this Presentation