User Tools

Site Tools


freebsd:bhyve

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revision Both sides next revision
freebsd:bhyve [2016/12/06 14:41]
tschulz created
freebsd:bhyve [2017/01/01 21:51]
tschulz [rc.conf]
Line 15: Line 15:
   * add tap1, tap2, etc for more virtual machines   * add tap1, tap2, etc for more virtual machines
 <file bash /​etc/​rc.conf>​ <file bash /​etc/​rc.conf>​
-loned_interfaces="​bridge0 tap0"+cloned_interfaces="​bridge0 tap0"
 ifconfig_bridge0="​addm re0 addm tap0" ifconfig_bridge0="​addm re0 addm tap0"
 </​file>​ </​file>​
Line 55: Line 55:
 13    1 0xffffffff829d9000 5010     ​nmdm.ko 13    1 0xffffffff829d9000 5010     ​nmdm.ko
 </​file>​ </​file>​
 +===== Installing Linux =====
 +==== You will need the following in order to install Linux ====
 +  - Install ISO
 +  - device.map file
 +  - raw drive image
 +
 +=== Example device.map file ===
 +<​file>​
 +(hd0) ./​ubuntu-16.04.img
 +(cd0) ./​ubuntu-16.04.1-server-amd64.iso
 +</​file>​
 +
 +=== Create drive image with: ===
 +<​file>​
 +truncate -s 16G ubuntu-16.04.img
 +</​file>​
 +
 +=== Load Kernel and startvm ===
 +<​file>​
 +screen
 +grub-bhyve -m device.map -r cd0 -M 1024M ubuntu-16.04
 +bhyve -A -H -P -s 0:​0,​hostbridge -s 1:0,lpc -s 2:​0,​virtio-net,​tap0 -s 3:​0,​virtio-blk,​./​ubuntu-16.04.img ​   -s 4:​0,​ahci-cd,​./​ubuntu-16.04.1-server-amd64.iso -l com1,stdio -c 4 -m 1024M ubuntu-16.04
 +</​file>​
 +  * As long as the Linux iso has a text mode installer it should install normally
 +=== Destroy VM ===
 +<​file>​
 +bhyvectl --destroy --vm=ubuntu-16.04
 +</​file>​
 +
 +
 +
 +
  
 ===== Running VMs ===== ===== Running VMs =====
 +
 +
 +
 +
 +
 +
  
 ==== run.sh ==== ==== run.sh ====
 +  * The following script loads the kernel, starts the VM, and kills the VM after a ACPI shutdown
 <file bash> <file bash>
 #!/bin/sh #!/bin/sh
Line 67: Line 106:
 RAM="​1024M"​ RAM="​1024M"​
 CPUS="​4"​ CPUS="​4"​
-NETWORK="​-s 2:​0,​virtio-net,​tap0"+TAPDEV="​tap0"​ 
 +NETWORK="​-s 2:​0,​virtio-net,​${TAPDEV}"
  
 grub-bhyve -m device.map -r hd0,msdos1 -M ${RAM} ${VMNAME} grub-bhyve -m device.map -r hd0,msdos1 -M ${RAM} ${VMNAME}
freebsd/bhyve.txt · Last modified: 2018/09/18 22:21 by tschulz