Ordering of NAT and Firewall Processing (2024)

  • Docs »
  • pfSense® software »
  • Network Address Translation
  • Give Feedback

Next
NAT Reflection

Previous
1:1 NAT

Understanding the order in which firewalling and NAT occurs is important whenconfiguring NAT and firewall rules. The basic logical order is illustrated byFigure Ordering of NAT and Firewall Processing. The figure also depicts where tcpdumpties in, since its use as a troubleshooting tool is described later in thisdocumentation in Packet Capturing.

Ordering of NAT and Firewall Processing (1)

Each layer is not always hit in typical configurations, but the use of floatingrules or manual outbound NAT or other more complicated configurations can hiteach layer in both directions. The diagram only covers basic scenarios forinbound and outbound traffic.

In terms of how the ruleset is processed, the order is:

  • Ethernet rules

  • Outbound NAT rules

  • Inbound NAT rules such as Port Forwards (including rdr pass and UPnP)

  • Rules dynamically received from RADIUS for IPsec and OpenVPN clients

  • Internal automatic rules (pass and block for various items like lockout,snort, DHCP, etc.)

  • User-defined rules:

    • Rules defined on the floating tab

    • Rules defined on interface group tabs (Including IPsec and OpenVPN)

    • Rules defined on interface tabs (WAN, LAN, OPTx, etc)

  • Automatic VPN rules

Firewall/NAT Processing Order Example

Traffic from LAN to WAN is processed as described in the following more detailedexample. If a type of rules do not exist or do not match, they are skipped.

  • Ethernet rules inbound on LAN

  • Port forwards or 1:1 NAT on the LAN interface (e.g. proxy or DNS redirects)

  • Firewall rules for the LAN interface:

    • Floating rules inbound on LAN

    • Rules for interface groups including the LAN interface

    • LAN tab rules

  • 1:1 NAT or Outbound NAT rules on WAN

  • Floating rules that match outbound on WAN

  • Ethernet rules outbund on WAN

In this case, port forwards on WAN and WAN tab firewall rules do not apply.

For traffic initiated on the WAN, the order is the same but direction isreversed:

  • Ethernet rules inbound on WAN

  • Port forwards or 1:1 NAT on the WAN interface (e.g. public services)

  • Firewall rules for the WAN interface:

    • Floating rules inbound on WAN

    • Rules for interface groups including the WAN interface

    • WAN tab rules

  • 1:1 NAT or Outbound NAT rules on LAN

  • Floating rules that match outbound on LAN

  • Ethernet rules outbund on LAN

tcpdump is always the first and last thing to see traffic, depending on thedirection. First, on the incoming interface before any NAT and firewallprocessing, and last on the outbound interface. It shows what is on the wire.(See Packet Capturing)

See also

See Rule Processing Order for more information about thefirewall rule processing order.

Ethernet Rules notes

Ethernet (L2) rules are processed before NAT and traditional firewall rules(Floating, group, or per-interface) in the inbound direction. For outboundtraffic, Ethernet rules are processed last after all other rules.

See also

Ethernet (Layer 2) Rules

Floating Rules notes

Floating rules without quick set process as “last match wins” instead of“first match wins”. Therefore, if a floating rule is set without quick and apacket matches that rule, then it also matches a later rule, the later rule willbe used. This is the opposite of the other tab rules (groups, interfaces) andrules with quick set which stop processing as soon as a match is made. SeeFloating Rules for more details on how floating rules operate.

Extrapolating to additional interfaces

The previous diagram and lists only illustrate a basic two interface LAN and WANdeployment. When working with additional interfaces, the same rules apply.Traffic between two internal interfaces behaves the same as LAN to WAN traffic,though the default NAT rules will not translate traffic between internalinterfaces so the NAT layer does not do anything in those cases. If Outbound NATrules exist that match traffic between internal interfaces, it will apply asshown.

Rules for NAT

