Skip to content

Repository files navigation

KIRA Implementation

This repository collects the different repositories used for the implementation of the scalable zero-touch routing architecture KIRA in Rust started by Moritz Hepp (2022) at the Institute of Telematics at KIT. This implementation supplies a routing daemon that provides IPv6 connectivity without configuration as well as a distributed hash table that can be used to provide a simple key-value store to map names to IPv6 addresses. The IPv6 addresses are currently randomly generated from the ULA address realm and are as such not routable on the Internet. As KIRA is designed to be a routing solution for control planes it deliberately uses ULAs for now.

Implementation Status

This implementation is in version 0.0.0 (pre-MVP) and therefore is still work-in-progress in many parts.

For a working example see DNS-DHT-Example.

Repo Structure

  • KIRA Routing Daemon: Contains the crate representing the routing daemon executable.
  • Sans-I/O R²/KAD: Contains the implementation of the routing protocol of KIRA, R²/KAD.
  • KIRA Library: Contains the different abstract modules, classes, traits to implement a complete routing daemon. Crucially this provides the i/o implementation of R²/KAD.
  • KIRA Forwarding: Contains the traits and implementations of the fast forwarding layer of KIRA.
  • Examples: Contains minimal examples of running KIRA in an emulated network using Containernet.

More specific information can be found in the respective folders and in the following chapters.

Documentation

The KIRA routing daemon is primarily implemented in Rust, leveraging the language's documentation capabilities through rustdoc. To generate and view the documentation for the respective packages, run:

make doc

Cloning the repository

To simply clone the repository use this:

git clone git@gitlab.kit.edu:kit/tm/telematics/kira/kira-rust.git

Tasks

Task Command Description
Build make build, cargo build Compiles the daemon with creates an executable
Build (release) make build-release, cargo build --release Compiles the daemon with release profile and creates an executable1
Build (docker) make build-images Compiles and builds provided docker images (no Rust install required)
Code Documentation make doc Generates and views the documentation of all Rust packages
Install Daemon make install Compiles the daemon with release profile and installs it system-wide
Uninstall Daemon make uninstall Removes the daemon installation from the system
Debian Package make pkg-debian-<TARGET> Build a Debian package for the target architecture2 (targets: x86_64, aarch64)

Dependencies

  • Rust: Build the daemon and documentation from source (not required for building the container images), a full Rust toolchain is recommended.
  • Docker: Run examples, build container images, cross compile Debian packages.
  • m4: Install daemon, build Debian packages.
  • dpkg-shlibdeps: Build Debian packages.

Runtime Dependencies

  • Userspace utilities of nftables: The daemon must have access to the nft utility to load the nftables.conf.

Running on physical hosts

To run the task on a physical host we recommend using the provided systemd-service files.

Installation

  1. make build-release: Build the release version of kirad
  2. sudo make install: install the daemon and its files to the system

If you're on a Debian-based system (dpkg), you can also build and install the Debian package of your architecture (example on x86_64):

make pkg-debian-x86_64
sudo apt-get install target/x86_64-unknown-linux-musl/debian/kirad_0.1.0-1_amd64.deb

Manage All Interfaces

systemctl enable --now kirad.service

Manage Some Interfaces

Currently, you can only blacklist interfaces using the kirad@.service by using the numbers of the interfaces:

systemctl enable --now kirad@$(systemd-escape 4,2).service

This will exclude the interface 4 and 2 interface from being managed by the routing daemon. You can obtain a list of all your interfaces by running ip link.

Development

You should install the following additional dependencies for development:

  • pre-commit: Catch invalid commits that would be flagged later by GitLab's CI.
  • Clippy: Catch common mistakes in Rust code.
  • Nightly rustfmt: make sure your Rust code conforms the set style guide.
  • rust-analyzer: Language server for your favorite IDE (optional).

If you want to contribute to the Python-based emulation powered by NeST at kira-test, you should additionally install the used project manager uv.

Testing

You should test your changes before submitting any changes. Write Rust unit tests and run them using:

cargo test --workspace

Additionally, you can test the kirad in network emulation scenarios interactively using the nesttest REPL or run automatic tests on the provided topology:

uv --project=./tests/kira-test run nesttest tests/topos/minimal.gml
KIRA_TOPOS="tests/topos/minimal.gml" uv --project=tests/kira-test run pytest

Since the size of the emulated topologies is rather small, you should probably build kirad with the small_buckets feature to store less contacts per bucket of the routing table. Pytest is doing this automatically but for nesttest you have to build a binary manually:

cargo build --features=small_buckets

More information on the Python-based emulation can be found at kira-test.

Footnotes

  1. The executable can be found at target/release/kirad

  2. <TARGET>-unknown-linux-musl, cross compilation is done using cargo-cross and requires Docker or Podman.

About

Implementation of KIRA (Kademlia-directed ID-based Routing Architecture) in Rust

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages