Hyper.Node.FireVMM.Net (Hyper v0.1.0)

Copy Markdown View Source

The per-VM inner-world networking contract. Every VM's netns is identical — tap0 at 172.30.0.1/30, guest at 172.30.0.2/30 — so a snapshot clone restores a correct network with zero renumbering; host-side uniqueness is the helper's job (see Hyper.SuidHelper.Network). This module owns the three values that must agree between the guest kernel cmdline, the Firecracker NIC config, and the helper: the guest MAC, the ip= autoconfig string, and the NIC spec.

Summary

Functions

Stable locally-administered unicast MAC for vm_id. Derived from a SHA-256 of the id so it is deterministic on any node (aids debugging); duplicate MACs are harmless since no two guests ever share an L2 segment (each is alone in its netns).

The Firecracker NIC spec for vm_id (guest eth0 bound to in-netns tap0).

Kernel ip= autoconfig fragment appended to every networked VM's cmdline.

Kernel hyper.resolver= cmdline fragment carrying the DNS resolver IP the PID-1 guest agent writes to /etc/resolv.conf — kernel ip= autoconfig sets the guest's address/route but never DNS, so this closes that gap. Pure: callers (BootSpec.resolve/2) read the configured resolver themselves.

Functions

guest_mac(vm_id)

@spec guest_mac(Hyper.Vm.Id.t()) :: String.t()

Stable locally-administered unicast MAC for vm_id. Derived from a SHA-256 of the id so it is deterministic on any node (aids debugging); duplicate MACs are harmless since no two guests ever share an L2 segment (each is alone in its netns).

interface(vm_id)

The Firecracker NIC spec for vm_id (guest eth0 bound to in-netns tap0).

ip_cmdline()

@spec ip_cmdline() :: String.t()

Kernel ip= autoconfig fragment appended to every networked VM's cmdline.

resolver_cmdline(resolver)

@spec resolver_cmdline(String.t()) :: String.t()

Kernel hyper.resolver= cmdline fragment carrying the DNS resolver IP the PID-1 guest agent writes to /etc/resolv.conf — kernel ip= autoconfig sets the guest's address/route but never DNS, so this closes that gap. Pure: callers (BootSpec.resolve/2) read the configured resolver themselves.