`multipass networks` command

See also: Driver (backend), How to set up the driver

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, multipass networks can only find interfaces in the following scenarios:

  • on Linux, with LXD (and QEMU starting from Multipass version 1.15)
  • on Windows, with both Hyper-V and VirtualBox
  • on macOS, with the QEMU and VirtualBox drivers

For example, on Windows with Hyper-V the multipass networks command returns:

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, running the command multipass networks --format yaml on macOS with VirtualBox returns:

bridge0:
  - type: bridge
    description: Network bridge with en1, en2
bridge2:
  - type: bridge
    description: Empty network bridge
en0:
  - type: wifi
    description: Wi-Fi (Wireless)
en1:
  - type: thunderbolt
    description: Thunderbolt 1
en2:
  - type: thunderbolt
    description: Thunderbolt 2

See launch and How to create an instance - Create an instance with multiple network interfaces for instructions on how to use these.


The multipass help networks command explains the available options:

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

Options:
  -h, --help         Displays help on commandline options
  -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

Errors or typos? Topics missing? Hard to read? Let us know or open an issue on GitHub.

1 Like

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.

Options:
-?, -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>
C:\Users\cychew>multipass help launch
Usage: multipass launch [options] [[remote:] | ]
Create and start a new instance.

Options:
-?, -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
stdin

Arguments:
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.

2 Likes

Thanks a lot ricab,

Shall give it a try.

With regards
CY

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?
Thanks

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

2 Likes

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 
DBUG[02-08|20:00:57] 
	{
		"config": {
			"core.https_address": "192.168.1.63:8443",
			"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.

1 Like

@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
NAME       SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
default    896M   706M   190M        -         -    49%    78%  1.00x    ONLINE  -

Error:

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.

Update:

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.

3 Likes

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.

1 Like

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
network:
  ethernets:
    extra0:
      dhcp4-overrides:
        route-metric: 50
EOF

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.

2 Likes

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

I searched for this all over the network, I read all the documentation for lxd and multipass and didnā€™t find it, please where could I have found it in the documentation? And if i have install lxd by apt how i connect multipass ?

Hi @matchaves

I searched for this all over the network, I read all the documentation for lxd and multipass and didnā€™t find it, please where could I have found it in the documentation?

You mean snap connect multipass:lxd lxd, right? Thatā€™s a miss in our documentation for the time being. Weā€™re trying to go for a way to automate this, but not there yet.

And if i have install lxd by apt how i connect multipass ?

I donā€™t think you can. Youā€™d need the LXD snap.

2 Likes