Programming Protocol-independent Packet Processors (P4) is a powerful domain-specific language designed for network devices. It provides a flexible way to specify how data plane devices, including switches, NICs, routers, and filters, process packets.
P4 programs prioritize implementation independence, enabling compilation against diverse execution machines, such as general-purpose CPUs, FPGAs, system-on-chip devices, network processors, and ASICs.
A gentle introduction to the P4 programming language is available at https://cylab.be/publications/62/2024-p4-language-a-practical-introduction
This project aims to explore the capabilities of the P4 language, particularly in the realm of security. We are looking at the implementation of filtering or detection systems directly on programmable switches or routers using P4.
Explore various P4 implementations to gain insights into the language's capabilities. Each example addresses specific network scenarios.
We use the p4-utils project for network creation and switch programming. Ensure you have the following dependencies installed:
Dependency | Installation Command |
---|---|
P4C & BMv2 | Find installation commands below |
Mininet | sudo apt-get -y install mininet |
Other dependencies | sudo apt-get install -y packer xterm help2man python3-pip |
Scapy | pip3 install --pre scapy[complete] |
source /etc/lsb-release
echo "deb http://download.opensuse.org/repositories/home:/p4lang/xUbuntu_${DISTRIB_RELEASE}/ /" | sudo tee /etc/apt/sources.list.d/home:p4lang.list
curl -fsSL https://download.opensuse.org/repositories/home:p4lang/xUbuntu_${DISTRIB_RELEASE}/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/home_p4lang.gpg > /dev/null
sudo apt-get update -y
sudo apt-get install -y p4lang-p4c p4lang-bmv2
This version of p4-utils has been slightly modified to address log errors. The official p4-utils version from their Git repository was found to be incompatible. Follow the steps below to install the modified version:
cd p4-utils/
sudo bash ./install.sh
Once p4-utils and all its dependencies have been installed, you can add, remove and modify P4 switches and other switch types, as well as hosts.
Publications and slides found are not pushed on Gitlab. Please ask me directly if you want me to provide you with everything.
Below you'll find links to some learning materials.