Network Address Translation (NAT) is a fundamental technology used to modify network address information (IP addresses and sometimes ports) in packet headers as they transit through a routing device, like a Palo Alto Networks firewall. This is essential for conserving public IP addresses, hiding internal network structures, and enabling communication between networks with overlapping addresses.
A key concept on Palo Alto firewalls is the separation of NAT policy and Security policy . NAT rules determine *if and how* addresses/ports are translated, while Security rules determine *if traffic is allowed* based on zones, addresses, ports, applications, and users.
Source NAT modifies the source IP address (and often the source port) of packets, typically as they leave a private network and enter a public network (like the internet). Its primary goal is to allow many internal (private IP) devices to share a single or a few public IP addresses for outbound communication.
Allowing users on an internal network (e.g., 192.168.1.0/24) to browse the internet using the firewall's external (public) IP address.
192.168.1.50
(Internal Client)
51000
(Ephemeral)
8.8.8.8
(Public Web Server)
443
(HTTPS)
203.0.113.10
(Firewall's Public IP - SNAT Applied)
61000
(Often translated - PAT)
8.8.8.8
(Unchanged)
443
(Unchanged)
The firewall keeps track of this translation in its session table so return traffic from
8.8.8.8
to
203.0.113.10:61000
can be translated back to
192.168.1.50:51000
.
Typically involves specifying the original source zone/address and the desired translated source (e.g., interface address, specific IP, dynamic IP pool).
Destination NAT modifies the destination IP address (and often the destination port) of packets, typically as they arrive from a public network destined for a service hosted on a private network. It allows external clients to reach internal servers using a public IP address.
Making an internal web server (e.g., 10.1.1.100) accessible from the internet via the firewall's public IP address (e.g., 203.0.113.10) on port 80/443.
198.51.100.5
(External Client)
52000
(Ephemeral)
203.0.113.10
(Firewall's Public IP)
443
(HTTPS)
198.51.100.5
(Unchanged by DNAT)
52000
(Unchanged by DNAT)
10.1.1.100
(Internal Server IP - DNAT Applied)
443
(Can be translated, but often same)
Return traffic from
10.1.1.100
back to
198.51.100.5
will have its source IP translated back to
203.0.113.10
by the firewall.
Requires specifying the original destination address/port (public) and the translated destination address/port (private).
U-Turn NAT allows a user on an internal network to access another resource on the same or different internal network by using the resource's public IP address (the address external users would use).
An internal user (192.168.1.50) needs to access the company's internal web server (10.1.1.100) using its public domain name which resolves to the firewall's public IP (203.0.113.10). Without U-Turn NAT, the traffic might hairpin at the firewall and fail, or the firewall might block it because the source and destination are both internal but trying to use an external address.
U-Turn NAT typically requires a combination of NAT rules:
Correct zone configuration and Security rules are also essential for U-Turn NAT to function.
Requires careful crafting of both DNAT and SNAT rules, often matching traffic coming *from* internal zones destined *to* the public IP address.
Understanding how NAT and Security policies interact is critical for troubleshooting and correct configuration.
Key Processing Order (Simplified):
NAT and Security rules work together. A packet must be permitted by a Security rule *and* will be translated if it matches a NAT rule. If either policy lookup fails (no matching allow rule in Security, or an explicit deny), the traffic is dropped. If a flow matches an allow Security rule but no NAT rule (and NAT is required, e.g., private to public), the flow might also fail.