Virtualizing pfSense Software with Hyper-V¶
This article is about running pfSense® software in a virtual machine under Microsoft Hyper-V. The guide applies to any Hyper-V version, desktop or server (this includes the standalone Hyper-V Server). The guide explains how to install any major pfSense software version under Hyper-V. Article covers the Hyper-V networking setup and pfSense software virtual machine setup process. The guide does not cover how to install Hyper-V or Windows Server. A basic, working, pfSense software virtual machine will exist by the end of this article.
Note
If pfSense software will be used as a perimeter firewall for an organization and the attack surface should be minimized, the best practice is typically to run the firewall non-virtualized on stand-alone hardware. That is a decision for the user and/or organization to make, however.
This guide starts at a point with a Windows and the Hyper-V role installed. If other VMs are already running on Hyper-V, then it is not likely necessary to follow the networking steps too closely. However, skim through it to see what is suggested before building the pfSense software virtual machine part.
Assumptions¶
Hyper-V host is up and Hyper-V role/feature has been installed
The reader has an basic understanding of networking and Hyper-V virtualization
Basic Hyper-V Networking¶
To virtualize pfSense software, first create two Virtual Switches via Hyper-V Manager.
Open the Hyper-V Manager
Click Virtual Switch Manager from the Actions menu
Select Private for the type of virtual switch
Click Create Virtual Switch
Set the Name for the newly added switch to
LAN
Set an appropriate description in the Notes field
Ensure the Connection type is set to Private network
Click Apply
Now create a switch for the WAN/Upstream networks:
Click New virtual network switch
Select External for the type of virtual switch
Click Create Virtual Switch
Set the Name for the newly added switch to
WAN
Set an appropriate description in the Notes field
Select the appropriate interface for the External network
This is the interface on the Windows host which connects to the upstream/WAN switch/CPE or similar uplink.
Uncheck Allow management operating system to share this network adapter if the hypervisor host has a dedicated interface for WAN.
For the purpose of this guide the management was allowed, however production use requires a separate NIC for WAN.
Click OK to complete the switch setup
Creating the virtual machine¶
After creating WAN and LAN switches, move to virtual machine creation.
Click New > Virtual Machine from the Actions list
This starts the new virtual machine wizard.
Click Next and proceed to the Specify Name and Location step
Enter a Name for the virtual machine, such as
pfSense
Click Next and proceed to the Specify Generation step
Select the appropriate virtual machine generation: Generation 2
Click Next and proceed to the Assign Memory step
Add enough RAM to meet the requirements of this environment
This guide uses 1GB (
1024
MB). 2GB is better if this VM will run multiple packages.Click Next and proceed to the Configure Networking step
Select WAN from Connection drop-down menu
The LAN will be added later after completing the wizard.
Click Next and proceed to the Connect Virtual Hard Disk step
Select Create a virtual hard disk
Assign
10
to20
GB for the VM diskDisk-intensive tasks such as packages for IDS/IPS or proxies may require larger disk sizes.
Click Next and proceed to the Installation Options step
Select Install an operating system from a bootable image file
Browse to the pfSense software installer ISO image
Click Next to display the summary at the end of the wizard
Review the virtual machine information
Click Finish if all of the information is correct
This completes the wizard but there are several items which must be set on the VM for it to successfully install and boot pfSense software.
Select the VM in the Virtual Machines list in the Hyper-V Manager
Click Settings on the Actions panel for this VM
Select Add Hardware under Hardware in the left side panel
Select Network Adapter
Set the Virtual Switch to the LAN switch created earlier
Click Apply
Select Security under Hardware in the left side panel
Uncheck Enable Secure Boot
Warning
Secure boot must be disabled for the VM to boot pfSense software.
Click Apply
Select Firmware under Hardware in the left side panel
Select the Hard Drive entry in the Boot Order list
Click Move Up until the Hard Drive entry is at the top of the list
Click Apply
Review the other VM settings and make the WAN and LAN switches are selected under the respective network adapters
Click OK
Installing pfSense Software¶
After successfully creating and configuring the pfSense software virtual machine, it’s time to start it.
Select the VM in the Virtual Machines list in the Hyper-V Manager
Click Start from the VM menu in the Actions panel
Click Connect… from the VM menu to open a console for the VM
Wait for the virtual machine to boot and launch the installer
Read and accept the EULA to display the installation menu
Proceed through the installation as usual.
See also
See Installation Walkthrough for a detailed walkthrough of the installation process.
Finish the installation, select reboot, and eject the ISO from the Media menu of the VM console
The VM will restart and begin its first boot.
First boot and interfaces assignment¶
The pfSense software virtual machine should boot up quickly and prompt for interface assignments.
Enter
n
and press theEnter
key to skip the VLAN setupEnter
hn0
and press theEnter
key when prompted for the name of the WAN interfaceEnter
hn1
and press theEnter
key when prompted for the name of the LAN interfaceEnter
y
and press theEnter
key to proceed
Tip
The MAC addresses printed on the console can be verified against the virtual machine settings to confirm which interface is which.
After assigning interfaces, pfSense software will finish the boot-up. Verify both interfaces have the correct IP addresses.
Congratulations! The virtual machine is now running pfSense software on Microsoft Hyper-V.
From here, proceed through the configuration process for pfSense software as usual. See Configuration for details.