Learning VPP and frrouting : OSPF routing protocol

Learning VPP: OSPF routing protocol

logo_fdio-300x184

Overview

The task at hand is to enable OSPF on VPP router. For this purpose is chosen FRRouting (FRR), which is an IP routing protocol suite for Linux and Unix platforms.

I will use VPP’s router plugin, that implements logic to punt control packets to the Linux network stack and a Netlink-based mechanism that synchronizes the Linux’s routing table into VPP’s FIB.

In order to compile the router plugin with VPP version 20, I had to make few modifications to source code that can be seen on Github.

Topology

I have used 4 VirtualBox VMs for two VPP routers and two hosts.

VPP_OSPF

VPP VM configuration looks as follows.

VPP_VM_config

Host VM configuration looks as follows.

Host_VM_config

Install VPP from the package

For your convenience, I have uploaded prebuilt Debian packages targeted against Ubuntu 18.04. The VPP will be installed and started as a service with a router plugin enabled.

curl -s https://packagecloud.io/install/repositories/emflex/fdio/script.deb.sh | sudo bash
sudo apt-get install vpp vpp-plugin-core vpp-plugin-dpdk vpp-ext-deps

Install VPP from source

Here, I have introduced a script to download and build VPP from sources together with the router plugin.

git clone https://github.com/garyachy/frr-vpp.git
cd frr-vpp
sudo ./build_vpp.sh
sudo dpkg -i vpp/build-root/*.deb

Install FRR from the package

curl -s https://deb.frrouting.org/frr/keys.asc | sudo apt-key add -
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
sudo apt update && sudo apt install frr frr-pythontools

Configure FRR

Make the following changes to /etc/frr/daemons

ospfd=yes
ospfd_options=" -A 127.0.0.1 -f /etc/frr/ospfd.conf"

Make the following changes to /etc/frr/ospfd.conf

hostname ospfd
password zebra
log file /var/log/frr/ospfd.log informational
log stdout
!
router ospf
    ospf router-id 10.10.10.1
    network 10.10.10.1/24 area 0.0.0.0
    network 100.100.100.0/24 area 0.0.0.0
!

Configure Netplan

VPP interface need to be added into /etc/netplan/50-cloud-init.yaml and netplan apply executed.

network:
    ethernets:
        enp0s3:
            dhcp4: true
        vpp0:
            addresses:
            - 10.10.10.1/24
        vpp1:
            addresses:
            - 100.100.100.1/24
    version: 2

Results

VPP creates TAP interfaces in Linux.

denys@vpp1:~$ ip addr
5: vpp0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 1000
    link/ether 08:00:27:4a:5c:a2 brd ff:ff:ff:ff:ff:ff
    inet 10.10.10.1/24 brd 10.10.10.255 scope global vpp0
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe4a:5ca2/64 scope link 
       valid_lft forever preferred_lft forever
6: vpp1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 1000
    link/ether 08:00:27:7a:4b:93 brd ff:ff:ff:ff:ff:ff
    inet 100.100.100.1/24 brd 100.100.100.255 scope global vpp1
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe7a:4b93/64 scope link 
       valid_lft forever preferred_lft forever

You can see that OSPF routes were installed into Linux.

denys@vpp1:~$ ip route
default via 192.168.0.1 dev enp0s3 proto dhcp src 192.168.0.108 metric 100 
10.10.10.0/24 dev vpp0 proto kernel scope link src 10.10.10.1 
20.20.20.0/24 via 100.100.100.2 dev vpp1 proto ospf metric 20 
100.100.100.0/24 dev vpp1 proto kernel scope link src 100.100.100.1 
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown 
192.168.0.0/24 dev enp0s3 proto kernel scope link src 192.168.0.108 
192.168.0.1 dev enp0s3 proto dhcp scope link src 192.168.0.108 metric 100

Also, hosts can ping each other.

denys@host2:~$ ping 10.10.10.2
PING 10.10.10.2 (10.10.10.2) 56(84) bytes of data.
64 bytes from 10.10.10.2: icmp_seq=2 ttl=62 time=0.769 ms
64 bytes from 10.10.10.2: icmp_seq=3 ttl=62 time=0.547 ms
64 bytes from 10.10.10.2: icmp_seq=4 ttl=62 time=0.593 ms

References

原文地址:https://www.cnblogs.com/dream397/p/13539417.html