This repository contains experimental code for a network emulation tool based on eBPF as well as experiment artifacts for it. We also include experiment setups and results to test NetEm.
If you use this software in a publication, please cite it as:
S. Becker, T. Pfandzelter, N. Japke, D. Bermbach, O. Kao, Network Emulation in Large-Scale Virtual Edge Testbeds: A Note of Caution and the Way Forward, Proceedings of the 2nd International Workshop on Testing Distributed Internet of Things Systems (TDIS 2022), Pacific Grove, CA, USA, 2022.
@inproceedings{becker_netem_ebpf:_2022,
title = "Network Emulation in Large-Scale Virtual Edge Testbeds: A Note of Caution and the Way Forward",
booktitle = "Proceedings of the 2nd International Workshop on Testing Distributed Internet of Things Systems (TDIS 2022)",
author = "Becker, Soeren and Pfandzelter, Tobias Pfandzelter and Japke, Nils and Bermbach, David and Kao, Odej",
year = 2022
}
For a full list of publications, please see our website.
A license for the code in this repository is pending.
The following installs the needed dependencies on Ubuntu 20.04 / 22.04:
sudo apt-get install -y clang gcc-multilib libbpf-dev
Use the provided Makefile, the eBPF programs will be compiled with go generate
:
make all
The binaries can be found in the bin
dir.
Simple example showcasing the direct-action flag of tc.
Set different delays per IP destination based on a shared eBPF map and a single fq
qdisc.
sudo ./bin/ebpf-delay -iface eth0
Limit the available bandwidth to different IP destinations using the Earliest Departure Time model and set a delay, based on a shared eBPF map.
sudo ./bin/ebpf-network-simulation -iface eth0
Populate an eBPF map with a given number of entries. The map has the following structure and is utilized by ebpf-delay
and edt-bandwidth-limit
:
struct handle_bps_delay {
__u32 tc_handle; // TC handle, used for classic htb qdisc version
__u32 throttle_rate_bps; // Throttled bandwidth (in BPS)
__u32 delay_ms; // Delay in ms
} HANDLE_BPS_DELAY;
struct {
__uint(type, BPF_MAP_TYPE_HASH);
__type(key, __u32); // The IP destination
__type(value, HANDLE_BPS_DELAY);
__uint(pinning, LIBBPF_PIN_BY_NAME);
__uint(max_entries, 65535);
} IP_HANDLE_BPS_DELAY SEC(".maps");
The map declaration can be found here.
First run either ebpf-delay
or ebpf-network-simulation
.
sudo ./bin/map-populator
sudo tc qdisc del dev eth0 clsact
sudo tc qdisc del dev eth0 root
sudo rm /sys/fs/bpf/IP_HANDLE_BPS_DELAY
sudo rm /sys/fs/bpf/progs