eBPF (+XDP) firewall

mipsH

Renowned Member
Hello.

Starting with Linux kernel 4.18. we have a production ready XDP + eBPF capabilities, which is now included in production, starting with RedHat Enterprise Linux v.8.1. and of course included in CentOS Linux 8.1. Other will follow soon.

For those not familiar, in simple words:
XDP is Express Data Path technology which uses a new way of processing network packets and through the so called ebpf making rules (firewall and other) which are compiled using eBPF Virtual Machine in kernel space. This method of work is also very fast.

This entire design drastically improve speed of processing network packets, from 3.5 x and even more (on the same hardware as iptables/nftables).
Even more speed can be achieved using special network cards such Netronome cards with "Network Flow Processor" or Intel 800 series (review).

Measures show the next results in packet processing for firewall usage:
fig7.width-800.png


Explanation from graph:
iptables = iptables firewall/rules
nftables = nftables firewall/rules
bpfilter (host driver XDP, JIT) = XDP + eBPF (bpfilter rules): means network card with XDP enabled in driver only + Just In Time compiling eBPF rules
bpfilter (hardware offload) = same as bpfilter above, but with hardware acceleration in special NIC like Netronome or Intel 800 series.


Source of the image:
https://www.netronome.com/blog/bpf-...hese-things-and-what-do-they-mean-enterprise/



So, my question are: could you consider to include it over time in a new releases of Proxmox VE firewall ?.



I know that it is a big job to do so, but for now there is at lease one interesting project for easing things up
With which it is easy to inline convert iptables rules to eBPF rules, using so called: bpfilter.

Video of bpfilter usage (inline conversion of iptables rules to eBPF rules): https://www.youtube.com/watch?v=AfgwVya9Cog




BR,
Hrvoje.
 
XDP still missing bridges support currently, but when It'll be available, it should be really fast. (and avoid dpdk - ovs userland crap :p).
https://fr.slideshare.net/ennael/kernel-recipes-2019-xdp-closer-integration-with-network-stack
(slide 9 for bridge)

about BPF, I don't known how it's working for firewall at forward level currently.
but converting iptables rules to ebpf rules is not so easy. (but I think it could be already possible to use it for ddos protection )
 
Great config examples can be found here:
https://www.netronome.com/documents/305/eBPF-Getting_Started_Guide.pdf
(Not only for offloading using NFP NICs)

Read also:
https://cilium.io/blog/2018/11/20/fb-bpf-firewall/

There are also project like iptables like command:
https://github.com/mbertrone/bpf-iptables

And interesting comparison: iptables and bpf:
https://cilium.io/blog/2018/04/17/why-is-the-kernel-community-replacing-iptables/



And interesting comparison: iptables vs nftables vs bpf (XDP) with examples (how it is tested):
https://blog.cloudflare.com/how-to-drop-10-million-packets/


In addition, we can see that OpenvSwitch is also using XDP for faster packet processing rate:
http://docs.openvswitch.org/en/latest/intro/install/afxdp/

... and the others will (and are) follow:
Suricata (IPS/IDS), ...
 
Regarding OpenvSwitch and XDP:
In version (v2.12.0 - 03 Sep 2019) we can see:
* Add Linux AF_XDP support through a new experimental netdev type "afxdp".

And per their manual how to compile it, we can see that it is "experimental" for now (Sep 2019) but can be used.
Since AF_XDP is in production usage (from Linux kernel 4.18) i hope that we can expect it to be used soon, as standard in OpenvSwitch
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!