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 Linux
VM, open a browser and visit:
https://10.0.0.1
- Ignore the security warning and click:
Advanced
Accept the Risk and Continue
- Log in to the
pfSense
Web UI using:- Username:
admin
- Password:
pfsense
- Username:
- Click
Next
through the initial steps.
π§ General Settings
- Set a hostname and domain name for the
pfSense
VM. - 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
admin
password, store it securely, and clickReload
. - Click
Finish
to access thepfSense
dashboard.
βοΈ 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 Settings
and 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 Type
toNone
- 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
βNetworking
tab - Under Network Interfaces, enable performance optimization
- Click
Save
βOK
to reboot
After reboot, log in with the new admin
password.
π Kali Linux Static IP Assignment
- Go to
Status
βDHCP Leases
- Find the
Kali Linux
VM β 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
βLAN
tab - 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/8
172.16.0.0/12
192.168.0.0/16
169.254.0.0/16
127.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.