Host: Windows 10 Enterprise LTSC 1809 / 17763.1217
Guests: Ubuntu 18.04.4 LTS (Bionic)
On a default install my primary and subsequent guests get IP addresses of the format
172.18.91.119/28 brd 172.18.91.127
The docs are not clear as to what is acting as a DHCP server, but I see DHCP happening in the guest logs, so I will chalk it up to some Multipass magic.
The problem I was confronted with is that I could not ssh into these guests from elsewhere on the ipv4 network. Only from WSL on my Host machine. Now it’s possible that this is some windows firewall setting on my part. But I also think it’s possible that Multipass is setting up a bridge network without ingress.
To enable network access to your guest vms:
–Create a Virtual Switch on your network interface
- Open hyper-v manager.
- Action > Virtual Switch Manager
- Select External > Create Virtual Switch
- Give the virtual switch a name
- Select the Network Interface you want the switch to attach to and apply.
–Attach Guest to Virtual Switch
- With the guest powered off
- Right click on the Virtual Machine name that you want to access, and go to Settings.
- Select Add Hardware, Network Adapter.
- Navigate to the new Network Adapter and select the new Virtual Switch you added in the previous step.
–Make your guest aware of the new interface
- Open a shell to your guest, via Multipass
ip linkshould show a new interface, probably
- Make a backup of
- Observing proper YAML spacing, add the lines:
eth1: dhcp4: true
/etc/netplan/NN-cloud-init.yaml should look approximately like:
network: ethernets: eth0: dhcp4: true match: macaddress: 00:15:5d:3d:39:02 set-name: eth0 eth1: dhcp4: true version: 2
sudo netplan generate, you will be prompted if there are yaml errors.
sudo netplan applyYou may lose connection during this point.
- You may need to do a
systemctl restart systemd-networkd.serviceor restart the guest via Multipass.
- If everything went well
ip addrshould show that you’ve leased an IP address.
- The guests disallow password logins, so copy your public ssh key to
~authorized_keyson the guest, to enable logging in.
I hope someone finds this helpful