From a128c9012c1fd98b67aa8c1bfb7bc04823591d8b Mon Sep 17 00:00:00 2001 From: Dipesh Tharu Mahato Date: Sun, 22 Feb 2026 22:17:56 +0000 Subject: [PATCH] fix(network): TAP networking sysctl and prefix length --- src/nightshift/vm/network.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/nightshift/vm/network.py b/src/nightshift/vm/network.py index 9cf4244..e3b31a6 100644 --- a/src/nightshift/vm/network.py +++ b/src/nightshift/vm/network.py @@ -95,11 +95,14 @@ async def create_tap(vm_id: str) -> TapConfig: tap_name = f"tap-{vm_id[:8]}" host_ip = f"172.16.{vm_index}.1" guest_ip = f"172.16.{vm_index}.2" - mask = "255.255.255.252" # /30 in dotted decimal for kernel ip= boot arg + # Keep dotted netmask for Firecracker kernel boot arg ip=... (see vm/manager.py). + mask = "255.255.255.252" + # iproute2 expects prefix length notation, not dotted netmask. + prefix_len = "30" # Create TAP device await _run(f"ip tuntap add dev {tap_name} mode tap") - await _run(f"ip addr add {host_ip}/{mask} dev {tap_name}") + await _run(f"ip addr add {host_ip}/{prefix_len} dev {tap_name}") await _run(f"ip link set {tap_name} up") # Enable IP forwarding