How to configura static IPs on MacOS

I am trying to build a local Kubernetes Lab on my Machine. I tried it once and it was working well until I restarted my Mac. OS Updates.

After troubleshooting, I realized that the IP address changed. So, I starting looking into how to create an instance with a static IP address. And I found this: https://multipass.run/docs/configure-static-ips

Since I am on Mac, I tried to adapt/readapt. I was not able to create the Interface using UI as described here (https://support.apple.com/en-vn/guide/mac-help/mh43557/mac), maybe because of this: Note: You can’t use bridging if the physical network device used for bridging is a wireless device.

So I had to create it using command line tools:

sudo ifconfig bridge create
sudo ifconfig bridge1 addm en0
sudo ifconfig bridge1 inet 192.168.70.1/24 up

With that, I was expecting to be able to run:

multipass launch --name k8s-cp-01 --network name=bridge1,mode=manual

but this returns an error:

➜ multipass launch --name k8s-cp-01 --network name=bridge1,mode=manual
launch failed: Invalid arguments supplied
Invalid network options supplied

And when I run: ifconfig bridge1, I see this:

bridge1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=63<RXCSUM,TXCSUM,TSO4,TSO6>
ether 62:3e:5f:85:db:01
inet 192.168.70.1 netmask 0xffffff00 broadcast 192.168.70.255
Configuration:
id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
ipfilter disabled flags 0x0
member: en0 flags=8003<LEARNING,DISCOVER,MACNAT>
ifmaxaddr 0 port 13 priority 0 path cost 0
Address cache:
5c:e9:1e:86:59:da Vlan1 en0 616 flags=0<>
4c:d5:77:fd:4e:35 Vlan1 en0 1164 flags=0<>
4:f3:52:3:13:ea Vlan1 en0 857 flags=0<>
d4:4f:67:52:e9:75 Vlan1 en0 1044 flags=0<>
MAC NAT list:
en0 192.168.1.152 60:3e:5f:58:f8:54 1198
en0 2001:818:c22f:a200:e0f7:3b5:bacb:e65b 60:3e:5f:58:f8:54 1199
en0 2001:818:c22f:a200:10e7:8ccc:ed86:5905 60:3e:5f:58:f8:54 0
en0 fe80::4b6:9906:e87:8bc5 60:3e:5f:58:f8:54 1194
media: autoselect
status: active

multipass networks command does not return bridge1:

➜ multipass networks
Name Type Description
bridge0 bridge Network bridge with en1, en2, en3
en0 wifi Wi-Fi
en1 thunderbolt Thunderbolt 1
en2 thunderbolt Thunderbolt 2
en3 thunderbolt Thunderbolt 3
en4 ethernet Ethernet Adapter (en4)
en5 ethernet Ethernet Adapter (en5)

1 Like

I tried something different.

I first created a bridge from the UI, then I run these two commands:

sudo ifconfig bridge1 addm en0
sudo ifconfig bridge1 inet 192.168.70.1/24 up

This time, when I try to launch a new instance, the error, changed:

➜ multipass launch --name k8s-cp-01 --network name=bridge1,mode=manual
launch failed: The following errors occurred:
qemu-system-aarch64: -nic vmnet-bridged,ifname=bridge1,model=virtio-net-pci,mac=52:54:00:83:14:d5: unsupported ifname ‘bridge1’, expected one of [ en0 ]
k8s-cp-01: shutdown called while starting

What am I missing?

Hi @hate629, when using the QEMU driver, Multipass relies on vmnet to bridge instances. Unfortunately, only physical interfaces are supported.

The fact that Multipass offered other networks in multipass networks and attempted to use them in launch was a bug, which has been fixed and will be in the next release. The only remaining option on macOS would be the VirtualBox backend (multipass set local.driver=virtualbox).

Hi @ricab

Unfortunately, VirtualBox no longer supports Apple Chips.

Screenshot 2024-01-03 at 10.42.00

I suppose the only viable way to get static Ips in multipass currently is to edit the dhcp-lease file under /var/db/dhcpd_leaseson your mac.

https://blog.karldenby.com/2020/03/24/multipass-on-mac/

But I am not using it anymore. Its so unstable and stops working after some time. Not a good piece of software I think.
I am switching to qemu with a cloud-init config and maybe I provide my config with ansible. Not sure about it yet.