Post

OPNsense VM Setup

OPNsense firewall VM download and setup for VirtualBox.

OPNsense VM Setup

Download and Extract the ISO File

Download OPNsense NGFW from: https://opnsense.org/download/

Set the image type to dvd and the mirror location to the closest location relative to you

1

The ISO is compressed in a special extension .bz2 and needs to be decompressed using bzip2. You can get bzip2 from: https://gnuwin32.sourceforge.net/packages/bzip2.htm

Once you downloaded bzip2, open PowerShell as administrator and navigate to the default directory where the bzip utilities are stored

In my case, C:\Program Files (x86)\GnuWin32\bin

run bunzip.exe with the -d option to decompress, followed by the path where the bz2 file is stored

2

We should now have the OPNsense ISO file

3

VM Configuration

Open VirtualBox and click Machine > New from the top left menu

Set a name for the VM (OPNsense)

Select the OPNsense ISO file

Set the type to BSD and the version to FreeBSD (64-bit)

4

I chose 4GB of RAM and 2 CPUs. You can always adjust this later if needed.

Refer to https://docs.opnsense.org/manual/hardware.html for OPNsense VM hardware requirements.

5

I set the storage to 40GB. Again, we can adjust this if needed

6

Make sure the configurations are correct and the path to the .iso file is correct

Then, click finish

7

Do not boot the VM yet, we need to configure the network adapters according to our topology

Right click on the VM, head to Settings > Network

Our firewall needs 4 network adapters

Set adapter 1 to Bridged

8

Enable Adapter 2 and set it to internal network for our servers (cyberlab-servers)

9

Enable Adapter 3 and set it to internal network for our Active Directory clients (cyberlab-ad)

10

Enable Adapter 4 and set it to internal network for our administrators/SOC analysts (cyberlab-admins)

11

Our adapters should look like this

12

OPNsense Setup

Boot the VM

When asked to confure LAGGs and VLANs, enter n for no

13

When asked for the WAN interface name, select the name that corresponds to the bridged adapter. It is usually em0 by default, but double check the MAC address to make sure.

14

Right click the VM, click on Settings, and head to the Network section.

In this case, em0 is the Bridged Adapter (MAC addresses match)

15

Select em0 for the WAN interface. Leave the LAN interface empty for now and proceed

16

This VM should get an IP from the home router via DHCP

17

Once that is done, log in to start the OPNsense installation

Use the credentials:

login: installer

password: opnsense

18

Leave the default keymap (US keyboard)

19

Select Unix file system (UFS)

20

Use the VBox harddisk

21

Yes

22

Yes

23

The installation will now begin (should take around 10 minutes)

24

When the installation is complete, you will be prompted to set up a root password

Set a password and keep note of it, or just leave it at default for now

25

Complete install and reboot

When the screen is black, stop the VM

26

Right click on the VM > Settings > System

Set the hard disk to be the first on the boot order (so it does not boot from the ISO)

27

Launch the VM

Login with the credentials:

username: root

password: opnsense (or whatever you set it to)

28

We will now assign the LAN interface so that we can access OPNsense from the web GUI and complete the configurations from there

I will set the LAN interface to the admin LAN (10.10.3.0)

Enter 1 to assign interfaces

em3 corresponds to Adapter 4 (cyberlab-admin)

29

Proceed

30

We need to change the IP scheme for the LAN

Enter option 2

31

Do not configure the IP address via DHCP

Set the LAN address to 10.10.3.1

Set the subnet bit count to 24

32

Do not configure IPv6

We will enable DHCP for this LAN

Enter a DHCP scope (10.10.3.10 - 10.10.3.50 in my case)

33

The IP assignments should look like this

We will configure the other interfaces through the web GUI via an Ubuntu VM

34

Next: Ubuntu Desktop VM Setup

This post is licensed under CC BY 4.0 by the author.