Modifying your VM

Modify your VM using the Anka Virtualization CLI

Prerequisites

  1. You’ve installed the Anka Virtualization package
  2. You’ve created your first VM

The rest of this Getting Started guide focuses heavily on the (Command-Line Interface). These will be performed from within your macOS Terminal. For all available CLI commands, flags, and options, see the Command Reference.
> anka modify --help
usage: modify vmid <command>

   Modify a VM parameters

arguments:
  vmid                     Virtual machine to modify

commands:
  add                      Add new items to a VM configuration
  delete                   Remove items from a VM configuration
  name                     Set new name for the VM
  cpu                      Set number of vcpu cores and frequency
  ram                      Set RAM size and parameters
  network                  Modify network card settings
  port                     Add port forwarding rule
  disk                     Modify hard drive settings
  display                  Configure displays
  label                    Assign labels to a VM in key/value form
In Anka 3.0.0 changing the internal disk size to consume the free space anka modify disk adds is not possible. We are working on adding it, but for now we recommend creating/re-creating your VM templates with the necessary and generous amounts of space.

Common Examples

Changing your VM’s network configuration

Depending on your network topology, there are instances where you might need to use a bridge mode and assign your VM a unique IP address instead of the default shared IP of the host:

> anka modify 12.2.0 network --help
usage: network [options]

   Modify network card settings

options:
  -t,--mode <val>          network mode: shared/host/bridge/disconnected
  -b,--bridge <val>        host interface name to bridge with in the bridge mode, or "auto"
  -m,--mac <val>           specify fixed MAC address, or "auto"
  -v,--vlan <val>          assign VLAN ID, 0 to deassign
  -c,--controller <val>    set controller: anet, virtio-net
  --local                  enable (default) inter-VM and VM-host communication
  --no-local               disable inter-VM and VM-host communication
TypeDescription
sharedThe default network type operating as NAT + DHCP. Every VM after the start/resume gets an IP address assigned by the internal DHCP server in range 192.168.64.2 - 192.168.64.254. Programs inside a VM can access external networks (outside the host) and the internet directly. Also, other VMs on the host are also accessible.
host
Not currently supported.
bridgeThe Bridged type will cause the VM to show in the network as an individual device and receive a unique IP separate from the host.
An ENV is available to set the interface name: ANKA_BRIDGE_NAME=en0
When using the bridge, port-forwarding is not necessary as the VM will receive a unique IP that will be accessible directly to all other devices on the network.
By default, DHCP will not see your VM’s MAC address. You’ll need to enable --direct-mac for the network-card: anka modify VmName set network-card 0 --type bridged --direct-mac
You cannot use bridged networking over Wifi.
disconnectedThe VM will have a disconnected network cable.
❯ anka --machine-readable describe 12.2.0-arm | jq '.body.network_cards'
[
  {
    "type": "virtio-net",
    "mode": "shared",
    "port_forwarding_rules": [
      {
        "name": "ssh",
        "protocol": "tcp",
        "guest_port": 22
      }
    ]
  }
]

❯ anka modify 12.2.0-arm network --mode bridge

❯ anka --machine-readable describe 12.2.0-arm | jq '.body.network_cards'
[
  {
    "mode": "bridge",
    "controller": "virtio-net"
  }
]

What’s next?