I’ve been using Multipass 1.17 on a MacOS laptop (multipass 1.17.0+mac
multipassd 1.17.0+mac), with the applevz driver. It’s working very well, thanks!
One thing my skimming of the documentation didn’t find was how persistent are image IP addresses? I don’t need static IP addresses per se, for my current application I’m fine with whatever IP address Multipass chooses. It seem that once an address is assigned, it persists across VM reboots, or rebooting my Mac, but I don’t know if that’s to be counted on, or I’ve just been lucky?
I wouldn’t rely on the IP remaining unchanged, even if it has been consistent across restarts so far.
On macOS, Multipass uses Apple’s virtual networking and DHCP infrastructure, so the address is assigned by the network rather than being a permanent property of the instance.
It may keep getting the same lease for a long time, but I’d treat that as convenient behaviour rather than something to build automation around.
If you’re running scripts from the Mac, one option is to use the Multipass instance name instead of its IP:
multipass exec my-vm -- <command>
That avoids needing to discover the address for commands executed inside the VM.
If you’re connecting directly to a service running inside the VM, I’d query multipass info my-vm when starting the workflow and use the current IPv4 address rather than keeping a hardcoded value.
There’s also a macOS-specific limitation worth knowing about: Multipass documentation mentions that adding an extra IP alias inside an instance doesn’t work as expected because the virtual networking layer filters traffic for addresses other than the originally assigned one. So I wouldn’t try to solve this by manually attaching another static address inside the guest.
Do you mainly need the address for SSH, or are you connecting to HTTP services running inside the instance? That would make a difference to the simplest approach.
Thanks for the detailed explanation. I’m using Multipass to test Ansible playbooks, so I have an Ansible inventory file with entries including, say, ‘ansible_hostname: 192.168.252.21’ or whatever Multipass IP chose. So if those addresses were to change, at worst I’d have to edit the inventory file with the new IP address.