"Apoptosis Network (alternate)" by "Simon Cockell" on Flickr

Multipass on Ubuntu with Bridged Network Interfaces

I’m working on a new project, and I am using Multipass on an Ubuntu machine to provision some virtual machines on my local machine using cloudinit files. All good so far!

I wanted to expose one of the services I’ve created to the bridged network (so I can run avahi-daemon), and did this by running multipass launch -n vm01 --network enp3s0 when, what should I see but: launch failed: The bridging feature is not implemented on this backend. OH NO!

By chance, I found a random Stack Overflow answer, which said:

Currently only the LXD driver supports the networks command on Linux.

So, let’s make multipass on Ubuntu use LXD! (Be prepared for entering your password a few times!)

Firstly, we need to install LXD. Dead simple:

snap install lxd

Next, we need to tell snap that it’s allowed to connect LXD to multipass:

snap connect multipass:lxd lxd

And lastly, we tell multipass to use lxd:

multipass set local.driver=lxd

Result?

user@host:~$ multipass networks
Name             Type      Description
enp3s0           ethernet  Ethernet device
mpbr0            bridge    Network bridge for Multipass

And when I brought my machine up with avahi-daemon installed and configured to broadcast it’s hostname?

user@host:~$ ip -4 addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
37: br-enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    inet 192.0.2.33/24 brd 192.0.2.255 scope global dynamic noprefixroute br-enp3s0
       valid_lft 6455sec preferred_lft 6455sec
user@host:~$ multipass list
Name         State       IPv4             Image
vm01         Running     203.0.113.15     Ubuntu 22.04 LTS
                         192.0.2.101
user@host:~$ ping vm01.local
PING vm01.local (192.0.2.101) 56(84) bytes of data.

Tada!

Featured image is “Apoptosis Network (alternate)” by “Simon Cockell” on Flickr and is released under a CC-BY license.

JonTheNiceGuy

He/Him. Husband and father. Linux advocating geek. Co-Host on the AdminAdmin Podcast, occasional conference speaker.

2 thoughts to “Multipass on Ubuntu with Bridged Network Interfaces”

  1. Hello! Did the same. At first it worked. But after that, the IP address disappeared from my main interfaces.
    And now when I build a new instance, it does not want to receive an IP address by dhcp.

    enp2s0 UP
    enp3s0 UP
    br-enp3s0 UP 10.24.64.27/24 fe80::bfc:7cba:9742:838e/64
    br-enp2s0 UP 192.168.50.68/24 fe80::accd:f15c:e206:1206/64

    1. Hmm, this is strange. I must confess, I’ve stopped using LXD and Multipass, and have gone back to using Vagrant and Virtualbox.

      However, it might be worth running tshark, tcpdump, or something similar against the bridged interface, and then try running `dhclient` on that interface while you’re running the packet capture.

      It might reveal whether the DHCP request is getting a response. If you are, and you get an IP address from that, then you need to look at something inside the VM – does `journalctl -xe` show you anything of use? Does running `netplan apply` do anything useful?

      When you say that when your build a new instance it doesn’t get an IP address, do you mean you have two VM instances?

      Also, as a random question, are you bridged to a WiFi interface or a wired one… As this might make a difference too.

      There are lots of options here. Let me know what you try and how it gets on!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.