`multipass networks` command

[Since version 1.6.0]

The multipass networks command lists network interfaces that multipass can connect instances to. The result depends both on the platform and the driver in use.

At this time, networks can only find interfaces in the following scenarios:

Here is an example on Windows with Hyper-V:

PS> multipass networks
Name            Type    Description
Default Switch  switch  Virtual Switch with internal networking
ExternalSwitch  switch  Virtual Switch with external networking via "Red Hat VirtIO Ethernet Adapter"
InternalSwitch  switch  Virtual Switch with internal networking
PrivSwitch      switch  Private virtual switch

Like list, networks supports the --format option. Another example, now with VirtualBox on macOS:

$ multipass networks --format yaml
  - type: bridge
    description: Network bridge with en1, en2
  - type: bridge
    description: Empty network bridge
  - type: wifi
    description: Wi-Fi (Wireless)
  - type: thunderbolt
    description: Thunderbolt 1
  - type: thunderbolt
    description: Thunderbolt 2

See launch and additional network interfaces for instructions on how to use these.

multipass help networks explains the available options:

$ multipass help networks
Usage: multipass networks [options]
List host network devices (physical interfaces, virtual switches, bridges)
available to integrate with using the `--network` switch to the `launch`

  -h, --help         Display this help
  -v, --verbose      Increase logging verbosity. Repeat the 'v' in the short
                     option for more detail. Maximum verbosity is obtained with
                     4 (or more) v's, i.e. -vvvv.
  --format <format>  Output list in the requested format.
                     Valid formats are: table (default), json, csv and yaml

hi ricab,

The network option seems to be missing in Windows 10 multipass. I could see the network option in multipass main option as well as parameter in launch command.

I am running Windows 10 pro with Hyper-V enabled.

C:\Users\cychew>multipass help
Usage: multipass [options]
Create, control and connect to Ubuntu instances.

This is a command line utility for multipass, a
service that manages Ubuntu instances.

-?, -h, --help Display this help
-v, --verbose Increase logging verbosity. Repeat the ‘v’ in the short
option for more detail. Maximum verbosity is obtained with 4
(or more) v’s, i.e. -vvvv.

Available commands:
delete Delete instances
exec Run a command on an instance
find Display available images to create instances from
get Get a configuration setting
help Display help about a command
info Display information about instances
launch Create and start an Ubuntu instance
list List all available instances
mount Mount a local directory in the instance
purge Purge all deleted instances permanently
recover Recover deleted instances
restart Restart instances
set Set a configuration setting
shell Open a shell on a running instance
start Start instances
stop Stop running instances
suspend Suspend running instances
transfer Transfer files between the host and instances
umount Unmount a directory from an instance
version Show version details

C:\Users\cychew>multipass version
multipass 1.5.0+win
multipassd 1.5.0+win

C:\Users\cychew>multipass help launch
Usage: multipass launch [options] [[remote:] | ]
Create and start a new instance.

-?, -h, --help Display this help
-v, --verbose Increase logging verbosity. Repeat the ‘v’ in the short
option for more detail. Maximum verbosity is obtained
with 4 (or more) v’s, i.e. -vvvv.
-c, --cpus Number of CPUs to allocate.
Minimum: 1, default: 1.
-d, --disk Disk space to allocate. Positive integers, in bytes, or
with K, M, G suffix.
Minimum: 512M, default: 5G.
-m, --mem Amount of memory to allocate. Positive integers, in
bytes, or with K, M, G suffix.
Minimum: 128M, default: 1G.
-n, --name Name for the instance. If it is ‘primary’ (the
configured primary instance name), the user’s home
directory is mounted inside the newly launched instance,
in ‘Home’.
–cloud-init Path to a user-data cloud-init configuration, or ‘-’ for

image Optional image to launch. If omitted, then the default
Ubuntu LTS will be used.
can be either ‘release’ or ‘daily‘. If
is omitted, ‘release’ will be used.
can be a partial image hash or an Ubuntu release
version, codename or alias.
is a custom image URL that is in http://, https://,
or file:// format

Is this a known issue?

Hi @ibcychew, it will only be available with v1.6. We haven’t released it yet, but you can find a release candidate here.

1 Like

Thanks a lot ricab,

Shall give it a try.

With regards

