PFSense
This page covers some initial configuration and use cases for a PFSense.
Last updated
This page covers some initial configuration and use cases for a PFSense.
Last updated
PFSense is an open-source firewall/router based on the FreeBSD Os. This puts it in a similar category to OpenSense and the two are very similar. PFSense is virtual which removes some gear overhead when pushing out and it also allows scalability since it can have a high number of interfaces and networks attached to it. Below is the link to the documentation for more specific information, but this document will go over the basic things we use it for.
When assigning interfaces on PFSense, sometimes it can shift around NIC's so it's important to, when you are assigning interfaces, confirm what the MAC address is on your hypervisor. On ESXi, this can be seen by selecting the VM and opening the drop-down for the port group. There you will see the MAC of the NIC.
On PFSense Web, go into the Interfaces tab and select each Interface and give it the proper IPv4/IPv6 configuration
Once your interfaces are properly configured you can set up NAT rules for each of your tools. Typically you want to only NAT through the IPs and Ports actively in use by our tools such as Beats, or Splunk. Also allowing through any traffic directed outwards to things such as a remote rocket chat server, or file share.
For the below demonstration on NAT rules the customer network is 192.168.228.0/24 and DCO's internal IP scheme is 20.0.0.0/24. This will be simulating setting a NAT for a Splunk indexer headed to 20.0.0.10:9997
On PFSense Web open Firewall -> NAT -> Port Forward
Add a new rule
For the interface, select the interface from which traffic is coming. In this instance, traffic is coming from the customer network which is typically the WAN interface
Set the Address family and protocol to fit your environment. For us, IPv4/TCP
Select a source if traffic is coming from a specific IP
For destination select the WAN address. This IP is for where the traffic ON THE OUTSIDE of the NAT is going to, typically the address you have your PFSense connected to the customer switch
Destination port range select 9997 for Splunk Indexer
Redirect target IP select "Single Host" and put your internal IP. In this case 20.0.0.10 for our Splunk server
Redirect target Port select "other" and use the same IP as the outside 9997
Finally, add a description to it and select save. Apply the changes and your NAT is complete
In some instances, you have multiple networks on the other side of one interface and you need to tell PFSense where to direct that traffic. This is where setting Gateways and Static routes will help. See the below image for an example
On PFSense Web open System -> Routing -> Gateways
Add a new Gateway
Interface is where the other networks lay. In this case LAN
Name your gateway
The Gateway IP Address will be the default gateway of that interface. In this case. 20.0.0.1
Add a description and select Save
Go to the "Static routes" tab
The destination network is the other network that lies on the other side of the interface you selected for the gateway. In this case 30.0.0.0/24
Apply the gateway you created. This tells PFSense to send any traffic bound for the Destination network to that gateway
Save and apply settings.