Applies To:
Show VersionsBIG-IP AFM
- 14.1.2, 14.1.0
Using Firewall NAT for IP and Port Translation
About using Firewall NAT to translate addresses and ports
Firewall NAT on the BIG-IP® Advanced Firewall Manager™ system supports advanced NAT functionality on the AFM™ system.
NAT matching policies
NAT policies present a configurable collection of NAT matching rules and NAT translation objects, for inbound and outbound connections. The system matches flows and applies NAT rules, after the matching for firewall rules occurs. Firewall NAT allows you to configure a rule to match traffic, to which NAT source and destination translation rules are applied. Source and destination translation items are configured individually, and can be applied to multiple rules and contexts. Generally, overlapping addresses cannot be configured in NAT source or destination rules. However, you can configure overlapping addresses between two Dynamic PAT items that have the PAT mode set to NAPT or Port Block Allocation mode.
Firewall NAT can be used on a system with F5® BIG-IP CGNAT (Carrier-Grade NAT). Firewall NAT policies operate with CGNAT policies when applied on the same virtual server.
NAT contexts and precedence
You can configure a firewall NAT policy at the global, virtual server, or route domain context. NAT address and port assignment takes place only at the virtual server level, so a Firewall NAT policy configured at the global context applies on each individual virtual server, and a firewall NAT policy configured at the route domain context applies to all virtual servers on that route domain.
Similarly, NAT policies apply precedence in most-specific to least-specific order. A firewall NAT policy configured on a virtual server takes precedence over a policy configured on the route domain context, or at the global context.
Translation address persistence
The firewall NAT feature module can assign the same external (translation) address to all connections originated by the same internal client, providing endpoint-independent address mapping.
Efficient logging
Firewall NAT supports log messages that map external addresses and ports back to internal clients for both troubleshooting and compliance with law enforcement/legal constraints.
Network address and port translation
Network address and port translation (NAPT) mode provides standard address and port translation allowing multiple clients in a private network to access remote networks using the single IP address assigned to their router.
Proxy ARP
Currently when using AFM NAT to map a range of client source addresses to a range in the same subnet as the IP address of the egress interface, the BIG-IP system does not proxy ARP for the translated source addresses.
Deterministic assignment of translation addresses
Deterministic mode is an option used to assign translation address, and is port-based on the client address/port and destination address/port. It uses reversible mapping to reduce the amount of log messages, while still maintaining the ability for translated IP address to be discovered for troubleshooting and compliance. Deterministic mode also provides an option to configure backup-members.
Port block allocation of translation addresses
Port block allocation (PBA) mode is an option that reduces logging, by logging only the allocation and release of a block of ports. When a subscriber sends a translation request, the BIG-IP system services the request from a block of ports that is assigned to a single IP address, and only logs the allocation and release of that block of ports. The BIG-IP system applies subsequent requests from the service provider to that block of ports until all ports are used.
About Firewall NAT and Carrier Grade NAT (CGNAT)
- If an LTM SNAT pool or CGNAT LSN-pool is applied to a virtual server, a Firewall NAT policy cannot then be applied to that virtual server.
- If a Firewall NAT policy is applied to a virtual server, an LTM SNAT pool or CGNAT LSN-pool cannot be applied to that virtual server. Note that this extends to all contexts at which the Firewall NAT policy can be applied. For example, if a virtual server uses a Firewall NAT policy that is applied on the route domain, an LTM SNAT pool or CGNAT LSN-pool cannot then be applied to that virtual server.
About specifying source translations for Firewall NAT
Source Translation items
With Firewall NAT, source translation rules are contained in a source translation item. This item contains address and port information for the translation pools, and configuration information for each source translation type.
Static NAT
Static NAT mode provides simple 1:1 mapping between the destination IP address and the router IP address. An equal number of internal and external IP addresses must be specified. Ports are not translated.
Static PAT
Static PAT (also known as NAPT) mode provides standard address and port translation allowing multiple clients in a private network to access remote networks using the single IP address assigned to their router. For outbound packets, Static PAT translates the source IP address and source port. For inbound packets, Static PAT translates the destination IP address, the destination port, and the IP and transport header checksums. This mode is beneficial for remote access users. NAPT is the default mode for firewall NAT source translation items.
Dynamic PAT
Dynamic PAT mode provides inbound connection configuration options and mapping options.
With Dynamic PAT you can configure inbound connections with endpoint independent filtering, which specifies that the translation attempts to reuse both the address and port mapping (X:x to X':x') for subsequent packets sent from the same internal IP address and port. The BIG-IP system attempts to map X:x to X':x' in every session. This is called Endpoint Independent Mapping in section 4.1 of RFC 4787.
Dynamic PAT also allows you to configure the following mapping modes.
- Address pooling paired
- Enables all sessions associated with an internal IP address to map to the same external IP address for the duration of the session.
- Endpoint independent mapping
- Enables use of the same external address and port for all connections from the host, if it uses the same internal port.
Deterministic Mode
With Dynamic PAT, you can configure a source translation item to use deterministic mode. Deterministic mode maps internal addresses to external addresses algorithmically, which significantly reduces the amount of log entries generated, while mapping a subscriber's inside IP address with an outside Internet address and port.
Port Block Allocation Mode
With Dynamic PAT, you can configure a source translation item to use port block allocation (PBA) mode. Port block allocation mode is a translation mode option that reduces logging, by logging only the allocation and release of each block of ports. When a subscriber first establishes a network connection, the BIG-IP system reserves a block of ports on a single IP address for that subscriber. The system releases the block when no more connections are using it. This reduces the logging overhead because the system logs only the allocation and release of each block of ports. When a subscriber first connects, the PBA translation mode applies client port block limits, which the subscriber uses as long as it has addresses allocated. For each subscriber, PBA mode compares the subscriber's allocated number of port blocks to the port block limit for the currently connected pool. If the allocated number of port blocks exceeds the port block limit, then the connection is denied. For example, if a subscriber's allocated number of port blocks is 2, and the port block limit for the currently connected pool is 1, then the connection is denied.
Client Connection Limit
In Dynamic PAT modes, you can configure a client connection limit. This allows you to specify the maximum number of simultaneous translated connections a client or subscriber is allowed to have.
Hairpin Mode
In Dynamic PAT modes, you can configure hairpin mode. When a client sends a packet to another client in the same private network,hairpin mode sends the packet directly to the destination client's private address. The BIG-IP system immediately translates the packet's public-side destination address. Rather than going out to the public network and returning later for translation, the packet takes a "hairpin turn" at the BIG-IP device.
Exclude Addresses
In Dynamic PAT modes, when you add a source or destination translation item, you can specify addresses to exclude from source translation in the Excluded Address field.
Specifying source IP addresses for static NAT
Specifying source IP addresses for static PAT
Specifying source IP addresses for deterministic dynamic PAT
Specifying source IP addresses for dynamic PAT with NAPT
Specifying source IP addresses for port block allocation mode
About specifying destination translations for Firewall NAT
Destination Translation items
With Firewall NAT, destination translation rules are contained in a destination translation item. This item contains address and port information for the translation pools, and configuration information for each destination translation type.
Static NAT
Static NAT mode provides simple 1:1 mapping between the destination IP address and the router IP address. An equal number of internal and external IP addresses must be specified. Ports are not translated.
Static PAT
Static PAT (also known as NAPT) mode provides standard address and port translation allowing a single IP address to access remote networks using the single IP address assigned to their router. For outbound packets, Static PAT translates the source IP address and source port. This mode is beneficial for remote access users.
Specifying destination IP addresses for static NAT
Specifying destination IP addresses for static PAT
About creating Firewall NAT policies
Firewall NAT policies collect rules to provide NAT address and port translation for source and destination addresses, including match rules for addresses and protocols, and translation rules for source and destination. You can attach a NAT policy at the device level, a route domain, or to a virtual server.
Creating a NAT policy
Creating a NAT match rule
About specifying NAT context for a Firewall NAT policy
You can configure a firewall NAT policy at the global, virtual server, or route domain context. NAT address and port assignment takes place only at the virtual server level, so a Firewall NAT policy configured at the global context applies on each individual virtual server, and a firewall NAT policy configured at the route domain context applies to all virtual servers on that route domain.
NAT policies apply precedence in most-specific to least-specific order. A firewall NAT policy configured on a virtual server takes precedence over a policy configured on the route domain context, or at the global context.
When you specify a NAT policy on a virtual server, you can configure the virtual server to use either the route domain policy, the device policy, or both. Orders of precedence still apply, and the most specific NAT policy is applied.