FreeBSD Virtualization Techniques: Jails and Bhyve

Jul 19, 2023 • FreeBSDSoftware

FreeBSD, an open-source Unix-like operating system, offers a variety of powerful virtualization techniques, including Jails and Bhyve. This guide provides an in-depth look into these techniques, presenting practical application and discussions of benefits and limitations.

##Introduction to FreeBSD Virtualization

Virtualization in FreeBSD offers numerous benefits, from system isolation and security to resource management. FreeBSD provides several virtualization options, each with their unique features. This post highlights Jails & Bhyve, crucial tools in FreeBSD’s virtualization arsenal.

##Understanding FreeBSD Jails

FreeBSD Jails, a form of operating system-level virtualization, serve to partition a FreeBSD operating system into several independent, smaller systems called ‘jails’. Each ‘jail’ is assigned its unique IP address and configuration, mimicking a complete system but isolated within a secure environment.

To create first Jail on FreeBSD, follow the steps below:

  1. Update the FreeBSD system.
pkg update -f && pkg upgrade -y
  1. Install ezjail package.
pkg install -y ezjail
  1. Enable ezjail service.
echo 'ezjail_enable="YES"' >> /etc/rc.conf
  1. Start ezjail service.
service ezjail start
  1. Create a new jail.
ezjail-admin create [jail_name] 'lo1|,em0|[your_network.IP]'
  1. Start the newly created jail.
ezjail-admin start [jail_name]

By executing these steps, a new jail has been created on the FreeBSD system. Further details on monitoring and managing jails can be found in our guide on Managing Services and Daemons on FreeBSD.

##Exploring Bhyve on FreeBSD

Bhyve, or “BSD Hypervisor,” is a type-2 hypervisor that runs directly on the host platform’s system, supporting FreeBSD, Linux, and Windows guests. Bhyve provides a minimalist approach to virtualization, consuming fewer system resources compared with other solutions.

Installing Bhyve is a straightforward process:

  1. Update the FreeBSD system.
pkg update -f && pkg upgrade -y
  1. Install vm-bhyve and uefi-edk2-bhyve packages.
pkg install -y vm-bhyve uefi-edk2-bhyve
  1. Enable vm service.
echo 'vm_enable="YES"' >> /etc/rc.conf
  1. Start the vm service.
service vm init
  1. Configure and start your first VM.
vm switch create public
vm iso
vm create -s 10G my_vm #create a vm named my_vm with 10GB 
vm install my_vm FreeBSD-11.0-RELEASE-amd64-disc1.iso

This sequence of steps sets up Bhyve on a FreeBSD system, accompanied by its first guest VM. Further exploration of Bhyve and its applications can be found in our article on FreeBSD System Administration.


Jails and Bhyve bring remarkable virtualization capabilities to FreeBSD, providing a versatile platform for isolating processes, managing resources, and creating secure environments. Knowledge of these tools and their proper application can significantly enhance FreeBSD system performance while securing your system. Continue to explore these and other FreeBSD features to fully harness the power of your FreeBSD system.

Checkout these related ports: