pfSense Firewall Rules for Beginners
Firewall rules are at the core of pfSense and define how traffic is allowed or denied across your network. This guide introduces the basics of creating and managing rules in pfSense for a secure homelab or home network.
Understanding Firewall Rule Basics
- Default Deny: pfSense blocks all traffic unless explicitly allowed.
- Rule Direction: pfSense rules are evaluated top-down on incoming traffic per interface.
- Interface Specific: Rules apply per interface (e.g., LAN, WAN, VLAN).
- First Match Wins: Only the first matching rule is applied.
Common Rule Types
Rule Type | Description |
---|---|
Allow LAN to WAN | Default rule allowing outbound internet access |
Block RFC1918 | Prevents private IPs from entering via WAN |
VLAN Isolation | Blocks traffic between VLANs unless allowed |
Port Forwarding | Forwards external traffic to internal services |
Example: Basic LAN to WAN Rule
- Go to Firewall > Rules > LAN
- Click Add to create a new rule
- Set the following:
- Action: Pass
- Interface: LAN
- Protocol: Any
- Source: LAN net
- Destination: Any
- Save and apply changes.
This allows all LAN clients to access the internet.
Example: Block VLAN10 from Accessing LAN
- Go to Firewall > Rules > VLAN10
- Add a rule:
- Action: Block
- Protocol: Any
- Source: VLAN10 net
- Destination: LAN net
- Move this rule to the top
- Save and apply.
This ensures VLAN10 can't access your main LAN.
Tips for Managing Rules
- Use aliases: Group IPs, ports, or networks for easier management.
- Add logging: Enable logging for critical rules to troubleshoot traffic.
- Name rules: Add descriptions so you know why a rule exists.
- Avoid 'Any Any Allow': Too permissive; defeats the purpose of a firewall.
Troubleshooting
- Check the Firewall Logs: Go to Status > System Logs > Firewall
- Use Diagnostics > Packet Capture to inspect traffic flow.
- Review Rule Order: Misplaced rules can unintentionally block or allow traffic.
Additional Resources
Summary
pfSense firewall rules are powerful, but must be managed with care. By understanding rule order, direction, and interface behavior, you can secure your homelab without accidentally blocking yourself out.