Security · 4 min read

FortiGate NSE4: NAT Rule Order When Addresses Overlap

FortiGate processes NAT rules in a strict top-to-bottom order, and when address objects or ranges overlap, the first matching rule wins. Understanding this behavior is critical for NSE4 certification and for avoiding unexpected traffic flows in production networks. This guide clarifies how FortiGate evaluates overlapping addresses and what happens when multiple NAT rules could apply to the same traffic.

How FortiGate Evaluates NAT Rules

FortiGate maintains a sequential NAT policy table. When a packet arrives, the firewall compares it against each NAT rule from top to bottom. The first rule whose source address, destination address, and service criteria all match the packet is applied immediately. No further rules are evaluated for that packet.

This first-match-wins behavior means that rule order directly determines which NAT translation occurs. If you have two rules that could both match a given packet, only the upper rule takes effect. The lower rule is ignored for that traffic, even if it is also technically valid.

Overlapping Address Scenarios

Overlapping addresses occur when two address objects or ranges share common IP space. Common scenarios include:

When overlaps exist, FortiGate does not merge or deduplicate rules. Instead, it applies the first matching rule and stops. This means a packet matching both rule A and rule B will always use rule A if rule A appears higher in the policy list.

Practical Example: Order Matters

Consider this scenario:

Rule 1: Source 10.0.1.0/24 -> Translate to 203.0.113.0/25
Rule 2: Source 10.0.1.0/25 -> Translate to 203.0.113.128/25

Incoming packet from 10.0.1.50:

The packet source 10.0.1.50 matches both rules. However, FortiGate evaluates Rule 1 first. Since 10.0.1.50 falls within 10.0.1.0 divided by 24, Rule 1 matches and is applied. The packet is translated to 203.0.113.x. Rule 2 is never evaluated for this packet.

If you reverse the rule order, packets from 10.0.1.0 to 10.0.1.127 would match Rule 2 first and translate to 203.0.113.128 divided by 25, while packets from 10.0.1.128 to 10.0.1.255 would fall through and match Rule 1.

Best Practices for Overlapping Address NAT

Verification and Troubleshooting

To verify which NAT rule is applied to a packet, use the diagnose command:

diagnose firewall iprule list
diagnose nat traversal info
diagnose debug flow filter addr <source> <dest>
diagnose debug flow trace start 99

Packet traces show the exact rule ID and translation applied. This is invaluable when troubleshooting unexpected NAT behavior or confirming that overlapping rules are processed in the intended order.

IP Range -> CIDR
Convert IP ranges to CIDR notation for precise address object definitions
Open →
Practise this on today’s Daily Ops Drill — a free network task every day.
Open the app →
Free tools for this
More from the blog
FortiGate NSE4 Lab: Implicit Deny and Why Your Permit Rule Isn't WorkingRead →Voice VLAN Bandwidth Sizing: Codec, Frame Size, and Overhead CalculationRead →