Hyper-V reference

Initial setup (once)

Install Hyper-V

Add a second network interface

You only need to do this once - multiple VMs can share a network interface.

Configure WSL 2

If you are using WSL 2 (not WSL 1) with Hyper-V, you need to allow the two virtual switches to communicate.

Run PowerShell as an administrator, then run:

Set-NetIPInterface -ifAlias "vEthernet (Default Switch)" -Forwarding Enabled
Set-NetIPInterface -ifAlias "vEthernet (WSL)" -Forwarding Enabled


Download Ubuntu ISO

Download the Ubuntu Server ISO (e.g. ubuntu-20.04.4-live-server-amd64.iso).

VM setup

Configure DNS


Name Type Address
example.djm.me A
*.example.djm.me CNAME example.djm.me

Create a new VM

Install Ubuntu

Take a snapshot

It is a good idea to take a snapshot of the VM now, so you can roll it back later if it fails, or for testing.

You can now close the window - the VM will keep running in the background. (You can also close the main Hyper-V window.)

Connect via SSH

ssh dave@example.djm.me

Set up guest OS

See Ubuntu Setup.

Update dotfiles

Add it to my dotfiles SSH config.