Install pfSense on VirtualBox

We present a tutorial for installing pfSense in VirtualBox. This tutorial aims to teach how to create a pfSense virtual machine that can be accessed using the user’s real machine.

Acquiring the pfSense image 

To download pfSense, we will access the pfSense website and then access the Downloads section. 

https://www.pfsense.org/download/

After that, let’s choose the newest version of pfsense and the image type “.iso”. 

PfSense Image

Once downloaded, we can extract the file that came zipped in “.gz”. 

We can extract via graphical interface as in the figure below. 

Extract pfsense image

Or we can extract via terminal using the gzip command. 

To do this, let’s go to the directory where we downloaded the pfSense image and run the command below to unzip the file ending in “.gz”. 

gzip -d pfSense* 
extract pfsense image from terminal

After unpacking we will see the uncompressed pfSense image with the ending “.iso”.

Creating the virtual machine in VirtualBox 

Now, let’s open VirtualBox and select the “New” option to create a new virtual machine. 

add new MV virtualbox

Next, let’s name our virtual machine. In this case, we are naming it “my pfsense”. In the part of “ISO Image”, we will select the image that we unzip “iso”. After that, we will select in “Type = BSD” and “Version = FreeBSD 64 bit”.

pfsense configuration virtualbox

Now let’s choose the amount of RAM that the machine will have. In this case we are choosing 1024 and this value can be changed later.  

Regarding the processor, we are leaving only 1 core initially. Depending on your demand, you can increase the amount of RAM and processors in the virtual machine.

pfsense memory virtualbox

Now let’s select the virtual disk size that will be used for pfSense. In this case we will leave it as 16GB. It is worth mentioning that in our case the size of the machine will rarely reach 16GB.

pfsense disk size virtualbox

Next, we will have the summary screen about the settings of our virtual machine. In this case, we will click on “Finish” to finish this virtual machine creation phase.

pfsense summary virtualbox

Creating a host-only interface in VirtualBox 

Let’s create a host-only network in virtualbox. The reason for creating this network is to allow your real machine to access the pfsense LAN interface.  

Note. Creating a “host-only” network is optional, as the user could use virtualbox's network in bridge mode and access the pfsense LAN on his internal network. However, we believe that using the “host-only” network is the most suitable for this learning scenario. 
create host only network virtualbox

Next, let’s click on “Create” to create a “Host-only” network.

create host only network IP virtualbox

By default, VirtualBox will create a network called “vboxnet0” and this network will be in the range “192.168.56.0/24”.

Interface vboxnet0 virtualbox

Create networks pfsense in VirtualBox 

Now, we can verify that a virtual machine has been created with the name we gave earlier “my pfsense”.  

Let’s right-click on our virtual machine and select Settings.

configuring network virtualbox pfsense

In “Adapter 1” we will leave the configuration of the network adapter as NAT.  

Next, let’s click on “Adapter 2”.

configuring network virtualbox pfsense adapter1

In “Adapter 2” we will select the “Enable Network Adapter” and in “Attached to” we will select the option “Host-only Adapter” with the “Name” containing the name of our host-only network (vboxnet0).  

After that, let’s click OK.

configuring network virtualbox pfsense adapter2

Starting pfsense in the virtual machine 

Now, let’s select our virtual machine and click on Start or we can double click on our virtual machine and it will start.

start virtualbox pfsense

After agreeing to the terms, we will have the screen below where we will select “Install”.

install virtualbox pfsense

Now let’s select the type of keyboard you want to use.

install virtualbox pfsense keyboard

Now we are going to use the “Auto UFS BIOS” mode for disk partitioning.

install virtualbox pfsense BIOS

After the installation steps, we will see a screen like the one in the figure below, demonstrating that the installation is finished. So let’s click on “No”.

install virtualbox pfsense finish

If you accidentally clicked “Yes”, you will enter the terminal screen and can exit it using the “exit” command.

install virtualbox pfsense exit

After that, we will see the screen that asks if you want to “Reboot”. Before rebooting the virtual machine we need to disconnect the ISO image of our virtual machine media driver.

install virtualbox pfsense reboot

To disconnect the ISO image from our virtual machine, we can right-click on the image that resembles a disk in the lower corner and then click on “Remove disk from virtual drive”.

remove virtualdisk virtualbox

After initializing the virtual machine, we will see a screen similar to the screen below.

pfsense first screen

Changing pfSense LAN IP 

Let’s change the LAN IP to be compatible with the VirtualBox host-only IP. This way, we will be able to use VirtualBox’s host-only network to access our pfsense web interface. 

To change the IP of the LAN interface, type option 2 = “Set Interface(s) IP address”.

pfsense virtualbox change IP

Next, let’s select the LAN interface by typing option 2.

pfsense virtualbox change LAN IP

Now let’s give the IP for the LAN interface within the IP range of our host-only network. In this case we are inserting the IP 192.168.56.2 for the LAN interface and mask 24.

pfsense virtualbox change LAN masc

Now let’s press Enter.

And then we’re going to press ENTER again because we don’t want to enter IPv6.

Then let’s type y to enable a DHCP server on the LAN interface. This part is optional. However enabling DHCP on the LAN interface will allow automatically giving IPs to clients that connect on the pfSense LAN. 

In addition, we insert a range of IPs that can be donated in DHCP between 192.168.56.100 to 192.168.56.200.

pfsense virtualbox LAN DHCP

Then comes the question if we want to revert the WEB configuration to use HTTP. In this case we don’t, so we’re going to type n.

pfsense virtualbox WEBconfig

After that let’s hit ENTER.

pfsense virtualbox LAN summary

We can see that now the LAN interface has the IP 192.168.56.2.

pfsense virtualbox LAN new IP

Accessing the pfSense WEB Interface 

Now we are going to use our LAN IP to access the pfsense web interface. To do this, let’s open a browser and type 192.168.56.2

After that we will type the username = admin and the password = pfsense.

pfsense virtualbox login

And finally we enter the pfSense configuration page. Now we can follow the Configuration Wizard or select the option we want from the top menu.

pfsense virtualbox start page

We are done installing pfSense in VirtualBox here.

Juliana Mascarenhas

Data Scientist and Master in Computer Modeling by LNCC.
Computer Engineer

See more:

Configure Load Balance with PfSense

Configure Failover in PfSense

Snort PfSense : Detect DoS Attack

How DNS works

Increase VirtualBox disk size

How to use Ngrok

We will present a tutorial to install Ngrok and how to use Ngrok on Windows…
Read More