P4 explained with a post office
The language I research, without the jargon: packets, mail carriers and new rules for network devices.
When you open a website, send a message or watch a video, nothing travels across the internet in one piece. Everything is chopped into small pieces called packets, and each packet makes its own way to the destination, passing through several devices along the route, such as routers and switches.
Every packet is a letter
Think of each packet as a letter. It has an envelope, with the address of whoever sent it and whoever will receive it, and it has the contents, which are a piece of the message. On a network, that envelope is called the header.
The network devices are the post offices along the way. In each one, a mail carrier looks at the envelope, checks a table and decides where the letter goes next. And they do it really fast: a network device checks millions of packets per second.
The factory-trained mail carrier
In most devices, that mail carrier comes trained from the factory. It knows how to read a few kinds of envelopes and follow a few rules, and that's it. If you want it to check something new, you usually have to wait for the manufacturer to release a new device.
What P4 changes
P4 is a programming language for writing that mail carrier's job. With it, you tell the device:
- how to read the envelope: which fields exist and where each one is;
- which tables to check: for example, a list of blocked addresses;
- what to do with each letter: let it through, change its route, make a note or drop it.
It's like being able to train the mail carrier with new rules without replacing the whole post office. That's why these are called programmable networks.
What about security?
Since the mail carrier sees every letter that passes by, it can help protect the network right at the door: stop addresses known for attacks, notice a flood of packets trying to take a service down, or set aside whatever looks suspicious.
But it has to be fast, so it can't run a full investigation of every letter on the spot. The heavy lifting is done by systems built to hunt for attacks, called intrusion detection systems.
That's where my research at AI Horizon Labs comes in: I study how to use P4 so the network itself does a first sorting and sets aside the packets that deserve a closer look, without leaving out anything that should be analyzed.
In one sentence: P4 lets you program what the network does with each packet, and I research how to use that to make communication more secure.
Want to feel it yourself?
On the home page there's a one-minute game, Be the firewall: you check the packets arriving at a home and decide who gets in. It's a very simplified version of what a device programmed with P4 does.
Arthur Medeiros, Computer Science student at UNIPAMPA. Questions or suggestions? Get in touch.