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.
After that, let’s choose the newest version of pfsense and the image type “.iso”.
Once downloaded, we can extract the file that came zipped in “.gz”.
We can extract via graphical interface as in the figure below.
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*
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.
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”.
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.
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.
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.
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.
Next, let’s click on “Create” to create a “Host-only” network.
By default, VirtualBox will create a network called “vboxnet0” and this network will be in the range “192.168.56.0/24”.
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.
In “Adapter 1” we will leave the configuration of the network adapter as NAT.
Next, let’s click on “Adapter 2”.
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.
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.
After agreeing to the terms, we will have the screen below where we will select “Install”.
Now let’s select the type of keyboard you want to use.
Now we are going to use the “Auto UFS BIOS” mode for disk partitioning.
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”.
If you accidentally clicked “Yes”, you will enter the terminal screen and can exit it using the “exit” command.
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.
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”.
After initializing the virtual machine, we will see a screen similar to the screen below.
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”.
Next, let’s select the LAN interface by typing option 2.
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.
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.
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.
After that let’s hit ENTER.
We can see that now the LAN interface has the IP 192.168.56.2.
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.
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.
We are done installing pfSense in VirtualBox here.
Data Scientist and Master in Computer Modeling by LNCC.