Firewalling Fundamentals | pfSense Documentation (2024)

This section deals primarily with introductory firewall concepts and lays theground work for understanding how to configure firewall rules using pfSense®software.

Basic Terminology

Rule and ruleset are two terms used throughout this chapter:

Rule:

Refers to a single entry on the Firewall > Rules screen. A rule instructsthe firewall how to match or handle network traffic.

Ruleset:

Refers to a group of rules collectively. Either all firewall rules as awhole, or a set of rules in a specific context such as the rules on aninterface tab. The complete firewall ruleset is the sum of all user configuredand automatically added rules, which are covered further throughout thissection.

Rulesets on the Interface tabs are evaluated on a first match basis.This means that reading the ruleset for an interface from top to bottom, thefirst rule that matches will be the one used by the firewall. Evaluation stopsafter reaching this match and then the firewall takes the action specified bythat rule. Always keep this in mind when creating new rules, especially whencrafting rules to restrict traffic. The most permissive rules should be towardthe bottom of the list, so that restrictions or exceptions can be made abovethem.

Note

The Ethernet and Floating tabs are exceptions to this rule processinglogic. See Ethernet (Layer 2) Rules and Floating Rules for details.

Stateful Filtering

pfSense software is a stateful firewall, which means it remembers informationabout connections flowing through the firewall so that it can automaticallyallow reply traffic. This data is retained in the State Table. Theconnection information in the state table includes the source, destination,protocol, ports, and more: Enough to uniquely identify a specific connection.

Using this mechanism, traffic need only be permitted on the interface where itenters the firewall. When a connection matches a pass rule the firewallcreates an entry in the state table. Reply traffic to connections isautomatically allowed back through the firewall by matching it against the statetable rather than having to check it against rules in both directions. Thisincludes any related traffic using a different protocol, such as ICMP controlmessages that may be provided in response to a TCP, UDP, or other connection.

See also

See andState Type for more information about state optionsand types.

Note

This does not apply to Ethernet (Layer 2) Rules which do not keep state, or torules which have manually disabled the keep state option.

State Policy

The behavior of state matching can be fine-tuned by changing the State Policy toeither strictly bind states to interfaces and only match on those interfaces(“Interface Bound States”) or it can be more relaxed and ignore the interfacewhen matching packets to states (“Floating States”).

This behavior can be changed globally() and on a per-rule basis(Firewall Rule Configuration, Advanced Options, State Policy).

State table size

The firewall state table has a maximum size to prevent memory exhaustion. Eachstate takes approximately 1 KB of RAM. The default state table size in pfSenseis calculated by taking about 10% of the RAM available in the firewall bydefault. On a firewall with 1GB of RAM, the default state table size can holdapproximately 100,000 entries.

See also

See Large State Tables for more information on state tablesizing and RAM usage.

Each user connection typically consists of two states: One created as it entersthe firewall, and one as it leaves the firewall. Therefore, with a state tablesize of 1,000,000, the firewall can handle approximately 500,000 user sessionsactively traversing the firewall before any additional connections will bedropped. This limit can be increased as needed so long as it does not exceed theavailable amount of RAM in the firewall.

To increase the state table size:

  • Navigate to System > Advanced on the Firewall & NAT tab

  • Enter the desired number for Firewall Maximum States, or leave the boxblank for the default calculated value. See FigureIncreased State Table Size to 2,000,000

  • Click Save

Firewalling Fundamentals | pfSense Documentation (1)

Historical state table usage is tracked by the firewall. To view the graph:

  • Navigate to Status > Monitoring

  • Click Firewalling Fundamentals | pfSense Documentation (2) to expand the graph options

  • Set Category for the Left Axis to System

  • Set the Graph for the Left Axis to States

  • Click Firewalling Fundamentals | pfSense Documentation (3) Update Graphs

Block vs. Reject

There are two ways to disallow traffic using firewall rules on pfSense:Block and reject.

A rule set to block will silently drop traffic. A blocked client will notreceive any response and thus will wait until its connection attempt times out.This is the behavior of the default deny rule in pfSense software.

A rule set to reject will respond back to the client for denied TCP and UDPtraffic, letting the sender know that the connection was refused. Rejected TCPtraffic receives a TCP RST (reset) in response, and rejected UDP trafficreceives an ICMP unreachable message in response. Though reject is a validchoice for any firewall rule, IP protocols other than TCP and UDP are notcapable of being rejected; These rules will silently drop other IP protocolsbecause there is no standard for rejecting other protocols.

Deciding Between Block and Reject

