| Crates.io | phantomlink |
| lib.rs | phantomlink |
| version | 0.1.0 |
| created_at | 2025-06-23 13:26:28.276732+00 |
| updated_at | 2025-06-23 13:26:28.276732+00 |
| description | phantomlink looks like a multi-hop Internet path, but emulates a virtual end-to-end link |
| homepage | |
| repository | https://github.com/robinohs/phantomlink |
| max_upload_size | |
| id | 1722909 |
| size | 160,097 |
phantomlink looks like a multi-hop Internet path but emulates a virtual end-to-end link
phantomlink is a tool for studying the impact of a dynamic network environment on the performance of internet protocols and applications. Written in safe Rust, the tool makes use of Linux network namespaces and virtual Ethernet devices to simulate a realistic end-to-end link. Using simple .csv scenario files, it is possible to define the time-evolving virtual link parameters, including delay, data rate over time, and route changes.
Since the tool just opens two connected vEth in different namespaces, it is possible to combine phantomlink with any application, such as the well-known tools like netcat or iperf but also your own custom application.
With the ability to reorder, delay, pace, and drop packets, phantomlink can be used to test network behavior under various scenarios.
phantomlinkphantomlink[!WARNING] Phantomlink currently only runs on Linux or the Windows Subsystem for Linux (WSL)
phantomlink debian package.sudo apt install ~/downloads/phantomlink_[version].deb
To get started you have to do the following:
phantomlink binary.chmod +x phantomlink_[version]
/bin.It is also possible to build the phantomlink binary from source.
phantomlink repository from GitHub:git clone https://github.com/robinohs/phantomlink
cargo build --release
sudo mv target/release/phantomlink /bin/
phantomlink repository from GitHub:git clone https://github.com/robinohs/phantomlink
install.sh script:cd phantomlink
./install.sh
Verify phantomlink is correctly installed by running:
phantomlink --version
phantomlink provides shell completion support for multiple shells, including bash, elvish, fish, PowerShell, zsh, and nushell. It automatically detects your default shell from the environment, so you donโt need to specify it unless you want to.
To generate completions for a specific shell, use the command below. phantomlink will output the auto-completion code to stdout, allowing you to pipe it into the auto-completion file appropriate for your shell.
phantomlink generate <shell>
phantomlink setup
phantomlink start ~/Downloads/input.csv
phantomlink exec server iperf3 -s --port 5000
phantomlink exec client iperf3 -c 192.168.66.2 --port 5000
phantomlink exec <client/server> ifconfig
phantomlink teardown
phantomlinkphantomlink runs on scenario filesโsimple .csv files that contain the (time-evolving) parameters of the virtual end-to-end link. This format is motivated by the actual physical variability that an end-to-end connection can be exposed to.
Scenario files define the behavior of the virtual link over time, with parameters such as delay and data rate evolving throughout the experiment.
The RouteID column indicates whether there is an actual route change or only updated parameters for the current route.
phantomlink is agnostic of how the scenario file was created and whether the values are realistic. Users can create hand-crafted, synthetic scenarios or use output from any (orbital) dynamics simulator to perform systematic.
Parameters are updated at specified times, creating a step function of changes. For example given the following table:
| Time [ms] | RouteID | Delay [ms] | Btldr [Mbps] |
|---|---|---|---|
| 0 | 0 | 41.0 | 80.0 |
| 11 000 | 0 | 41.2 | 80.2 |
| 23 000 | 1 | 37.0 | 100.0 |
| 40 000 | 1 | 36.7 | 101.5 |
| 60 000 | 1 | 37.0 | 100.1 |
t = 0 ms, a route with a one-way delay of 41.0 ms and a data rate of 80.0 Mbit/s is used.t = 11 s, values are updated to 41.2 ms and 80.2 Mbit/s.t = 23 s, the route changes, as indicated by a new RouteID.
At its core, the phantomlink toolchain has a binary that operates in conjunction with Linux network namespaces and virtual Ethernet devices.
The toolchain architecture consists of three network namespaces created with netns:
The client and server namespaces are interconnected with the PhantomLink namespace using two virtual Ethernet devices, resulting in four virtual interfaces. For each virtual Ethernet device:
sim-veth)veth)After moving the interfaces, MAC and IP addresses are assigned. For each namespace except for the PhantomLink namespace:
veth is configured as the default route to enable traffic flow towards phantomlinkTo allow traffic to flow from the client to the server namespace and vice-versa, the phantomlink binary forwards packets between the two (sim-veth) interfaces. This enables applications in the client or server namespace to send and receive traffic over the emulated virtual end-to-end link that evolves according to the scenario file.
The phantomlink binary is implemented in safe Rust to benefit from Rustโs performance and memory safety. The internal binary structure is depicted in the picture above.
Namespace and Raw Sockets:
phantomlink is started in the PhantomLink namespace.sim-veth1 and sim-veth2 each.libpnet crate:
libpnet, phantomlink creates a pnet::datalink::Channel for each interface.phantomlink to send and receive at the data link layer.OnewayVirtualLink:
OnewayVirtualLink and forwarded to the server.OnewayVirtualLink instance handles all traffic from the server to the client.The functionality and role of each individual component is explained in the paper.
Don't hesitate to file an issue or contact one of the authors!
Please have a look at the issues or open one if you feel that something is needed.
Any contributions are very welcome!
Phantomlink is dual-licensed under Apache License, Version 2.0 or MIT License.
This project has received funding from the European Unionโs Horizon 2020 research and innovation programme under the Marie Skลodowska-Curie grant agreement No 101008233 (MISSION).
We look forward to any kind of contributions!
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual-licensed as above, without any additional terms or conditions.
Robin Ohs ๐ป ๐ ๐ค ๐ง ๐ฌ |
Gregory ๐ป ๐ ๐ค ๐ฌ |
Andreas Schmidt ๐ป ๐จ ๐ ๐ค ๐ฌ ๐งโ๐ซ |
This project follows the all-contributors specification. Contributions of any kind are welcome ๐.