Configuring pfSense Firewall for Security
Security and Pentest Home Lab Environment
Configuring pfSense Firewall for Security
π§ Finishing pfSense Setup
In this module, weβll complete the setup of pfSense and configure firewall rules for the subnets in your home lab.
βοΈ pfSense General Configuration
π Web Portal Setup
- On the
Kali LinuxVM, open a browser and visit:
https://10.0.0.1 - Ignore the security warning and click:
AdvancedAccept the Risk and Continue
- Log in to the
pfSenseWeb UI using:- Username:
admin - Password:
pfsense
- Username:
- Click
Nextthrough the initial steps.
π§ General Settings
- Set a hostname and domain name for the
pfSenseVM. - Uncheck
Override DNS, then clickNext. - Set your local timezone, then click
Next. - Scroll to the RFC1918 Networks section and uncheck
Block RFC1918 Private Networks.
This is required because weβre using a private IP on the WAN interface. - Leave other settings as-is, then click
Next. - Set a new
adminpassword, store it securely, and clickReload. - Click
Finishto access thepfSensedashboard.
βοΈ Interface Renaming
Rename interfaces to make management easier:
- Go to
InterfacesβOPT1- Description:
CYBER_RANGE - Click
Saveβ thenApply Changes
- Description:
- Go to
InterfacesβOPT2- Description:
AD_LAB - Click
Saveβ thenApply Changes
- Description:
π§ DNS Resolver Configuration
- Navigate to:
ServicesβDNS Resolver - Enable all recommended options at the bottom.
- Click
Advanced Settingsand enable additional resolver options. - Click
Saveβ thenApply Changes.
β Disable DHCPv6
To prevent IPv6 address assignment on the WAN interface:
- Go to
InterfacesβWAN - Set
IPv6 Configuration TypetoNone - Click
Saveβ thenApply Changes
π Restart pfSense
Restart the VM to ensure settings take effect and the WAN interface receives an IPv4 address.
π§ Advanced Configuration
- Go to
SystemβAdvancedβNetworkingtab - Under Network Interfaces, enable performance optimization
- Click
SaveβOKto reboot
After reboot, log in with the new admin password.
π Kali Linux Static IP Assignment
- Go to
StatusβDHCP Leases - Find the
Kali LinuxVM β Click the+icon to assign a static IP - Set the IP to:
10.0.0.2β ClickSaveβApply Changes
π» Refresh IP in Kali
In Kaliβs terminal:
1
ip a l eth0
π Refresh Kali Static IP
To make sure Kali Linux uses its static IP:
π» Restart the Network Interface
In Kaliβs terminal, run:
1
sudo ip l set eth0 down && sudo ip l set eth0 up
π» Verify Kali Static IP
After restarting the network interface, confirm your Kali VM is using the static IP:
1
ip a l eth0
π₯ pfSense Firewall Configuration
π LAN Rules
- Go to:
FirewallβRulesβLANtab - Click Add rule to top
- Set:
- Action:
Block - Address Family:
IPv4+IPv6 - Protocol:
Any - Source:
LAN subnets - Destination:
WAN subnets - Description:
Block access to WAN services
- Action:
- Click Save β Apply Changes
π CYBER_RANGE Rules
π Create RFC1918 Alias
- Go to:
FirewallβAliases - Click Add under the IP tab
- Enter:
- Name:
RFC1918 - Description:
Private IPv4 Address Space - Type:
Network(s) - Networks:
10.0.0.0/8172.16.0.0/12192.168.0.0/16169.254.0.0/16127.0.0.0/8
- Name:
- Click Save β Apply Changes
π Add Rules for CYBER_RANGE
- Go to:
FirewallβRulesβCYBER_RANGE Add these rules in order:
- β
Allow intra-network traffic
- Source:
CYBER_RANGE subnets - Destination:
CYBER_RANGE address
- Source:
- β
Allow access to Kali Linux
- Source:
CYBER_RANGE subnets - Destination:
10.0.0.2
- Source:
- β
Allow traffic to public IPs only
- Source:
CYBER_RANGE subnets - Destination:
RFC1918 - Enable Invert match
- Source:
- β Block all other traffic
- Action:
Block - Address Family:
IPv4+IPv6 - Protocol:
Any - Source:
CYBER_RANGE subnets
- Action:
- β
Allow intra-network traffic
- Click Save after each rule β Apply Changes
π§± AD_LAB Rules
- Go to:
FirewallβRulesβAD_LAB Add these rules:
- β Block access to WAN
- Action:
Block - Source:
AD_LAB subnets - Destination:
WAN subnets
- Action:
- β Block access to CYBER_RANGE
- Action:
Block - Source:
AD_LAB subnets - Destination:
CYBER_RANGE subnets
- Action:
- β
Allow all other traffic
- Source:
AD_LAB subnets - Destination:
Any
- Source:
- β Block access to WAN
- Click Save after each rule β Apply Changes
π Reboot pfSense
- Go to:
DiagnosticsβReboot - Click Submit
- After reboot, youβll be redirected to the login page.
π§© Whatβs Next?
pfSense is now configured and secured. Next steps:
- Add more vulnerable VMs to
CYBER_RANGE - Test connectivity from the Kali Linux VM
This post is licensed under CC BY 4.0 by the author.