veth pair and a network namespace give you a sender and a receiver on one box. A laptop is fine.
This is the safest possible place to learn the tool. Nothing you do here can touch your real network, and you can turn on --rx-mode all without any consequence at all.
veth gives you native XDP in copy mode with one queue. Throughput here tells you about your CPU and kernel, not about a NIC, which is exactly right when what you’re testing is your own config.Build the lab
Two commands’ worth of setup.wb0 stays in your normal namespace and does the sending; wb1 lives in a namespace called wblab and does the receiving.
Run a test through it
Two terminals. Receiver first, so it’s listening before traffic starts.- Terminal 1 — receiver
- Terminal 2 — sender
What you should see
Sender:- No link bounce.
vethhas no physical link to renegotiate, so the attach is instant. On a real NIC this is where you’d wait about 8 seconds. copynotzero-copy. Expected on veth, and covered in hardware and drivers.
How fast does it go?
Single queue on a 12-core box, so you have a reference point:
It’s packet-rate bound rather than bit-rate bound, so 1518-byte frames reach around 6.5 Gbit/s while 64-byte frames reach around 0.37 Gbit/s. Again, that’s your CPU and kernel, not a NIC.
Things to try in here
Since nothing here can hurt anything, this is the place to experiment with the settings you’d be careful about on a real box.The match-all receive mode
The match-all receive mode
yes confirmation. Read what it says: that’s the screen that matters on a real interface. Here, the worst case is that a namespace with nothing in it stops receiving.Unlimited rate
Unlimited rate
--packet-size 64 versus --packet-size 1518 and watch packets/sec and bits/sec trade off against each other.Flows and hashing
Flows and hashing
tcpdump -ni wb1 inside the namespace at a low --pps and watch the tuples change.PCAP replay
PCAP replay
Capture a few seconds of something real, then put it back on the wire:
Tear it down
Deleting the namespace takeswb1 with it, and a veth pair dies together, so this is all you need: