Skip to content

Host Network Commands

Inspect, install, repair, and remove the fixed-IP network that lets Linux nodes reach each other.

Every Linux node gets two NICs: one reaches the Internet through QEMU’s built-in NAT, and one sits on a fixed /24 where the host and the other nodes reach it at the address your inventory names (why two NICs). These commands manage the host side of that second network, socket_vmnet on macOS and the barn0 bridge on Linux. barn setup and the first interactive barn up install it for you (host preparation); use these commands to check, repair, reconfigure, or remove it.

One network serves all Linux guests on the host; native Mac VMs have their own. install and uninstall print a privileged plan first and, on a terminal, ask before applying it. Without a terminal, or with --json or --yaml, they only print the plan; --yes applies it without asking, though sudo may still want a password.

barn network also answers to n and net. Every command accepts the global options; Available in shows availability from the 1.1.0 baseline onward (version baseline).

barn network status

barn network status [flags]

Show the backend, installed CIDR, ownership, health, and the preflight findings that lifecycle commands check before changing anything. It is read-only. --cidr checks against an expected subnet; without it, status inspects the installed one. For partial or invalid results, see troubleshooting.

On Linux, 1.5.0 checks KVM access, bridge prerequisites and the configured private network. Run barn doctor for the full QEMU capability check.

Aliases: st.

OptionMeaning / defaultAvailable in
-c, --cidr stringOptional expected private /24; otherwise inspect the installed subnet1.1.0
barn network status
barn --json network status --cidr 10.10.10.0/24

barn network install

barn network install [flags]

Install or repair the backend for --cidr: socket_vmnet on macOS in host or shared vmnet mode, or barn0 through the active Linux network manager, which accepts only host. An existing network must match the chosen subnet and mode, so check status before changing either.

On a fresh Mac, run barn setup instead. A first install needs a pinned socket_vmnet archive and a new vmnet interface UUID, which setup supplies; without both --archive and --interface-id, network install exits 3 with reason network_absent and suggests barn setup. Both flags are macOS-only.

Aliases: i.

OptionMeaning / defaultAvailable in
-a, --archive stringmacOS: pinned socket_vmnet archive1.1.0
-c, --cidr stringnetwork: an RFC1918 IPv4 /24 (default “10.10.10.0/24”)1.1.0
-i, --interface-id stringmacOS: persistent vmnet UUID1.1.0
-m, --mode stringmacOS vmnet mode: host or shared (default “host”)1.1.0
-y, --yesapply the displayed privileged plan without confirmation (sudo may still ask for a password)1.1.0
barn network install --json
barn network install --cidr 10.10.10.0/24 --yes

macOS Internet Sharing

Install and repair work while Internet Sharing is on, as long as its vmnet preferences set neither a custom subnet address nor a mask. If the preview cannot read those preferences, it says so, and Barn checks them after you approve, before writing network files or restarting socket_vmnet. A subnet that conflicts with a live interface, route, or node address blocks the plan at preview. Preferences that turn out unreadable, conflicting, or only half set stop the operation before the host changes.

barn network uninstall

barn network uninstall [flags]

Remove Barn-owned network configuration and restore the host settings recorded at install. Stop the Linux nodes first; uninstall refuses while any node is running. The terminal question, Remove the Barn network? [y/N], defaults to no. VM disks and native Mac VM networks stay in place.

Aliases: u.

OptionMeaning / defaultAvailable in
-y, --yesapply the displayed privileged plan without confirmation (sudo may still ask for a password)1.1.0
barn stop
barn network uninstall --json
barn network uninstall --yes

Implementation

The 1.5.0 status checks are in cmd/barn/command_network.go and internal/doctor/network.go.

Table reader