NetBSD 9.3 on FreeBSD bhyve
NetBSD 9.3 as guest on the FreeBSD bhyve hypervisor
Headless FreeBSD box, with existing bridge.
I wanted to install NetBSD 9.3 as a virtual machine on a headless FreeBSD machine. This machine already has a bridge in place.
vm-bhyve
bhyve was already running on this machine, however I got UEFI problems when I tried to setup a VM on the 'normal' way, with bhyvectl.
It turned out that using vm-bhyve makes things much easier.
Also, using this method, there is no need for VNC, only a ssh connection to the FreeBSD host is required. The console runs in your terminal, so in your tmux session.
Steps to get a running NetBSD VM
- Install packages
- Create ZFS dataset
- Enable and configure vm-bhyve
- Initiate vm-bhyve
- Add existing bridge to vm-bhyve config
- Create the VM and start the installation
1 Install packages
First install bhyve, and vm-bhyve.
The following packages where already installed:
- bhyve-firmware
- grub2-bhyve
- uefi-edk2-bhyve-csm
Therefor, I only had to install vm-bhyve:
pkg install vm-bhyve
2 Create ZFS dataset
zfs create zroot/vm-bhyve
zfs set mountpoint=/vm-bhyve zroot/vm-bhyve
3 Enable and configure vm-bhyve
Add to /etc/rc.conf
:
vm_enable="YES"
vm_dir="zfs:zroot/vm-bhyve"
4 Initiate vm-bhyve
vm init
cd /vm-bhyve/
cp /usr/local/share/examples/vm-bhyve/* .templates/
5 Add existing bridge to vm-bhyve config
vm switch create -t manual -b bridge0 bridge0
6 Create the VM and start the installation
mv NetBSD-9.3-amd64.iso /vm-bhyve/.iso
vm create -t netbsd -s 10G netbsdvm
vm install netbsdvm NetBSD-9.3-amd64.iso
vm console netbsdvm
Now you can perform the normal installation.
I accepted most default settings, and set the console to 115200 baud.
Make sure vm-bhyve uses a tap device that is already added to the bridge. If not, you can add a tap device to the bridge with:
ifconfig bridge0 addm tap1
Setup the network config in the guest fitting to your bridge settings.
After the installation, NetBSD will reboot, you can stay in the console.
Close the console with ~Ctrl D
, that is tilde, followed by
Ctrl-D.
Run the VM
You can start and stop the VM with
vm start netbsdvm
vm stop netbsdvm
Happy VM-ing !
Made with ♥ by a human - Proud member of the 250kb.club.
Most recent pages
All tags
Sitemap
RSS
RSS of Gophersite