Quick start
In about ten minutes you will pull a Debian image, write a one-VM lab, start it, log in over SSH and on the serial console, and clean up. It assumes vz is installed.
1. Pull an image
vz image pull debian-13vz downloads the official Debian 13 cloud disk, checks it against Debian's published checksums and unpacks it to ~/.vz/images/debian-13-genericcloud-arm64.raw. It then prints the lines to put in a lab file. You only do this once: every lab and every node can boot from the same image, because each node writes to its own copy-on-write overlay.
vz image ls shows every image vz can pull. See Images.
2. Write a lab
Make a folder for the lab with a place for the VM's cloud-init files:
mkdir -p hello/init/vm1
cd helloCreate lab.yaml:
# yaml-language-server: $schema=https://raw.githubusercontent.com/rayanparsa/vz/refs/heads/main/schema/27.json
schemaVersion: 27
name: hello
nodes:
- name: vm1
cpus: 2
memory: 2GiB
consoleLog: true
disks:
- { path: ~/.vz/images/debian-13-genericcloud-arm64.raw, overlay: true }
init: ./init/vm1
interfaces:
- { name: mgmt, attach: switch/lan, mac: "52:54:00:30:01:00" }
switches:
lan:
nat4: true
ipv4Subnet: 10.30.0.0/24
dhcpReservations:
- { mac: "52:54:00:30:01:00", ipv4: 10.30.0.11 }Create init/vm1/user-data. It makes a user lab with password lab:
#cloud-config
users:
- name: lab
shell: /bin/bash
sudo: ALL=(ALL) NOPASSWD:ALL
lock_passwd: false
chpasswd:
expire: false
users:
- { name: lab, password: lab, type: text }
ssh_pwauth: trueCreate init/vm1/network-config. It names the NIC mgmt and asks for DHCP with the MAC as the client id, so the reservation above applies:
version: 2
ethernets:
mgmt:
match: { macaddress: "52:54:00:30:01:00" }
set-name: mgmt
dhcp4: true
dhcp-identifier: macCAUTION
A fixed password is fine for a lab on your own Mac. Do not reuse it for anything reachable from other machines. See cloud-init for SSH keys.
What do these keys mean?
| Key | Meaning |
|---|---|
disks / overlay: true | Boot from the pulled file, read-only; writes go to a private overlay |
init: ./init/vm1 | Folder turned into a cloud-init seed disk (user-data, network-config) |
interfaces | One NIC, plugged into the switch lan, with a fixed MAC |
switches.lan | A vmnet network with NAT to the internet; the Mac is 10.30.0.1 on it |
dhcpReservations | Optional. The DHCP server always gives this MAC 10.30.0.11, so you know the address before vz up. Without it the VM still gets one from the pool |
Every key is in the lab file reference.
3. Validate
vz validateIt reports that lab hello is valid, with 1 node, 1 switch and 0 links. validate checks the file against the schema and many rules that a schema cannot express (unknown switches, overlapping subnets, reservations without a matching NIC, ...) and reports every problem at once, each with its place in the file. vz up runs the same checks and refuses to start a lab with errors, so you can skip this step, but it is the quickest way to find mistakes.
4. Start the lab
vz upvz starts a background process that owns the lab, creates the switch, builds the overlay and the cloud-init seed, boots the VM and returns once it is running. Closing the terminal does not stop the lab.
vz node lsFor each node it prints a heading with its state, CPUs and memory, and a table of its NICs:
| NIC | MAC | Attach | Plug | Address |
|---|---|---|---|---|
| mgmt | 52:54:00:30:01:00 | switch/lan | up | 10.30.0.11 |
NOTE
"Running" means the VM is powered on, not that the guest has finished booting. The first boot runs cloud-init and takes a minute or so. node ls shows a reserved address at once; SSH answers when the guest has booted.
5. Log in
Over SSH, from your Mac:
ssh lab@10.30.0.11 # password: labOn the serial console:
vz node console vm1A new Terminal window opens with the VM's console. Every key goes to the VM; to detach, close the window. The VM keeps running. Because the lab sets consoleLog: true, the whole boot is also saved:
vz node logs vm16. Play with it
vz node pause vm1 # freeze the VM; SSH hangs
vz node resume vm1
vz port down vm1/mgmt # unplug its network cable
vz port up vm1/mgmt
vz topology # switches, links and what is plugged where7. Clean up
vz down # shut the VM down (ACPI), end the background processThe overlay keeps everything you changed in the VM, so the next vz up continues where you left off. To start fresh instead:
vz node reset vm1 --yes # discard the overlay and UEFI variables: clean disk next time
vz destroy --yes # or delete the whole state directory of the labThe pulled image in ~/.vz/images is never modified by either command.
What just happened
Concepts explains each piece.
Shortcuts
vz initwrites a one-node starterlab.yamlin the current folder. It has no cloud-init seed, so addinit:before you expect to log in.vz init --example 01copies a whole example lab (lab file, README and cloud-init files) into the current folder. Use a number or a name:--example ospf-triangle. There are 32 of them in examples/.-f other.yamlpoints a command at a lab file that is not./lab.yaml. It goes after the command:vz up -f other.yaml,vz node ls -f other.yaml.