Lab file reference
A lab file (lab.yaml by default) describes one lab: its nodes (VMs), the switches and cables between them, and the disks they use. It describes infrastructure only. Nothing inside the guests is configured, except an optional cloud-init seed you provide. This page lists every key, its type, its default and its rules.
For a compact table of every field per object (node, disk, interface, link, switch, storage...), see the schema reference. It is generated from the JSON Schema.
TIP
Start from a working file: vz init writes a one-node lab, and vz init --example <n> copies one of the example labs. Run vz validate after every change.
Contents
File basics
- The file is YAML. Keys are case-sensitive.
- Unknown keys are errors, at every level. A typo such as
memroy:is reported with the list of allowed keys. - Optional keys that are left out take the defaults listed below.
vz validatechecks the file. The rules it applies are listed in Validation rules.
Editor support
The lab file has a JSON Schema. Its $id is https://raw.githubusercontent.com/rayanparsa/vz/refs/heads/main/schema/27.json, and the starter file and examples begin with a modeline for editors that use the YAML language server:
# yaml-language-server: $schema=https://raw.githubusercontent.com/rayanparsa/vz/refs/heads/main/schema/27.jsonA local copy always works, whatever the network says:
vz schema > lab.schema.json# yaml-language-server: $schema=./lab.schema.jsonNOTE
The schema checks the shape of the file. vz validate checks more: references between sections, link ends, subnet overlap, DHCP reservations and so on. Use both, or just vz validate.
Paths
Every path in the lab file (state, disk and storage path, init, share path) is resolved the same way:
| Written as | Means |
|---|---|
/abs/path | That absolute path. |
~ or ~/path | Your home folder. ~user is not supported. |
| anything else | Relative to the folder that holds the lab file, not the current folder. |
Top level
schemaVersion: 27
name: my-lab
state: ./.vz-state
storages: {}
nodes: []
links: {}
switches: {}| Key | Type | Default | Notes |
|---|---|---|---|
schemaVersion | integer | required | Must be 27: the lab file format for macOS 27, matching schema/27.json. |
name | name | required | Lab name. Used for stable MAC addresses, the cloud-init instance-id, the default state directory and vz ls. Keep it unique among labs you run at the same time. |
state | string | ~/.vz/state/<name> | State directory: overlays, UEFI variables, console logs, seeds, control socket. Relative to the lab file. Must not be empty. --state on the command line overrides it. Two labs must never share a state directory. |
storages | map of storage | {} | Named disks that nodes can share. |
nodes | list of node | required | The VMs. An empty list is allowed but warned about. |
links | map of link | {} | Point-to-point cables. |
switches | map of switch | {} | Virtual switches. |
The keys of storages, links and switches are their names and follow the name rules.
storages
A storage is a named disk file that several nodes can refer to with storage: <name> instead of path:.
storages:
reference: { path: reference.asif, size: 1GiB }| Key | Type | Default | Notes |
|---|---|---|---|
path | string | required | Disk file. The format comes from the extension: .asif, .raw, .img, .iso or .ipsw. |
size | size | none | Used to create the file when it is missing. Not allowed for .iso or .ipsw. |
A writable storage (used without readOnly or overlay) must not be used by two running nodes at the same time. vz warns when more than one node writes to it.
nodes
Each item is one VM. The node describes hardware; platform picks the machine type. On the default generic platform a node boots with UEFI on Apple's generic Arm machine, from the files under disks, and has a serial console. On apple it is a macOS guest: Mac graphics, no serial console, and the first start installs macOS from the .ipsw listed under disks. These are always present and have no keys: an entropy device and a memory balloon.
nodes:
- name: vm1
cpus: 2
memory: 2GiB
disks:
- { path: ~/.vz/images/debian-13-genericcloud-arm64.raw, overlay: true }
init: ./init/vm1
interfaces:
- { name: eth0, attach: switch/lan }| Key | Type | Default | Notes |
|---|---|---|---|
name | name | required | Unique within the lab. Also the hostname vz gives cloud-init. |
platform | generic, apple | generic | The machine type. See platforms. |
cpus | integer | 1 | At least 1, at most what this Mac allows. |
memory | size | 1GiB | A non-zero multiple of 1MiB. vz node memory can lower it at runtime with the balloon. |
nestedVirtualization | boolean | false | Lets the guest run its own VMs (/dev/kvm). Needs an M3 or newer Mac. Validation warns on older Macs; vz up fails there. generic only. |
secureBoot | boolean | false | UEFI Secure Boot with the default signatures enrolled. Only signed boot loaders and kernels boot. generic only. |
rosetta | boolean | false | Share Rosetta with the guest as a VirtioFS share with tag rosetta, to run x86_64 Linux binaries. Needs Rosetta on the Mac: softwareupdate --install-rosetta. generic only. |
consoleLog | boolean | false | Also write the serial console to <state>/<node>/console-<yyyyMMdd-HHmmss>.log. A new file starts each time vz up starts the node; a reboot inside the guest or vz node restart keeps writing to the same file. Read it with vz node logs. |
disks | list of disk | required | At least one. Boot order: UEFI boots from the first bootable disk. |
init | string | none | First-boot data: a user-data file, or a folder. The platform decides how it is applied. See below. |
shares | list of share | [] | Mac folders in the guest (VirtioFS). |
displays | list of display | one 1280x800 display | Graphics. [] turns graphics off. |
clipboard | boolean | false | Shared clipboard. Needs a display and a SPICE agent in the guest. generic only. |
sound | sound | none | Audio output and input. |
usb | list of USB device | [] | Host USB devices passed through at boot. |
interfaces | list of interface | [] | NICs. |
platform
Virtualization offers two machine types, and platform picks one. Everything that differs between them lives in that platform's code; the other node keys describe hardware and mean the same on both.
platform | Machine | Boots | Console | init |
|---|---|---|---|---|
generic (default) | Apple's generic Arm machine with UEFI | whatever the disks hold: a pulled Linux image, an installer ISO, your own disk | virtio serial (vz node console) | a cloud-init NoCloud seed disk |
apple | Apple's Mac machine | macOS, installed from the .ipsw under disks on the first start | none: use vz node display or SSH | read by vz on the Mac: the account macOS creates |
An apple node:
- name: mac1
platform: apple
cpus: 4
memory: 8GiB
init: ./init/mac1/user-data
disks:
- { path: ~/.vz/images/macos-arm64.ipsw } # installer media: read, never attached
- { path: macos.asif, size: 80GiB } # macOS installs hereRules for apple (checked by vz validate):
- List one
.ipswrestore image underdisks. It is read by the installer and never attached to the VM; it keeps its index, so other disks keep theirs. Once macOS is installed, the node also starts without it. - macOS installs onto the first disk that is not a
.ipsw. It must be writable and must not useoverlay, for example{ path: macos.asif, size: 80GiB }. rosetta,nestedVirtualization,secureBootandclipboardare errors.displays: []is an error: the installer and the login window need a screen.consoleLogis a warning: macOS writes nothing there.- One Mac runs at most 2
applenodes at a time. - It is experimental: every
applenode gets a warning until a full install has been tested.
A .ipsw under disks on a generic node is an error.
init
init is first-boot data. Its path is relative to the lab file. The platform decides how it is used.
On generic, init points at a cloud-init seed. vz packs it into a read-only ISO labelled cidata (the NoCloud data source) and attaches it after all other disks, where cloud-init in the guest finds it. The seed is rebuilt each time vz up starts the node, so edits to the seed files are picked up then.
init is | vz does |
|---|---|
| a file | Uses it as user-data and writes meta-data with instance-id: <lab>-<node> and local-hostname: <node>. |
| a folder | Copies user-data (required), meta-data, network-config and vendor-data if present. Other files are ignored. Without meta-data, it writes the one above. |
See cloud-init for working seeds.
On apple, init is the same kind of #cloud-config user-data file (or a folder holding user-data), but vz reads it on the Mac. macOS has no cloud-init; Apple's provisioning creates one account on the first boot after the install (macOS 27 guests):
#cloud-config
users:
- { name: lab, gecos: Lab User, plain_text_passwd: lab }
ssh_pwauth: true| cloud-config | macOS |
|---|---|
first entry of users: name | the account's user name |
plain_text_passwd, or a type: text password for that name under chpasswd.users | its password (required) |
gecos | the full name on the login window (default: the user name) |
ssh_pwauth | Remote Login (SSH): on unless it is false |
Anything else (more users, packages, runcmd, other user keys) is ignored with a warning from vz validate. The file must start with #cloud-config. Without init, macOS runs Setup Assistant on the display. Changing init later needs vz node reset, since the account is only created on the first boot.
disks
disks:
- { path: ~/.vz/images/debian-13-genericcloud-arm64.raw, overlay: true, size: 24GiB }
- { storage: reference, readOnly: true }
- { bus: nvme, path: scratch.asif, size: 2GiB }
- { bus: usb, path: usb-stick.asif, size: 1GiB, connected: false }| Key | Type | Default | Notes |
|---|---|---|---|
bus | virtio, nvme, usb | virtio | virtio: a virtio block device, /dev/vdX in Linux. nvme: an NVMe controller, /dev/nvmeXn1. usb: a USB mass storage device that can be ejected and inserted at runtime. |
path | string | Disk file. Set exactly one of path and storage. Format from the extension: .asif, .raw, .img (raw), .iso, or .ipsw (a macOS restore image for platform: apple, read by the installer and never attached). | |
storage | string | Name of an entry in storages. | |
size | size | 10GiB with overlay, none otherwise | See disk sizes. Not allowed with storage (put it on the storage) or on an .iso or .ipsw. |
readOnly | boolean | false | Attach read-only. ISO files are always read-only; add readOnly: true to say so. |
overlay | boolean | false | Copy on write (not on a .ipsw): the file stays an untouched read-only base and the node's writes go to <state>/<node>/disk<N>.overlay.asif. This is how cloud images are used. vz node reset throws the overlay away. |
cache | boolean | false | Add a cache layer (disk<N>.cache.asif) between the base and the overlay, for bases on slow storage such as a NAS. Needs overlay: true. |
caching | automatic, cached, uncached | automatic | Host caching mode of the disk image. |
sync | full, fsync, none | full | How guest flushes reach the Mac's storage. none is fastest and can lose data if the Mac crashes. |
connected | boolean | true | USB disks only: inserted at boot. false starts the disk ejected; insert it with vz media insert <node>/<index>. |
<N> and <index> are the disk's position in the list, starting at 0.
Disk sizes
| Disk | size means |
|---|---|
path, no overlay, file missing | Create the file at this size: a sparse raw file for .raw/.img, an empty ASIF image for .asif. An existing file is used as it is. |
path, no overlay, file missing, no size | Error at vz up: disk file not found. |
overlay: true | The size the guest sees. Default: 10GiB, or the base image size if that is larger, because a cloud image (3GiB for Debian) is full after the first package install. The extra space costs nothing on the Mac until the guest writes to it. An explicit size must be at least the base image size. Raise it later to grow the disk; it can never shrink (use vz node reset to start over). Without size, an overlay that is already larger keeps its size. The guest grows its partition itself, for example with cloud-init's growpart. The base file must exist. |
readOnly: true | Still creates a missing file, but vz warns, since size only creates missing files or grows overlays. |
WARNING
A writable disk without overlay changes the file itself. If two nodes write to the same file, or the same writable storage, do not run them at the same time. vz warns about this.
IMPORTANT
If you pull a base image again (vz image pull --force), overlays made from the old file no longer match it. Run vz node reset for the nodes that use it.
shares
VirtioFS shares: one Mac folder per item.
shares:
- { tag: site, path: ./site, readOnly: true }
- { tag: drop, path: ./drop }| Key | Type | Default | Notes |
|---|---|---|---|
tag | string | required | The name the guest mounts: mount -t virtiofs <tag> <dir>. 1 to 36 characters: letters, digits, ., _, -, starting with a letter or digit. Unique per node. rosetta is reserved. |
path | string | required | The folder on the Mac. It must exist when the node starts. |
readOnly | boolean | false | The guest cannot write. |
displays, clipboard, sound
displays: [{ width: 1920, height: 1080 }]
clipboard: true
sound: { output: true, input: false }| Key | Type | Default | Notes |
|---|---|---|---|
displays[].width | integer | required | 320 to 8192 pixels. |
displays[].height | integer | required | 200 to 8192 pixels. |
clipboard | boolean | false | Clipboard sharing through the SPICE agent port. Needs at least one display, and spice-vdagent in the guest. |
sound.output | boolean | false | Guest audio plays on the Mac's default output. |
sound.input | boolean | false | The Mac's default input (microphone) is the guest's input. |
- Each display is one scanout of a virtio graphics device: 2D only, no GPU acceleration. A display also adds a USB keyboard and pointer. Open it with
vz node display <node>. Anapplenode uses Mac graphics, a Mac keyboard and a trackpad instead, and opens the same way. - Without the
displayskey a node gets one 1280x800 display, sonode displayworks without planning ahead.displays: []turns graphics off. - Some images have no graphics driver. The
debian-13cloud kernel has none; usedebian-13-genericfor a desktop. soundwith bothoutputandinputfalse adds nothing, and vz warns.
usb
Host USB devices given to the node at boot.
usb:
- { vendorId: 0x0403, productId: 0x6001 }| Key | Type | Notes |
|---|---|---|
vendorId | USB id | Required. A YAML integer (0x0403 or 1027) or a quoted hex string with exactly four digits ("0x0403"). |
productId | USB id | Required. Same format. |
The device must be plugged in when the node starts. A listed device also gives the node a USB controller, so vz usb attach works later. Listing the same device twice is warned about.
WARNING
USB passthrough uses Accessory Access on macOS 27 and needs a vz signed with a Developer ID and the com.apple.developer.accessory-access.usb entitlement. Ad-hoc signed builds (make build, the release tarball) cannot claim USB accessories. Isochronous devices such as webcams and USB audio are not expected to work.
interfaces
NICs, as virtio network devices. List order is PCI order in the guest.
interfaces:
- { name: mgmt, attach: switch/mgmt, mac: "52:54:00:01:01:00" }
- { name: p2p, attach: link/a-b }
- { name: spare, attach: switch/mgmt, connected: false }
- { name: unused }| Key | Type | Default | Notes |
|---|---|---|---|
name | string | required | A label for vz (vz port up r1/eth1). It is not pushed into the guest; name the NIC in the guest with cloud-init's network-config (match by MAC). 1 to 15 characters: letters, digits, ., _, -, starting with a letter. Unique per node. |
attach | string | none | What the NIC is plugged into: switch/<name> or link/<name>. Without it the NIC is free (present but not connected to anything). |
mac | MAC | derived | See MAC addresses. Quote it in YAML. Must be unicast and unique in the lab. |
connected | boolean | true | Whether the cable is plugged in at boot. Toggle it at runtime with vz port up/down. Not allowed on a free NIC. |
NOTE
vmnet documents a limit of 4 switch interfaces per VM and 32 in total. vz warns above those numbers but does not stop you. Links are not limited.
links
A link is a point-to-point cable between exactly two NICs on two different nodes. It is a Unix datagram socket pair inside the Mac's kernel: frames pass unchanged, no vz code is in the path and the Mac is not a member.
links:
a-b: {}
core: { mtu: 9000 }| Key | Type | Default | Notes |
|---|---|---|---|
mtu | integer | 1500 | 1280 to 65535. Applied to both ends. Set the same MTU inside the guests. |
buffer | size | 4MiB | Advanced: socket send buffer of each end; the receive buffer is twice this. vz warns outside 1MiB to 256MiB. |
Two interfaces refer to a link with attach: link/<name>. Unplug both ends with vz link down <name>.
switches
A switch is a vmnet network. The Mac is always a member and gets the first address of the subnet. With nat4 or nat6 the switch is in shared mode (NAT to the internet); with neither it is in host mode (VMs and the Mac only).
switches:
mgmt:
nat4: true
ipv4Subnet: 10.101.0.0/24
dhcpReservations:
- { mac: "52:54:00:01:01:00", ipv4: 10.101.0.11 }
portForwarding:
- { protocol: tcp, hostPort: 2222, address: 10.101.0.11, guestPort: 22 }
lab:
ipv4Subnet: 10.101.1.0/24| Key | Type | Default | Notes |
|---|---|---|---|
nat4 | boolean | false | IPv4 NAT to the internet. |
nat6 | boolean | false | IPv6 NAT to the internet. |
ipv4Subnet | IPv4 CIDR | chosen by vmnet | For example 10.30.0.0/24. /30 or larger. The Mac gets the first host address (.1 in a /24). Must not overlap another switch of this lab. Host bits are cleared, with a warning. |
ipv6Prefix | IPv6 prefix | chosen by vmnet | For example fd00:10:1::/64. |
mtu | integer | 1500 | 1280 to 65535. |
dhcp | boolean | true | The built-in DHCP server (IPv4). |
dhcpReservations | list | [] | Optional fixed IPv4 addresses by MAC. Without them, guests get addresses from the DHCP pool. Needs dhcp: true. |
dnsProxy | boolean | true | The built-in DNS proxy. |
routerAdvertisement | boolean | true | IPv6 router advertisements (SLAAC). |
portForwarding | list | [] | Mac ports forwarded to guests. Needs nat4 or nat6. |
TIP
Without ipv4Subnet, vmnet picks a subnet, so addresses can change between runs and two labs can collide. Set a subnet and DHCP reservations when you want stable addresses.
dhcpReservations
Optional. A NIC without a reservation still gets an address from the switch's DHCP pool; reserve one when commands or other nodes need to know the address in advance.
| Key | Type | Notes |
|---|---|---|
mac | MAC | Required. Must be the mac of an interface attached to this switch, so set the same mac on the interface. Each MAC once per switch. |
ipv4 | IPv4 address | Required. Inside ipv4Subnet; not the network, broadcast or Mac (first host) address. Each address once per switch. |
The guest gets the reserved address only if its DHCP client identifies itself by MAC. Some guests send a DUID instead (Debian, for example); in cloud-init network-config, set dhcp-identifier: mac. vz node ls warns when a guest ignores its reservation.
portForwarding
| Key | Type | Default | Notes |
|---|---|---|---|
protocol | tcp, udp | required | |
family | ipv4, ipv6 | from address | An address with : is IPv6. IPv4 rules need nat4: true, IPv6 rules need nat6: true. |
hostPort | integer | required | 1 to 65535. Each protocol, family and port only once across the lab. |
address | IP address | required | The guest's address on this switch. Inside ipv4Subnet when set. Give it a DHCP reservation, or vz warns that no node is guaranteed to have it. |
guestPort | integer | required | 1 to 65535. |
vmnet's own forwarding is not reachable on the Mac's loopback interface, so for TCP rules vz also listens on 127.0.0.1 and ::1 and relays to the guest. That is why ssh -p 2222 lab@localhost works. If the localhost port is already taken, vz logs it and leaves that address to vmnet. UDP rules are handled by vmnet only.
Value formats
Names
| What | Pattern | Example |
|---|---|---|
| Lab, node, storage, link, switch | lowercase letter, then lowercase letters, digits, -; up to 63 characters | leaf1, site-a |
| Interface | letter, then letters, digits, ., _, -; up to 15 characters | eth0, mgmt, bond0.10 |
| Share tag | letter or digit, then letters, digits, ., _, -; up to 36 characters | site |
| Image | optional disk/ or iso/, then lowercase letters, digits, -, . starting with a letter or digit | debian-13, iso/debian-13, ubuntu-26.04 |
Sizes
A whole number followed by a binary unit: B, KiB, MiB, GiB or TiB. For example 512MiB, 2GiB, 4096B. No spaces, no decimals, and no decimal units such as MB or GB.
Addresses
| Type | Format | Example |
|---|---|---|
| MAC | six pairs of hex digits with : (case does not matter). Quote it. | "52:54:00:0a:00:01" |
| IPv4 address | dotted quad | 10.30.0.11 |
| IPv4 CIDR | address / 0 to 32 | 10.30.0.0/24 |
| IPv6 prefix | IPv6 address / 0 to 128 | fd00:10:1::/64 |
MAC addresses
A NIC without mac gets a stable, locally administered unicast address: 02: followed by five bytes of a 64-bit FNV-1a hash of <lab>/<node>/<interface>. The same names give the same MAC on every Mac and every run. Renaming the lab, the node or the interface changes the MAC. vz topology shows the MAC of every port.
Set mac yourself when something else must know it in advance, such as a DHCP reservation or a network-config match.
Full example
An annotated lab that uses most keys
# yaml-language-server: $schema=https://raw.githubusercontent.com/rayanparsa/vz/refs/heads/main/schema/27.json
schemaVersion: 27 # the macOS release the format is for
name: demo # lowercase, digits, '-'
# state: ./.state # default: ~/.vz/state/demo
storages:
reference: { path: reference.asif, size: 1GiB } # created on first use
nodes:
- name: r1
cpus: 1
memory: 1GiB
consoleLog: true # vz node logs r1
displays: [] # cloud kernel: no graphics driver anyway
disks:
# Pulled with: vz image pull disk debian-13
# Base file stays untouched; writes go to the overlay in the state directory.
- { path: ~/.vz/images/debian-13-genericcloud-arm64.raw, overlay: true, size: 32GiB } # default 10GiB
- { storage: reference, readOnly: true } # shared, read-only
init: ./init/r1 # user-data, network-config, ...
interfaces:
- { name: mgmt, attach: switch/mgmt, mac: "52:54:00:99:01:00" }
- { name: p2p, attach: link/r1-r2 } # MAC derived from demo/r1/p2p
- name: r2
disks:
- { path: ~/.vz/images/debian-13-genericcloud-arm64.raw, overlay: true }
- { bus: usb, path: stick.asif, size: 1GiB, connected: false } # vz media insert r2/1
init: ./init/r2
interfaces:
- { name: mgmt, attach: switch/mgmt, mac: "52:54:00:99:02:00" }
- { name: p2p, attach: link/r1-r2 }
- { name: lab, attach: switch/lab, connected: false } # vz port up r2/lab
- name: desk
cpus: 2
memory: 2GiB
displays: [{ width: 1920, height: 1080 }] # vz node display desk
clipboard: true # needs spice-vdagent in the guest
sound: { output: true }
shares:
- { tag: work, path: ./work } # mount -t virtiofs work /mnt
disks:
- { path: ~/.vz/images/debian-13-generic-arm64.raw, overlay: true, size: 24GiB } # full kernel: displays work
init: ./init/desk
interfaces:
- { name: mgmt, attach: switch/mgmt, mac: "52:54:00:99:03:00" }
links:
r1-r2: { mtu: 9000 } # exactly two ends, on two different nodes
switches:
mgmt:
nat4: true # shared mode: NAT to the internet
ipv4Subnet: 10.199.0.0/24 # the Mac is 10.199.0.1
dhcpReservations:
- { mac: "52:54:00:99:01:00", ipv4: 10.199.0.11 }
- { mac: "52:54:00:99:02:00", ipv4: 10.199.0.12 }
- { mac: "52:54:00:99:03:00", ipv4: 10.199.0.13 }
portForwarding:
- { protocol: tcp, hostPort: 2222, address: 10.199.0.11, guestPort: 22 }
lab: # no NAT: host mode, VMs and the Mac only
ipv4Subnet: 10.199.1.0/24
dhcp: false # addresses come from cloud-initSee also
- Validation rules
- CLI reference
- Files and environment
- Networking guide and Storage guide
- Example labs, especially 22 (node features) and 23 (switch features)