Skip to content

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 ​

bash
vz image pull debian-13

vz 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:

bash
mkdir -p hello/init/vm1
cd hello

Create lab.yaml:

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:

yaml
#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: true

Create 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:

yaml
version: 2
ethernets:
  mgmt:
    match: { macaddress: "52:54:00:30:01:00" }
    set-name: mgmt
    dhcp4: true
    dhcp-identifier: mac

CAUTION

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?
KeyMeaning
disks / overlay: trueBoot from the pulled file, read-only; writes go to a private overlay
init: ./init/vm1Folder turned into a cloud-init seed disk (user-data, network-config)
interfacesOne NIC, plugged into the switch lan, with a fixed MAC
switches.lanA vmnet network with NAT to the internet; the Mac is 10.30.0.1 on it
dhcpReservationsOptional. 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 ​

bash
vz validate

It 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 ​

bash
vz up

vz 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.

bash
vz node ls

For each node it prints a heading with its state, CPUs and memory, and a table of its NICs:

NICMACAttachPlugAddress
mgmt52:54:00:30:01:00switch/lanup10.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:

bash
ssh lab@10.30.0.11        # password: lab

On the serial console:

bash
vz node console vm1

A 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:

bash
vz node logs vm1

6. Play with it ​

bash
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 where

7. Clean up ​

bash
vz down                  # shut the VM down (ACPI), end the background process

The overlay keeps everything you changed in the VM, so the next vz up continues where you left off. To start fresh instead:

bash
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 lab

The pulled image in ~/.vz/images is never modified by either command.

What just happened ​

Concepts explains each piece.

Shortcuts ​

  • vz init writes a one-node starter lab.yaml in the current folder. It has no cloud-init seed, so add init: before you expect to log in.
  • vz init --example 01 copies 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.yaml points 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.

See also ​