How to Install OPNsense on Debian Latest

OPNsense is a FreeBSD-based open-source firewall and routing platform. In this tutorial, we will go through the process of installing OPNsense on Debian Latest.

Prerequisites

Before starting, you will need:

Step 1 - Download OPNsense Image

Step 2 - Install Required Packages

OPNsense requires some additional packages to be installed. To install the required packages, run the following command:

sudo apt update
sudo apt install qemu uml-utilities bridge-utils wget

Step 3 - Create a Bridge Network

OPNsense requires a virtual bridge network to function properly. To create a virtual bridge network, run the following command:

sudo brctl addbr opnbridge

Step 4 - Prepare Disk Image for OPNsense

qemu-img create -f qcow2 opnsense.qcow2 2G
sudo wget https://opnsense.org/download/OPNsense-21.1.8-OpenSSL-vga-amd64.img.bz2
sudo bunzip2 OPNsense-21.1.8-OpenSSL-vga-amd64.img.bz2
sudo qemu-img convert -O qcow2 OPNsense-21.1.8-OpenSSL-vga-amd64.img opnsense.qcow2
sudo qemu-img resize opnsense.qcow2 +8G

Step 5 - Launch the OPNsense Image

Launch the OPNsense image with the following command:

sudo qemu-system-x86_64 -enable-kvm -m 1024 -smp 2 -netdev \
user,id=unet,hostfwd=tcp::2222-:22 -device \
virtio-net-pci,netdev=unet -device virtio-scsi \
-device scsi-hd,drive=opndisk \
-drive file=opnsense.qcow2,if=none,id=opndisk \
-device virtio-blk,drive=opndisk \
-netdev bridge,id=labbr,br=opnbridge \
-device virtio-net-pci,netdev=labbr

Step 6 - OPNsense Configuration

Congratulations, you have successfully installed OPNsense on Debian Latest!

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!