You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
« Previous
Version 13
Next »
In article #003 and #004 you learned how RARE/freeRouter is controlling a P4 dataplane (BMv2 or TOFINO virtual model). We also demonstrated that this setup could be integrated into real networks. However, these P4 dataplanes are not suitable for day to day real operation as it have inherent software limitations. While freeRouter native software dataplane presents the advantage to get the entire feature set and is sufficient to handle a home network traffic load, we investigated a way to improve dataplane performance. In that context we considered to study:
Requirement- Basic Linux/Unix knowledge
- Basic networking knowledge
| |
Overview
However, XDP model was not complete enough in order to compile router.p4 and we could not generate the corresponding kernel bypass code with ELTE T4P4S based on BMv2 V1Model.p4. (A GitHub issue is still pending). In that context, Csaba freeRouter lead developer decided to develop P4Emu a software dataplane that has the particularity to:
- understand freeRouter control plane message meant to be addressed to a P4 dataplane
- thus maintaining the control plane decoupled to the dataplane as it was the case with BMv2 and BF_SWITCHD
Article objective
In this article we'll using freeRouter setup deployed in #004 and replace bf_switchd providing freeRouter INTEL/BAREFOOT TOFINO's dataplane by P4Emu/pcap.
Diagram
[ #005 ] - Cookbook
Install your favorite operating system
In our example we will use the same debian stable image (buster) installed as a VirtualBox VM as in #002.
and we add a bridge network interface to or laptop RJ45 connection.
Install FreeRouter as per #001 article: "Create freeRouter environment"
mkdir -p ~/freeRouter/bin ~/freeRouter/lib ~/freeRouter/etc ~/freeRouter/log
cd ~/freeRouter/lib
wget http://freerouter.nop.hu/rtr.jar
tree freeRouter
freeRouter
├── bin # binary files
├── etc # configuration files
├── lib # library files
└── log # log files
Install freeRouter net-tools
wget freerouter.nop.hu/rtr.tar
tar xvf rtr.tar -C ~/freeRouter/bin/
Create configuration files for router: freerouter
FreeRouter uses 2 configuration files in order to run, let's write these configuration files for R1 in ~/freeRouter/etc
int eth0 eth 0000.1111.00fb 127.0.0.1 22710 127.0.0.1 22709
tcp2vrf 2323 v1 23
tcp2vrf 9080 v1 9080
hostname p4-freerouter
buggy
!
!
prefix-list p4
sequence 10 permit 0.0.0.0/0 ge 0 le 0
exit
!
prefix-list p6
sequence 10 permit ::/0 ge 0 le 0
exit
!
vrf definition v1
exit
!
interface ethernet0
description freerouter@P4_CPU_PORT[veth251]
no shutdown
no log-link-change
exit
!
interface sdn1
description freerouter@sdn1[enp0s3]
mtu 9000
macaddr 0072.3e18.1b6f
vrf forwarding v1
ipv4 address 192.168.0.131 255.255.255.0
ipv6 address 2a01:e0a:159:2850::666 ffff:ffff:ffff:ffff::
ipv6 enable
no shutdown
no log-link-change
exit
!
!
!
!
!
!
!
!
!
!
!
!
!
!
server telnet tel
security protocol telnet
no exec authorization
no login authentication
vrf v1
exit
!
server p4lang p4
export-vrf v1 1
export-port sdn1 1 0
interconnect ethernet0
vrf v1
exit
!
end
Launch freeRouter control plane alongside P4Emu/pcap dataplane
echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
echo 1 > /proc/sys/net/ipv6/conf/default/disable_ipv6
ip link add veth251 type veth peer name veth250
ip link set veth250 up
ip link set veth251 up
ifconfig enp0s3 promisc
ifconfig veth250 promisc
ifconfig veth251 promisc
ip link set dev veth250 up mtu 10240
ip link set dev veth251 up mtu 10240
ip link set dev enp0s3 up mtu 10240
export TOE_OPTIONS="rx tx sg tso ufo gso gro lro rxvlan txvlan rxhash"
for TOE_OPTION in $TOE_OPTIONS; do
/sbin/ethtool --offload veth250 "$TOE_OPTION" off &> /dev/null
/sbin/ethtool --offload veth251 "$TOE_OPTION" off &> /dev/null
/sbin/ethtool --offload enp0s3 "$TOE_OPTION" off &> /dev/null
done
java -jar lib/rtr.jar routersc etc/p4-freerouter-hw.txt etc/p4-freerouter-sw.txt
info cfg.cfgInit.doInit:cfgInit.java:556 booting
info cfg.cfgInit.doInit:cfgInit.java:680 initializing hardware
info cfg.cfgInit.doInit:cfgInit.java:687 applying defaults
info cfg.cfgInit.doInit:cfgInit.java:695 applying configuration
info cfg.cfgInit.doInit:cfgInit.java:721 done
welcome
line ready
freerouter#
cd ~/freeRouter/bin
./pcapInt.bin veth251 22709 127.0.0.1 22710 127.0.0.1
binded to local port 127.0.0.1 22709.
will send to 127.0.0.1 22710.
pcap version: libpcap version 1.8.1
opening interface veth251 with pcap1.x api
serving others
>
sudo ./p4emu.bin 127.0.0.1 9080 0 veth250 enp0s3
cpu port is #0 of 2...
pcap version: libpcap version 1.8.1
connecting 127.0.0.1 9080.
opening interface veth250.
opening interface enp0s3.
rx: 'myaddr4' 'add' '224.0.0.0' '4' '0' '1' ''
rx: 'myaddr4' 'add' '255.255.255.255' '32' '0' '1' ''
rx: 'myaddr6' 'add' 'ff00::' '8' '0' '1' ''
rx: 'myaddr4' 'add' '192.168.0.0' '24' '-1' '1' ''
rx: 'myaddr4' 'add' '192.168.0.131' '32' '-1' '1' ''
rx: 'myaddr6' 'add' '2a01:e0a:159:2850::' '64' '-1' '1' ''
rx: 'myaddr6' 'add' '2a01:e0a:159:2850::666' '128' '-1' '1' ''
rx: 'myaddr6' 'add' 'fe80::' '64' '-1' '1' ''
rx: 'mylabel4' 'add' '615589' '1' ''
rx: 'mylabel6' 'add' '1036348' '1' ''
rx: 'state' '1' '1' '0' ''
rx: 'mtu' '1' '9000' ''
rx: 'portvrf' 'add' '1' '1' ''
rx: 'keepalive' ''
rx: 'keepalive' ''
rx: 'neigh6' 'add' '11120' 'fe80::224:d4ff:fea0:cd3' '00:24:d4:a0:0c:d3' '1' '00:72:3e:18:1b:6f' '1' ''
rx: 'keepalive' ''
rx: 'keepalive' ''
rx: 'keepalive' ''
rx: 'neigh4' 'add' '29738' '192.168.0.254' '00:24:d4:a0:0c:d3' '1' '00:72:3e:18:1b:6f' '1' ''
rx: 'keepalive' ''
rx: 'neigh4' 'add' '40470' '192.168.0.62' 'e0:3f:49:6d:18:99' '1' '00:72:3e:18:1b:6f' '1' ''
rx: 'keepalive' ''
rx: 'keepalive' ''
rx: 'keepalive' ''
rx: 'keepalive' ''
rx: 'keepalive' ''
rx: 'neigh6' 'add' '45820' '2a01:e0a:159:2850:e23f:49ff:fe6d:1899' 'e0:3f:49:6d:18:99' '1' '00:72:3e:18:1b:6f' '1' ''
rx: 'keepalive' ''
rx: 'neigh6' 'add' '49055' 'fe80::e23f:49ff:fe6d:1899' 'e0:3f:49:6d:18:99' '1' '00:72:3e:18:1b:6f' '1' ''
rx: 'neigh6' 'add' '33334' '2a01:e0a:159:2850::
...
Verification
Check telnet access for freerouter@2323
telnet localhost 2323
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
welcome
line ready
freerouter#
Check running-config
p4-freerouter#term len 0
p4-freerouter#sh run
hostname p4-freerouter
buggy
!
vrf definition v1
exit
!
interface ethernet0
description freerouter@P4_CPU_PORT[veth251]
no shutdown
no log-link-change
exit
!
interface sdn1
description freerouter@sdn1[enp0s3]
mtu 9000
macaddr 0072.3e18.1b6f
vrf forwarding v1
ipv4 address 192.168.0.131 255.255.255.0
ipv6 address 2a01:e0a:159:2850::666 ffff:ffff:ffff:ffff::
ipv6 enable
no shutdown
no log-link-change
exit
!
!
!
!
!
!
!
!
!
!
!
!
!
!
server telnet tel
security protocol telnet
no exec authorization
no login authentication
vrf v1
exit
!
server p4lang p4
export-vrf v1 1
export-port sdn1 1 0
interconnect ethernet0
vrf v1
exit
!
end
p4-freerouter#show interfaces summary
interface state tx rx drop
ethernet0 up 8739 404545 0
sdn1 up 8535 400013 0
Connectivity IPv4/IPv6 check for freeRouter
p4-freerouter#ping 192.168.0.254 /vrf v1
pinging 192.168.0.254, src=null, cnt=5, len=64, tim=1000, ttl=255, tos=0, sweep=false
.!!!!
result=80%, recv/sent/lost=4/5/1, rtt min/avg/max/total=1/1/2/1011
p4-freerouter#ping 192.168.0.62 /vrf v1
pinging 192.168.0.62, src=null, cnt=5, len=64, tim=1000, ttl=255, tos=0, sweep=false
.!!!!
result=80%, recv/sent/lost=4/5/1, rtt min/avg/max/total=1/1/2/1005
p4-freerouter#sh ipv4 arp sdn1
mac address time static
e03f.496d.1899 192.168.0.62 00:00:57 false <----- Host server
0024.d4a0.0cd3 192.168.0.254 00:00:57 false <----- LAN gateway
p4-freerouter#ping 2a01:e0a:159:2850::1 /vrf v1
pinging 2a01:e0a:159:2850::1, src=null, cnt=5, len=64, tim=1000, ttl=255, tos=0, sweep=false
.!!!!
result=80%, recv/sent/lost=4/5/1, rtt min/avg/max/total=0/1/2/1004
p4-freerouter#ping 2a01:e0a:159:2850:e23f:49ff:fe6d:1899 /vrf v1
pinging 2a01:e0a:159:2850:e23f:49ff:fe6d:1899, src=null, cnt=5, len=64, tim=1000, ttl=255, tos=0, sweep=false
.!!!!
result=80%, recv/sent/lost=4/5/1, rtt min/avg/max/total=1/1/1/1006
p4-freerouter#show ipv6 neighbors sdn1
mac address time static router
0024.d4a0.0cd3 2a01:e0a:159:2850::1 00:00:53 false false
e03f.496d.1899 2a01:e0a:159:2850:e23f:49ff:fe6d:1899 00:00:53 false false
0024.d4a0.0cd3 fe80::224:d4ff:fea0:cd3 00:00:53 false false
e03f.496d.1899 fe80::e23f:49ff:fe6d:1899 00:00:53 false false
p4-freerouter#ssh 192.168.0.62 /vrf v1 /user my-nas
- connecting to 192.168.0.62 22
password: *******
- securing connection
Last login: Mon Jul 6 15:05:38 2020 from 192.168.0.77
FreeBSD 11.3-RELEASE-p9 (FreeNAS.amd64) #0 r325575+588899735f7(HEAD): Mon Jun 1 15:04:31 EDT 2020
FreeNAS (c) 2009-2020, The FreeNAS Development Team
All rights reserved.
FreeNAS is released under the modified BSD license.
For more information, documentation, help or support, go here:
http://freenas.org
Welcome to FreeNAS
MY-NAS%
p4-freerouter#ssh 2a01:e0a:159:2850:e23f:49ff:fe6d:1899 /vrf v1 /user my-nas
- connecting to 2a01:e0a:159:2850:e23f:49ff:fe6d:1899 22
password: *******
- securing connection
Last login: Tue Jul 7 16:01:54 2020 from 2a01:e0a:159:2850::666
FreeBSD 11.3-RELEASE-p9 (FreeNAS.amd64) #0 r325575+588899735f7(HEAD): Mon Jun 1 15:04:31 EDT 2020
FreeNAS (c) 2009-2020, The FreeNAS Development Team
All rights reserved.
FreeNAS is released under the modified BSD license.
For more information, documentation, help or support, go here:
http://freenas.org
Welcome to FreeNAS
MY-NAS%
Conclusion
In this article you:
- had a demonstration of how to integrate freeRouter into a local area network (Similar to article #002)
- However instead of using bmv2 or TOFINO we used a P4Emu/pcap dataplane
- communication between freeRouter control plane and P4Emu/pcap is ensured by pcapInt via veth pair [ veth250 - veth251 ]
- In this example the freeRouter with P4Emu/pcap has only 1 dataplane interface that is bound to enp0s3 VM interface exposed to the local network as a bridged interface