multipass icon indicating copy to clipboard operation
multipass copied to clipboard

Instance failed to get an IP from DHCP when created with option --network

Open TinyArchitect opened this issue 2 years ago • 2 comments

Describe the bug Instances created on my ubuntu machine with option --network can't get their IP from router (also as a DHCP server), I am not sure if it's a bug or something else (like network environment). However, it works fine with Multipass on my Mac under the same network.

To Reproduce

  1. multipass set local.driver=lxd
  2. multipass launch 22.04 --network enp1s0
  3. multipass exec enormous-pumpkinseed -- ip a

It shows

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp5s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 52:54:00:6d:92:6c brd ff:ff:ff:ff:ff:ff
    inet 10.240.5.153/24 metric 100 brd 10.240.5.255 scope global dynamic enp5s0
       valid_lft 3559sec preferred_lft 3559sec
    inet6 fd42:5729:80f1:281c:5054:ff:fe6d:926c/64 scope global dynamic mngtmpaddr noprefixroute
       valid_lft 3591sec preferred_lft 3591sec
    inet6 fe80::5054:ff:fe6d:926c/64 scope link
       valid_lft forever preferred_lft forever
3: enp6s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 52:54:00:63:5b:cd brd ff:ff:ff:ff:ff:ff
    inet6 fe80::5054:ff:fe63:5bcd/64 scope link
       valid_lft forever preferred_lft forever

From here can see enp6s0 is not getting any IP The /etc/netplan/50-cloud-init.yaml inside the instance is as follows

# This file is generated from information provided by the datasource.  Changes
# to it will not persist across an instance reboot.  To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        default:
            dhcp4: true
            match:
                macaddress: 52:54:00:6d:92:6c
        extra0:
            dhcp4: true
            dhcp4-overrides:
                route-metric: 200
            match:
                macaddress: 52:54:00:63:5b:cd
            optional: true
    version: 2

Expected behavior I am expecting the additional network interface can automatically get an IP address under same subnet as the host from the DHCP server

Logs

......

Jul 14 15:01:28 home-server multipassd[14938]: Using the 'multipass' storage pool.
Jul 14 15:01:28 home-server multipassd[14938]: Creating instance with image id: 6321107c3fc6c4be977c0d9b504450ae9c811d54299ab5e28ce8c0de24e41d6c
Jul 14 15:01:33 home-server multipassd[14938]: "Object does not exist at path “/org/freedesktop/NetworkManager/ActiveConnection/24”"
Jul 14 15:01:33 home-server multipassd[14938]: "Object does not exist at path “/org/freedesktop/NetworkManager/ActiveConnection/24”"
Jul 14 15:01:34 home-server multipassd[14938]: Waiting for SSH to be up
Jul 14 15:01:37 home-server multipassd[14938]: "Object does not exist at path “/org/freedesktop/NetworkManager/ActiveConnection/24”"
Jul 14 15:01:37 home-server multipassd[14938]: "Object does not exist at path “/org/freedesktop/NetworkManager/ActiveConnection/24”"
Jul 14 15:01:44 home-server multipassd[14938]: "Object does not exist at path “/org/freedesktop/NetworkManager/ActiveConnection/24”"
Jul 14 15:01:44 home-server multipassd[14938]: "Object does not exist at path “/org/freedesktop/NetworkManager/ActiveConnection/24”"
Jul 14 15:01:59 home-server multipassd[14938]: Executing '[ -e /var/lib/cloud/instance/boot-finished ]'
Jul 14 15:02:01 home-server multipassd[14938]: Executing '[ -e /var/lib/cloud/instance/boot-finished ]'
Jul 14 15:02:04 home-server multipassd[14938]: Executing '[ -e /var/lib/cloud/instance/boot-finished ]'
Jul 14 15:02:05 home-server multipassd[14938]: Executing '[ -e /var/lib/cloud/instance/boot-finished ]'
Jul 14 15:02:06 home-server multipassd[14938]: Executing '[ -e /var/lib/cloud/instance/boot-finished ]'
Jul 14 15:02:07 home-server multipassd[14938]: Executing '[ -e /var/lib/cloud/instance/boot-finished ]'
Jul 14 15:02:09 home-server multipassd[14938]: Executing '[ -e /var/lib/cloud/instance/boot-finished ]'
Jul 14 15:02:09 home-server multipassd[14938]: Returning setting local.privileged-mounts=true

Additional info

  • OS: Ubuntu 22.04 LTS
  • multipass version
multipass   1.10.0
multipassd  1.10.0
  • multipass info --all
Name:           enormous-pumpkinseed
State:          Running
IPv4:           10.240.5.153
Release:        Ubuntu 22.04 LTS
Image hash:     6321107c3fc6 (Ubuntu 22.04 LTS)
Load:           0.08 0.04 0.04
Disk usage:     1.4G out of 9.5G
Memory usage:   183.7M out of 967.2M
Mounts:         --

Additional context My host network interface looks like this at this moment

NAME                       UUID                                  TYPE      DEVICE
br-enp1s0                  77689913-2f3d-4de3-b2e3-47aac4f74b6f  bridge    br-enp1s0
mpbr0                      32f9a248-6e78-4034-9c2f-ee5a197b56c9  bridge    mpbr0
netplan-wlo1-XXXXXXXXXXXX  3f68c593-261c-360e-9a85-bf2aebca902f  wifi      wlo1
docker0                    4bd712b4-602f-488d-9450-31908cf2fef0  bridge    docker0
br-enp1s0-child            002addb8-ab3b-4225-9b86-e73927825be7  ethernet  enp1s0
tap721e99bc                ad3343f1-c668-485d-875f-49a6ba33cc09  tun       tap721e99bc
tapaa6bcd58                b539aa2b-c0ff-43ae-a862-3e6d1b1c6cc9  tun       tapaa6bcd58

TinyArchitect avatar Jul 14 '22 07:07 TinyArchitect

UPDATE

Seems like this is caused by the NetworkManager inside the instance that I modified before. I fresh installed the OS on my host recently and performed the same command as I did previously, and turned out it worked fine. However, things started to break again after I modified the Netplan config to use NetworkManager as the renderer inside the instance, after netplan apply and exit, I can't multipass shell into the instance, and even after I deleted and purged that broken instance, the network bridge of other instances (including instance create after) break. Perhaps there's a conflict between the host NetworkManager and the one inside the instance which breaks the entire Multipass bridge network on the host?

TinyArchitect avatar Jul 20 '22 06:07 TinyArchitect

Hi @TinyArchitect. Yeah multipass relies on the default interface in the VM to shell into it. It does look like the netplan changes are messing things. Also, do you have any firewall in play between the instance and the DHCP server? That could block DHCP to the extra interface.

You should still be able to get a shell with lxc exec --project=multipass <instancename> -- /bin/bash (perhaps adding --force-local)? That would allow you to inspect and rollback problems.

BTW, you may find netplan try helpful too. Let us know what you find!

ricab avatar Jul 27 '22 17:07 ricab