Simulate a bad network on Linux, for one app
On Linux the usual answer is tc with netem: it adds delay and loss to a whole network interface, from the command line. Bean Network Tester does the same kinds of damage to one program, from a window or from the command line, and stops on its own. Its Linux version is experimental, and this page says what that means.
tc netem commands and what to use here
A netem command and the nearest command here, side by side. Run it with sudo, and keep --target and --duration: without them it affects the whole computer, as netem does.
sudo tc qdisc add dev eth0 root netem delay 100ms 20ms loss 5%
sudo ./BeanNetworkTester --target firefox --latency 100 --jitter 20 --loss 5 --duration 60
| netem | Setting in the window | Flag |
|---|---|---|
delay 100ms | Latency | --latency 100 |
delay 100ms 20ms | Latency, Jitter | --latency 100 --jitter 20 |
loss 5% | Loss | --loss 5 |
loss 100% | Loss | --loss 100 |
loss 5% 25% | Loss, Losses in a row (burst) | --loss 5 --loss-burst 4 |
duplicate 1% | Duplication | --dup 1 |
corrupt 0.1% | Corruption | --corrupt 0.1 |
reorder 25% | Spike chance, Spike size | --spike-prob 5 --spike-ms 200 |
rate 1mbit | Download, Upload | --down 122 --up 122 |
limit 1000 | Buffer | --buffer 1000 |
The numbers do not all carry over one to one. netem delays only what leaves the interface, and this tool captures both directions, so --latency 100 adds about 200 ms to a round trip: add --filter out to delay only what leaves. A netem rate is in bits per second, and the speed limit is in KB/s. The netem page explains each difference.
Why not just netem?
- One program, not the whole interface. netem slows everything that leaves
eth0, your ssh session included. Here--targetpicks a process by name (on Linux without.exe:firefox,chrome), a PID, an address or a port, and the rest of the machine keeps working. - Both directions. netem shapes what goes out, and incoming traffic needs an ifb device and a second set of rules. Here download and upload each have their own limit.
- It cleans up after itself. A netem rule stays until you delete it. A session here ends after
--duration, and if the program is killed, the traffic it was holding flows again after about 3 seconds. - You see what happened. A chart, a connections table and counters of what was delayed, dropped and let through, instead of
tc -s qdisc. - Runs repeat.
--seedreplays the same random loss and jitter, and timed scenarios change the settings at set seconds, the way a script oftcandsleepdoes.
What it needs
- The package from the releases page, a
.tar.gzwith its own Python and Tk. It is built on Ubuntu 24.04 and checked on Ubuntu 24.04 and 26.04, for x86_64, and needs glibc 2.38 or newer. - The kernel: Linux 5.10 or newer, built with BTF. The capture runs on eBPF.
- Root, or the capabilities CAP_BPF, CAP_PERFMON, CAP_NET_ADMIN and CAP_NET_RAW. The window asks for an administrator's password in the desktop's own dialog, the command line needs
sudo, and--simulateneeds neither.
tar -xzf BeanNetworkTester-*-linux-x64.tar.gz
cd BeanNetworkTester
./BeanNetworkTester --install-desktop
sudo ./BeanNetworkTester --doctor
--install-desktop adds the program to the applications menu, so run it without sudo. --doctor lists what the machine still lacks.
The network tools work on Linux too
The Tools tab answers questions before and during a test: Ping (a continuous ping with a chart), NAT and STUN, Port scan, Sockets, Port check, TCP health (what the kernel keeps for each connection, as ss -ti shows it) and Adapters (as ip addr and ip route show them). TCP health and Adapters need no sudo, and Ping needs it only where the system does not let your group send pings, as on Ubuntu 24.04.
Where Linux differs, today
--targetreads the system's list of sockets, so the first exchange of a new connection can pass before the target applies.- When the tool cannot keep up, the kernel lets packets go around it unimpaired, and the counters say how many.
- IP fragments always pass through untouched.
- There is no code signature on Linux. The release's checksums and attestation say which build produced the file, and the download page shows how to check them.
For a permanent setup on a whole interface, netem is already in your kernel and is the right tool. This one is for testing one application for a while.