OpenBSD on Hyper-V Primer

📆
🏷
,

I am fed up with VMWAre Workstation and I’d like to check if Hyper-V is a better alternative for me. This is not a tutorial but just a primer and scratchpad note mainly for me, thus those very brief notes.

  • Enable Hyper-V
  • Add User to Group “Hyper-V Administrators”
  • Create NAT Switch (Run as Hyper-V Administrator)
New-VMSwitch -Name NATSwitch -SwitchType Internal
Get-NetAdapter -Name *NATSwitch*
  • Setup Network for VMs. Hypter-V does not do DHCP, it just provides a switch, which I dig. (Run as Administrator)
    • Setup IP Gateway IP Address for VMs. You need the IfIndex from the Get-NetAdapter command from above
New-NetIPAddress -IPAddress 198.18.0.1 -PrefixLength 24 -InterfaceIndex 42
  • Now setup NAT
New-NetNat -Name HyperVNAT -InternalIPInterfaceAddressPrefix 198.18.0.0/24

We can setup our VM now:

New-VM -Name "obsd test" -MemoryStartupBytes 1GB -Generation 1 -BootDevice CD -SwitchName NATSwitch -NewVHDPath 'C:\path\to\vmstorage\obsd-test\base.vhdx' -NewVHDSizeBytes 50GB

Things that are missing / unclear so far:

  • non-persistent HDD
  • How does it know what the NAT Interface is and how does it perform if you move from wired to a wireless connection?
  • don’t know right now how to provide the ISO Image for the DVD via New-VM
  • quick tests using a Generation 2 VM didn’t work out as the ISO didn’t boot and the Hyper-V didn’t like miniroot62.fs as an ISO…
--EOF