On the way into an interface, NAT applies before firewall rules, so if thedestination is translated on the way in (e.g. port forwards or 1:1 NAT on WAN),then the firewall rules must match the translated destination. In the typicalcase of a port forward on WAN, this means the rule must match a destination ofthe target private IP address on LAN.

For example, with a port forward for TCP port 80 on WAN with an automaticallyadded firewall rule, Figure Firewall Rule for Port Forward to LAN Host shows theresulting firewall rule on WAN. The internal IP address on the port forward is10.3.0.15. Whether using port forwards or 1:1 NAT, firewall rules on all WANinterfaces must use the internal IP address as the destination.

Ordering of NAT and Firewall Processing (2)

On the way out of an interface, outbound NAT applies before firewall rules, soany floating rules matching outbound on an interface must match the source afterit has been translated by outbound NAT or 1:1 NAT.

Ordering of NAT and Firewall Processing (2024)
Top Articles
5 Methods of Bee Removal Without Killing Them | Classic Pest Control & Insulation
Credit Card Usage – What Lenders Want you to Know
Pet For Sale Craigslist
Hannaford Weekly Flyer Manchester Nh
Avonlea Havanese
Nfr Daysheet
Top 10: Die besten italienischen Restaurants in Wien - Falstaff
The Potter Enterprise from Coudersport, Pennsylvania
Gw2 Legendary Amulet
Crusader Kings 3 Workshop
Urban Dictionary Fov
Https //Advanceautoparts.4Myrebate.com
Connexus Outage Map
Overton Funeral Home Waterloo Iowa
Money blog: Domino's withdraws popular dips; 'we got our dream £30k kitchen for £1,000'
Byte Delta Dental
Unlv Mid Semester Classes
Procore Championship 2024 - PGA TOUR Golf Leaderboard | ESPN
Niche Crime Rate
Vigoro Mulch Safe For Dogs
Yard Goats Score
2024 INFINITI Q50 Specs, Trims, Dimensions & Prices
Viha Email Login
Dwc Qme Database
Team C Lakewood
Used Safari Condo Alto R1723 For Sale
Roane County Arrests Today
Celina Powell Lil Meech Video: A Controversial Encounter Shakes Social Media - Video Reddit Trend
Strange World Showtimes Near Savoy 16
Rainfall Map Oklahoma
Ryujinx Firmware 15
Dubois County Barter Page
Haunted Mansion Showtimes Near Cinemark Tinseltown Usa And Imax
Vistatech Quadcopter Drone With Camera Reviews
Kaiju Paradise Crafting Recipes
Chase Bank Cerca De Mí
Exploring TrippleThePotatoes: A Popular Game - Unblocked Hub
Tgh Imaging Powered By Tower Wesley Chapel Photos
oklahoma city community "puppies" - craigslist
Austin Automotive Buda
Raising Canes Franchise Cost
Mvnt Merchant Services
Dr Adj Redist Cadv Prin Amex Charge
Rs3 Bis Perks
Indio Mall Eye Doctor
888-822-3743
Craigslist Antique
Deezy Jamaican Food
Underground Weather Tropical
Zom 100 Mbti
Fishing Hook Memorial Tattoo
Dinargurus
Latest Posts
Article information

Author: Mrs. Angelic Larkin

Last Updated:

Views: 6533

Rating: 4.7 / 5 (47 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Mrs. Angelic Larkin

Birthday: 1992-06-28

Address: Apt. 413 8275 Mueller Overpass, South Magnolia, IA 99527-6023

Phone: +6824704719725

Job: District Real-Estate Facilitator

Hobby: Letterboxing, Vacation, Poi, Homebrewing, Mountain biking, Slacklining, Cabaret

Introduction: My name is Mrs. Angelic Larkin, I am a cute, charming, funny, determined, inexpensive, joyous, cheerful person who loves writing and wants to share my knowledge and understanding with you.