Link to heading

How to Set Up an OPNsense Virtual Machine Using Virt-Manager Link to heading

If you’re looking to set up an OPNsense firewall in a virtualized environment using Virt-Manager, this step-by-step guide will help you get started. OPNsense is a powerful open-source firewall and routing platform, and running it on a virtual machine can offer significant flexibility for testing, deployment, and customization.

Step 1: Download the OPNsense ISO Link to heading

First, head over to the OPNsense Download Page.

  • Select the DVD version of OPNsense for amd64 architecture.
  • Download the .iso.bz2 file to your local machine.

Step 2: Extract the ISO File Link to heading

After the file is downloaded, navigate to the location where the .iso.bz2 file is stored. To decompress the file, open your terminal and run the following command:

bzip2 -d OPNsense-25.1-dvd-amd64.iso.bz2

This will decompress the file and give you the .iso file, which you will use to install OPNsense on the virtual machine.

Step 3: Configure Virt-Manager Network Settings Link to heading

  1. Open Virt-Manager and go to Edit -> Connection Details -> Virtual Networks.
  2. Create a new virtual network. For this example, we’ll configure four networks, but you can adapt this process based on your needs.

Here’s how you can set up each network:

  • Network 1: 10.1.0.0/24
  • Network 2: 10.2.0.0/24
  • Network 3: 10.3.0.0/24
  • Network 4: 10.4.0.0/24

Be sure to set up each network properly so you’ll have multiple virtual networks to assign to your OPNsense VM.

Step 4: Create a New Virtual Machine in Virt-Manager Link to heading

  1. Open Virt-Manager and click the + button to create a new virtual machine.
  2. Assign the OPNsense ISO:
    • When prompted, browse to and select the OPNsense-25.1-dvd-amd64.iso file.
    • Set the operating system to FreeBSD 14.0, as OPNsense is based on FreeBSD.

Step 5: Configure Virtual Machine Resources Link to heading

  • RAM: Set to 2048 MB (2 GB), which is generally sufficient for most OPNsense setups.
  • CPU Cores: Allocate 2 CPU cores for the VM, suitable for small to medium-sized environments.
  • Storage: Configure 60 GB of disk space for the OPNsense installation to ensure ample space for configurations.

Step 6: Name the Virtual Machine Link to heading

Name the virtual machine something like OPNsense so that you can easily identify it later.

Step 7: Customize Before Installing Link to heading

Ensure you check the box that says “Customize before installing”. This will allow you to configure the network interfaces and other settings before the actual installation begins.

Step 8: Set Boot Order Link to heading

In the Boot Options tab, make sure that the OPNsense ISO is set as the first boot option so that the installation process starts from the ISO image.

Step 9: Add Network Interfaces Link to heading

  1. After configuring the basic settings, click on Add Hardware and select Network.
  2. Add all the network interfaces you created earlier in Virt-Manager (for example, the four virtual networks you set up).

Step 10: Start the Installation Link to heading

  1. Once all the settings are configured, proceed to start the VM.
  2. The OPNsense installer should boot up from the ISO. Follow the on-screen instructions to complete the installation.
  3. During the installation process, OPNsense will prompt you to configure the network interfaces, which you can assign based on the virtual networks you created.

Conclusion Link to heading

With these steps, you should now have OPNsense running on a virtual machine in Virt-Manager. You can use it for testing, network routing, or even deploying it in a production environment if necessary. Virtualizing OPNsense provides flexibility, allowing you to set up multiple virtual networks and easily manage and monitor your firewall configuration.

Feel free to further customize your OPNsense setup and take advantage of its powerful features to enhance the security of your network.