Hull is a simple utility tool that simplifies creating and managing virtual networks using Open vSwitch.
- rust
- ovs-vsctl, ovs-ofctl
- ip
- ping
- Clone this repository:
git clone https://github.com/henrybarreto/hull- Install the CLI tool using Cargo:
cargo install --path .- Test it:
hull --versionHull determines its on-disk layout and configuration file location from the following sources (in precedence order):
- CLI
--config <path>argument (highest precedence) HULL_PATHenvironment variable (root directory for Hull data)- XDG data directory & defaults described below
Environment variables supported by the codebase:
HULL_PATH— root directory used for images, instances, locks and the defaulthull.yaml. Resolution order when this is not set:$XDG_DATA_HOME/hullifXDG_DATA_HOMEis set/var/lib/hullwhen running as root$HOME/.local/share/hullfor a regular user
The configuration file loaded is either the path passed via --config or
{HULL_PATH}/hull.yaml (or the default root described above). Use
HULL_PATH to keep Hull data in a custom workspace, or pass --config to load
an explicit YAML file.
- Initialize hull project:
sudo hull init- Create a network switch:
sudo hull switch create sw0 10.0.0.0 24- Create a network interface:
sudo hull interface create tap0- Add a port to the switch:
sudo hull switch port create port0 sw0 tap0- Create a router:
sudo hull router create router0- Attach the switch to the router:
sudo hull router attach router0 sw0- Start a VM with the created network interface:
qemu-system-x86_64 \
-enable-kvm \
-m 1G \
-cpu host \
-drive file=overlay.qcow2,format=qcow2 \
-drive file=seed.iso,format=raw \
-nic tap,ifname=tap0,script=no,downscript=no,mac=<tap0-mac> \
-nographicNow, every VM connected to sw0 can communicate with each other and the router.
You can further configure the router to enable external connectivity by setting
a link interface.
This project is licensed under the MIT License. See the LICENSE file for details.