Hi Ricab,
On my Ubuntu 18.04 desktop, I installed different snap packages of multipass, which are: 1.6.0-rc.272+g9552990f (multipass_3330.snap), 1.6.0 (multipass_3359.snap) and 1.7.0-dev.374+gd58187db(multipass_3351.snap). But it always got failure with:

multipass networks
networks failed: The networks feature is not implemented on this backend.

Could you let me know what are the more efforts I need to take?

Hi @huaxiaozhong1, this feature is only available with certain backends. See the first bullet points in here.

You can use set to change the backend. On Linux you’d need multipass set local.driver=lxd, after having installed LXD (snap install lxd) and plugged multipass into it (snap connect multipass:lxd lxd).

Hi ricab, thank you for your so rapid, clear and useful guidance! I have run the following commands:
~$ sudo snap install lxd
lxd 4.10 from Canonical✓ installed
~$ sudo multipass set local.driver=lxd
~$ sudo snap connect multipass:lxd lxd

Then, I ran "multipass networks" again:

~$ multipass networks
networks failed: LXD object not found

Could you let me know the more steps I need to take?

Many thanks!

PS, I knew from [here](https://multipass.run/docs/additional-networks] that multipass relies on lxd. But I amn't very clear on how to :-)

And I have run the following command to init lxd:

~$ sudo lxd -d -v init
DBUG[02-08|20:00:53] Connecting to a local LXD over a Unix socket 
DBUG[02-08|20:00:53] Sending request to LXD                   method=GET url=http://unix.socket/1.0 etag=
DBUG[02-08|20:00:57] Got response struct from LXD 
		"config": {
			"core.https_address": "",
			"core.trust_password": true

Hmm, that’s unexpected. What does the multipassd log say? Could you please open a bug report and fill in the details here? Thank you.

You’re right to point lxd init, I forgot to mention that.

@ricab Thanks for the clarifications so far. Can you elaborate, how multipass interacts with LXC/LXD?

Concrete issue:
I accidently created a storage pool default with 1G in size with lxd init, which is too small for a nextcloud instance.

zpool list
default    896M   706M   190M        -         -    49%    78%  1.00x    ONLINE  -


launch failed: Operation completed with error: (400) Create instance from image: Failed to run: zfs snapshot default/images/e42…fa@readonly: cannot create snapshots : out of space

I tried to create a new one default2, again with lxd init, though multipass launch seems to insist to use default.


Found a solution in discuss.linuxcontainers.org from user tino27.

Given default as name of storage pool (see lxc storage list for name and location), do the following:

truncate -s +20G /var/snap/lxd/common/lxd/disks/default.img # add 20GB to existent image
zpool set autoexpand=on default
zpool status -vg default
zpool online -e default <device_id> # see number in previous command
zpool set autoexpand=off default
systemctl restart snap.lxd.daemon # for snap installation

I would be still interested in, what weng wrong / how multipass can be configured to use a different storage pool like default2 in above example.

Hi @mark-rag, Multipass indeed uses the default pool. I am afraid we don’t offer a way to change that at this time, but it is something we could consider, so thanks for pointing it out.

1 Like

I’m wondering if there is a way to change one of the following.

  • Default primary network to use bridge mode instead of NAT(changing causing the multipass to break as it can’t communicate with it anymore)
  • Default routing on secondary network interface so traffic to the network routes through bridged network as primary assuming the NAT network can’t be change due to how its integrated.

I’m doing packet analysis and routing through the NAT is causing it not to show up the way i’m looking for.

Hi @sabobo, Multipass relies on that default network as you guessed, but you can change route metrics inside the instance to your liking.

There is a “Routing” section here that mentions the default metric and its effects. You can give the secondary interface a lower metric (higher preference), for example with ifmetric enp0s8 50.

Thanks @ricab. Changing the route metric won’t effect multipass services from working correct? Testing now!

Hey @ricab so i was able to do that. is there a command/setting for keeping it that way after reboot? when i shut down and boot it back up, it resets back to 200 rather than 50.

Hi @sabobo, you can provide your own config to Netplan, inside the instance:

sudo tee /etc/netplan/55-custom-metric.yaml > /dev/null << EOF
        route-metric: 50

Make sure the network name (extra0 in the example) matches the one you want to override from /etc/netplan/50-cloud-init.yaml. Netplan will use that in the following reboots. You can call netplan apply to have it reflected immediately.

Thank you @ricab. Appreciate the details and will figure out how to incorporate that in.