Skip to navigation
Steps to install and run a windows virt with vm-bhyve on freebsd
26.06.26
pkg install vm-bhyve bhyve-firmware sysrc vm_enable="YES" sysrc vm_dir="/var/lib/vm" vm init vm switch create public vm switch add public em0 # replace em0 with your NIC vm create -t windows win10x # create empty config, then override: cat > /var/lib/vm/win10x/win10x.conf << 'EOF' loader="uefi" graphics="yes" graphics_port="5900" graphics_listen="0.0.0.0" xhci_mouse="yes" cpu="2" memory="4G" disk0_type="ahci-hd" disk0_name="disk0.img" disk0_size="40G" network0_type="virtio-net" network0_switch="public" EOF truncate -s 40G /var/lib/vm/win10x/disk0.img vm install win10x /home/veto/tiny10.iso # AHCI — no driver needed # Install Windows normally via VNC viewer # After install, add virtio-win CDROM for drivers: sysrc -xqf /var/lib/vm/win10x/win10x.conf disk0_opts echo 'disk0_opts="bootindex=0"' >> /var/lib/vm/win10x/win10x.conf echo 'disk1_type="ahci-cd"' >> /var/lib/vm/win10x/win10x.conf echo 'disk1_name="/home/veto/virtio-win.iso"' >> /var/lib/vm/win10x/win10x.conf echo 'disk1_opts="bootindex=1"' >> /var/lib/vm/win10x/win10x.conf vm start win10x # In Windows, open CD drive → run virtio-win-gt-x64.msi # Reboot, remove the CDROM from config, switch disk to virtio-blk: echo 'disk0_type="virtio-blk"' >> /var/lib/vm/win10x/win10x.conf # Enable autostart on boot: pkg install freerdp # Inside Windows: Win+R → sysdm.cpl → Remote tab → allow connections # Note Windows IP with: ipconfig xfreerdp /v:192.168.1.x /u:user /p:mypass /clipboard /dynamic-resolution /f For autostart from desktop on FreeBSD, create ~/rdp.sh: #!/bin/sh xfreerdp /v:192.168.1.x /u:user /p:mypass /clipboard /dynamic-resolution /f chmod +x ~/rdp.sh ## working /var/lib/vm/win10x/win10x.conf ``` loader="uefi" graphics="yes" graphics_port="5900" graphics_listen="0.0.0.0" xhci_tablet="yes" cpu="2" memory="4G" disk0_type="ahci-hd" disk0_name="disk0.img" disk0_size="40G" disk0_opts="bootindex=0" disk1_type="ahci-cd" disk1_name="/root/virtio-win.iso" disk1_opts="bootindex=1" network0_type="virtio-net" network0_switch="public" uuid="e9f1d555-7129-11f1-af75-f079595d6654" network0_mac="58:9c:fc:0f:f5:b3" debug="yes" disk1_type="ahci-cd" disk1_name="/root/virtio-win.iso" disk1_dev="custom" xhci_mouse="yes" graphics_res="1280x720" ``` # Linux guest to acces: ``` Same as from FreeBSD — just point to the FreeBSD host's IP and the Windows VM's IP: On your Linux machine: sudo apt install freerdp2-x11 # Debian/Ubuntu xfreerdp /v:192.168.1.x /u:user /p:mypass /clipboard /dynamic-resolution /f Where 192.168.1.x is the Windows VM's IP (not FreeBSD's). If the VM is NAT'd and not directly reachable, RDP instead to FreeBSD's IP and use a port forward: On FreeBSD, forward port 3389 to the Windows VM: echo 'rdr pass on em0 inet proto tcp from any to (em0) port 3389 -> 192.168.1.x port 3389' >> /etc/pf.conf Then from Linux connect to FreeBSD's IP on port 3389. ```
https://wiki.freebsd.org/bhyve
Reply
Anonymous
Information Epoch 1782873375
Allow the user to tailor the environment.
Home
Notebook
Contact us