lima: shared network mode not working on Mac M1

Note (by @AkihiroSuda )

The following commands are reported to fix the issue on some machines:

sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add /usr/libexec/bootpd
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --unblock /usr/libexec/bootpd

Description

Environment

macOS Monterey version 12.6.2 Apple M1 Pro chip limactl version 0.14.1

What I expected

Guest IP address of VM created with limactl start --name=default template://vmnet should be accessible (i.e. can be pinged) from host.

What actually happened

No accessible IP address.

❯ limactl list
NAME       STATUS     SSH                VMTYPE    ARCH       CPUS    MEMORY    DISK      DIR
default    Running    127.0.0.1:60022    qemu      aarch64    4       4GiB      100GiB    ~/.lima/default
❯ lima
am@lima-default:/Users/am$ sudo apt install net-tools
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
net-tools is already the newest version (1.60+git20181103.0eebece-1ubuntu5).
0 upgraded, 0 newly installed, 0 to remove and 18 not upgraded.
am@lima-default:/Users/am$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.5.15  netmask 255.255.255.0  broadcast 192.168.5.255
        inet6 fec0::5055:55ff:fe72:7117  prefixlen 64  scopeid 0x40<site>
        inet6 fe80::5055:55ff:fe72:7117  prefixlen 64  scopeid 0x20<link>
        ether 52:55:55:72:71:17  txqueuelen 1000  (Ethernet)
        RX packets 16673  bytes 23072545 (23.0 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1307  bytes 146839 (146.8 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lima0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fdc4:fde4:aceb:14bd:5055:55ff:fee7:9ac4  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::5055:55ff:fee7:9ac4  prefixlen 64  scopeid 0x20<link>
        ether 52:55:55:e7:9a:c4  txqueuelen 1000  (Ethernet)
        RX packets 38  bytes 5883 (5.8 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 65  bytes 10104 (10.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 174  bytes 15527 (15.5 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 174  bytes 15527 (15.5 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Some notes

  • /etc/sudoers.d/lima is properly set up.
  • ping 192.168.5.15 times out. ping 192.168.105.2 times out.

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 34 (10 by maintainers)

Most upvoted comments

@AravindGopala unfortunately the issue seem that bootpd does not provide the DHCP address.
This might also relate to - https://github.com/canonical/multipass/issues/2387

As work-around in colima (latest 0.5.5) you can now pass in an environment variable COLIMA_IP and set a fixed IP in the 192.168.106.0/24 subnet - (ideally use above 200) - it is at least an option to get past this if the change on ipv6 does not work for you - I know for some this does not work, and the only option then is to use this environment variable to get a fixed IP. Hope this helps.

colima start -c 1 -d 10 -m 2 --network-address --env COLIMA_IP=192.168.106.201

INFO[0000] starting colima
INFO[0000] runtime: docker
INFO[0000] preparing network ...                         context=vm
INFO[0001] creating and starting ...                     context=vm
INFO[0032] provisioning ...                              context=docker
INFO[0032] starting ...                                  context=docker
INFO[0038] done

$ colima list
PROFILE    STATUS     ARCH       CPUS    MEMORY    DISK     RUNTIME    ADDRESS
default    Running    aarch64    1       2GiB      10GiB    docker     192.168.106.201

After a reboot, I run the following:

sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add /usr/libexec/bootpd
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --unblock /usr/libexec/bootpd

Please refer to socket_vmnet issue 18.

@aelsnz Finally this worked for me, I have to run the below command every time I boot once, looks like bootp is being blocked by firewall.

sudo /usr/libexec/ApplicationFirewall/socketfilterfw --unblock /usr/libexec/bootpd