Using a custom DNS
In some scenarios the default of using the system-provided DNS will not be sufficient. When that’s the case, you can use the
--cloud-init option to the
launch command, or modify the networking configuration after the instance started.
To use a custom DNS in your instances, you can use this cloud-init snippet:
#cloud-config bootcmd: - printf "[Resolve]\nDNS=18.104.22.168" > /etc/systemd/resolved.conf - [systemctl, restart, systemd-resolved]
22.214.171.124 with whatever your preferred DNS server is. You can then launch the instance using the following:
$ multipass launch --cloud-init systemd-resolved.yaml
The netplan.io approach
After the instance booted, you can modify the
/etc/netplan/50-cloud-init.yaml file, adding the
network: ethernets: ens3: dhcp4: true match: macaddress: 52:54:00:fe:52:ee set-name: ens3 nameservers: search: [mydomain] addresses: [126.96.36.199]
You can then test it:
$ sudo netplan try Do you want to keep these settings? Press ENTER before the timeout to accept the new configuration Changes will revert in 120 seconds ...
Last updated 8 months ago.