multipass
multipass copied to clipboard
Add ability to add `--network`s to existing instances
@Saviq can confirm the Networks option is there now. Is there documentation somewhere for how to add a network/launch option to an existing instance? I'd like to either add --network bridged
or a specific network interface to my existing microk8s-vm
instance since I'm not sure I can have the MicroK8S installer pass the network options into multipass during the install process.
Originally posted by @mlb5000 in https://github.com/canonical/multipass/issues/1857#issuecomment-1063118209
Thanks @Saviq !
@mlb5000 I've made this into a new issue.
We'll be adding that functionality in the long run for sure, but for now you'd need to edit our instance database.
This should do:
# stop the instance
$ multipass stop microk8s
# stop multipass
$ sudo launchctl unload /Library/LaunchDaemons/com.canonical.multipassd.plist
Edit /var/root/Library/Application\ Support/multipassd/qemu/multipassd-vm-instances.json
and add something along those lines to the dictionary of the instance in question:
"extra_interfaces": [
{
"auto_mode": false,
"id": "en0",
"mac_address": "52:54:00:ab:c3:0d"
}
],
NB: make sure the MAC address is unique.
# start multipass
$ sudo launchctl load /Library/LaunchDaemons/com.canonical.multipassd.plist
$ multipass start microk8s
You will then need to configure the interface inside the instance, see https://netplan.io/examples/#connecting-multiple-interfaces-with-dhcp for some help.
thanks Saviq on the solution. I managed to modify the instance's setting to add a DHCP enabled IP.
@Saviq Can confirm that this added the interface, but a couple things:
- That interface was disabled when the VM started back up. I had to explicitly run
sudo ifconfig enp0s2 up
before it would start. - Despite setting the configuration
"auto_mode": true
, it did not automatically get an IP upon starting. I had to runsudo dhclient enp0s2 -v
before it would get an IP from the DHCP server.
@mlb5000 that's this bit:
You will then need to configure the interface inside the instance, see https://netplan.io/examples/#connecting-multiple-interfaces-with-dhcp for some help.
@Saviq ah oh great, then that's expected behavior. thanks for the response!
multipassd
how to do this in windows host? thank you