There has been much debate amongst security professionals over the years as tothe value of block vs. reject. Some argue that using block makes more sense,claiming it “slows down” attackers scanning the Internet. When a rule is set toreject, a response is sent back immediately that the port is closed, while blocksilently drops the traffic, causing the attacker’s port scanner to wait for aresponse. That argument does not hold water because every good port scanner canscan hundreds or thousands of hosts simultaneously, and the scanner is notstalled waiting for a response from closed ports. There is a minimal differencein resource consumption and scanning speed, but so slight that it shouldn’t be aconsideration.

If the firewall blocks all traffic from the Internet, there is a notabledifference between block and reject: Nobody knows the firewall is online. Ifeven a single port is open, the value of that ability is minimal because theattacker can easily determine that the host is online and will also know whatports are open whether or not the blocked connections have been rejected by thefirewall. While there isn’t significant value in block over reject, the bestpractice is to use block on WAN rules. There is some value in not activelyhanding information to potential attackers, and it is also a bad practice toautomatically respond to an external request unnecessarily.

For rules on internal interfaces the best practice is to use reject in mostsituations. When a host tries to access a resource that is not permitted byfirewall rules, the application accessing it may hang until the connection timesout or the client program stops trying to access the service. With reject theconnection is immediately refused and the client avoids these hangs. This isusually nothing more than an annoyance, but it is still a good idea to usereject to avoid potential application problems induced by silently droppingtraffic inside a network.

Firewalling Fundamentals | pfSense Documentation (2024)
Top Articles
3 Steps To Transfer From Phantom Wallet To Binance | Financially Independent Pharmacist
How Can I See What Apps My Child Has Downloaded?
Uca Cheerleading Nationals 2023
Dlnet Retiree Login
Obor Guide Osrs
Kokichi's Day At The Zoo
Here are all the MTV VMA winners, even the awards they announced during the ads
Learn How to Use X (formerly Twitter) in 15 Minutes or Less
Current Time In Maryland
A rough Sunday for some of the NFL's best teams in 2023 led to the three biggest upsets: Analysis - NFL
Conan Exiles Colored Crystal
Weather Rotterdam - Detailed bulletin - Free 15-day Marine forecasts - METEO CONSULT MARINE
All Obituaries | Buie's Funeral Home | Raeford NC funeral home and cremation
Zoe Mintz Adam Duritz
Uta Kinesiology Advising
ABCproxy | World-Leading Provider of Residential IP Proxies
Raz-Plus Literacy Essentials for PreK-6
Homeaccess.stopandshop
2013 Ford Fusion Serpentine Belt Diagram
Where to eat: the 50 best restaurants in Freiburg im Breisgau
All Breed Database
Sec Baseball Tournament Score
Rogue Lineage Uber Titles
Обзор Joxi: Что это такое? Отзывы, аналоги, сайт и инструкции | APS
Airline Reception Meaning
Jackie Knust Wendel
Netspend Ssi Deposit Dates For 2022 November
Nikki Catsouras: The Tragic Story Behind The Face And Body Images
Poe T4 Aisling
How Much Is An Alignment At Costco
Indiana Jones 5 Showtimes Near Jamaica Multiplex Cinemas
Everything You Need to Know About NLE Choppa
Wednesday Morning Gifs
Closest 24 Hour Walmart
A Man Called Otto Showtimes Near Amc Muncie 12
Reborn Rich Ep 12 Eng Sub
450 Miles Away From Me
Mvnt Merchant Services
140000 Kilometers To Miles
US-amerikanisches Fernsehen 2023 in Deutschland schauen
Dragon Ball Super Super Hero 123Movies
Scythe Banned Combos
Copd Active Learning Template
Zom 100 Mbti
Craigslist Sparta Nj
Blippi Park Carlsbad
Blog Pch
Craiglist.nj
March 2023 Wincalendar
Divisadero Florist
Suzanne Olsen Swift River
Bumgarner Funeral Home Troy Nc Obituaries
Latest Posts
Article information

Author: Rubie Ullrich

Last Updated:

Views: 5892

Rating: 4.1 / 5 (72 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Rubie Ullrich

Birthday: 1998-02-02

Address: 743 Stoltenberg Center, Genovevaville, NJ 59925-3119

Phone: +2202978377583

Job: Administration Engineer

Hobby: Surfing, Sailing, Listening to music, Web surfing, Kitesurfing, Geocaching, Backpacking

Introduction: My name is Rubie Ullrich, I am a enthusiastic, perfect, tender, vivacious, talented, famous, delightful person who loves writing and wants to share my knowledge and understanding with you.