This help contains the following topics:
Network Address Translation (NAT) translates an IP address in the IP packet header to another IP address. Typically, NAT is configured on gateways to enable private hosts to access external networks and external hosts to access private network resources such as a Web server.
Policy-based NAT contains a set of NAT rules to identify and translate matching packets. The packet match criteria include source security zone, destination security zone, source IP address, destination IP address, and service.
Policy-based NAT is applicable to the scenario where the external interface is not fixed. You do not need to change relevant configurations if the external interface changes, which reduces maintenance costs.
Policy-based NAT supports the following types of rules, which are applicable to different scenarios:
Policy-based NAT supports the following translation modes:
Table-1 describes the address translation configuration available for many-to-many NAT in different scenarios.
Table-1 Many-to-many NAT configuration guide
Application scenario | Item | |
Public network (destination IP addresses and services in the original packets) | Private network (IP addresses and ports after destination address translation) | |
External users can use one public address to access internal servers | One public address | One private address |
External users can use one public address and one public port to access internal servers | One public address and one public port number | One private address and one private port number |
External users can use one public address and multiple different public port numbers to access internal servers | One public address and | |
One public address and | One private address and | |
External users can use multiple different public addresses to access internal servers | ||
External users can use multiple different public addresses and one public port number to access internal servers | One private address and | |
If only one NAT device is deployed in the internal network, internal users cannot access the external network when the NAT device fails. To avoid this situation, configure a two-node hot backup system to provide redundant NAT services. The two devices in the system synchronize session entries, session relation entries, NAT port block entries, and NAT configurations through the hot backup channel. When one device fails, the other device takes over. For more information about configuring a hot backup system, see "Hot backup".
Typically, the master device in the VRRP group processes NAT services in the hot backup system. On an active/standby hot backup system, some translation rules for static, source, or destination address translation issue the translated public IP addresses or the public IP addresses of internal servers to the address management module. Then, both the active and standby devices advertise the mappings between the public IP addresses and MAC addresses of their own physical interfaces to all nodes in the same LAN or local link. As a result, the upstream Layer 3 device directly connected to the hot backup system might incorrectly send downlink packets to a VRRP backup device, causing service anomalies. This issue might also occur on a dual-active hot backup system.
To avoid such an issue, bind address translation methods to the VRRP group in use. This ensures that only the VRRP master device responds to the ARP requests or NS requests for the translated public IP addresses or the public IP addresses of internal servers. The MAC addresses in the responses are the virtual MAC address of the VRRP group.
Support of non-default vSystems for this feature depends on the device model. This feature is available on the Web interface only if it is supported.
Policy NAT has higher priority than interface NAT for the traffic that matches both of them.
By default, the NAT rules in policy-based NAT are sorted in descending order of their configuration order. You can rearrange NAT rules to change their priorities. A rule has a higher priority than rules listed after it.
If you select
A NAT address group cannot be used by both PAT and NO-PAT modes.
If a packet matches both a policy-based NAT rule and an interface NAT rule, the packet is translated as follows:
For source and destination address translation method:
If the translation methods of the policy-based NAT rule and the interface NAT rule are the same, the device translates the packet by using the policy-based NAT rule.
If the translation methods of the policy-based NAT rule and the interface NAT rule are different, the device translates the packet by using the two rules.
If the translation method of the policy-based NAT rule is bidirectional, the device translates the packet by using the policy-based NAT rule, and the interface NAT rule does not take effect.
When you add address ranges to a NAT address group, make sure address ranges do not overlap.
The address object group used by a NAT rule cannot contain a host name.
Referencing an address object group that contains an object group or wildcard mask might affect configuration performance and traffic matching performance. As a best practice to ensure network stability and smoothness, do not use an object group or wildcard mask to add objects.
The number of IP addresses in all NAT address groups cannot be smaller than the number of security engines. Otherwise, some security engines cannot obtain NAT address resources.
NAT can be performed in the inbound or outbound direction.
Figure-1 NAT on an inbound security zone
Figure-2 NAT on an outbound security zone
Policy-based NAT supports packet match criteria including security zone, address object group, and service object group. Policy-based NAT supports source address translation, destination address translation, and source and destination address translation. Figure-3 shows the configuration flowchart.
Figure-3 Policy-based NAT configuration flowchart
Complete the following tasks before you configure this feature:
Assign IP addresses to interfaces on the
Configure routes on the
Create security zones on the
Add interfaces to security zones. You can add interfaces to a security zone on the
Configure security policies to permit the target traffic on the
(Optional.) Create a security zone. (Details not shown.)
(Optional.) Create an address object group. For more information, see "Object groups."
(Optional.) Create a service object group. (Details not shown.)
(Optional.) Create a NAT address group.
Click the
In the navigation pane, select
Click
Create a NAT address group.
Click
Create a policy-based NAT44 rule.
Click the
In the navigation pane, select
Select a translation mode as required.
Figure-4 Selecting a translation mode
Table-2 Translation mode description
Translation mode | Description |
Create SNAT | Translates the source address information of packets. |
Create DNAT | Translates the destination address information of packets. |
Create SNAT+DNAT | Translates both the source and destination address information of packets. |
Click the
Figure-5 Configuring a policy-based NAT44 rule
Table-3 Configuration items for policy-based NAT44 rules
Item | Description | ||
When IP addresses match the following criteria | Source zone | Select source security zones for packet match. | |
Destination zone | Select destination security zones for packet match. This field is displayed only when you select the | ||
Source IP | Select a source IP address, IP subnet, or address object group for packet match. | ||
Destination IP | Select a destination IP address, IP subnet, or address object group for packet match. If the translation mode is destination address translation or source and destination address translation, this field must be specified. | ||
Service | Select a service object group for packet match. | ||
Translate source IP addresses to | Translation mode | Select a source address translation method:
| |
Address | Select a NAT address type for source address translation:
| ||
Source IP after NAT | Select a NAT address for source address translation. | ||
Associated IPv4 VRRP Group | After you configure this feature, the master device in the IPv4 source VRRP group uses the virtual IP address and virtual MAC address to reply packets. On a stateful failover network, you must configure this feature. Support for this feature varies by device. | ||
Allow reverse NAT | Enable reverse address translation. Reverse address translation uses existing NO-PAT entries to translate the destination address for connections actively initiated from the external network to the internal network. This option is available only when the translation mode is set to | ||
Port translation | If you enable port translation, the device uses the PAT method to translate the source IP addresses and source ports of packets. If you disable port translation, the device uses the NO-PAT method to translate only the source IP addresses of packets. | ||
User original port preferentially | Preferentially use the original port for PAT. When the original port has been allocated, another port is used. This option is available only when the translation mode is set to | ||
Translate destination IP addresses to | Translation mode | Select a destination address translation method:
| |
Destination IP after NAT | Set the destination IP address after translation. | ||
Port after NAT | Set the destination port after translation. | ||
Associated IPv4 VRRP Group | After you configure this feature, the master device in the IPv4 destination VRRP group uses the virtual IP address and virtual MAC address to reply packets. On a stateful failover network, you must configure this feature. Support for this feature varies by device. | ||
General settings | Name | Name of the NAT44 rule, which supports Chinese characters. | |
Rule status | Whether to enable the NAT44 rule. | ||
Auto generate security policy | After you enable this feature, the device generates a security policy based on the original packet information configured above. | ||
Advanced settings | Description | Remarks for the NAT44 rule. | |
VRF before NAT | VPN instance to which packets belong before address translation. | ||
VRF after NAT | VPN instance to which packets belong after address translation. | ||
Counting | Enable the counting of times that the NAT44 rule is matched. |
Click
(Optional.) Create a security zone. (Details not shown.)
(Optional.) Create an address object group. For more information, see "Object groups."
(Optional.) Create a service object group. For more information, see "Object groups."
Create a policy-based NAT66 rule.
Click the
In the navigation pane, select
Select a translation mode as required.
Figure-6 Selecting a translation mode
Table-4 Translation mode description
Translation mode | Description |
Create SNAT | Translates the source address information of packets. |
Create DNAT | Translates the destination address information of packets. |
Create SNAT+DNAT | Translates both the source and destination address information of packets. |
Click the
Figure-7 Configuring a policy-based NAT66 rule
Table-5 Configuration items for policy-based NAT66 rules
Item | Description | ||
When IP addresses match the following criteria | Source zone | Select source security zones for packet match. | |
Destination zone | Select destination security zones for packet match. This field is displayed only when you select the | ||
Source IP | Select a source IP address, IP subnet, or address object group for packet match. | ||
Destination IP | Select a destination IP address, IP subnet, or address object group for packet match. If the translation mode is destination address translation or source and destination address translation, this field must be specified. | ||
Service | Select a service object group for packet match. | ||
Translate source IP addresses to | Translation mode | Select a source address translation method:
| |
Source IP after NAT | Select a NAT address for source address translation. | ||
Port translation | If you enable port translation, the device uses the PAT method to translate the source IP addresses and source ports of packets. If you disable port translation, the device uses the NO-PAT method to translate only the source IP addresses of packets. | ||
Associated IPv6 VRRP Group | After you configure this feature, the master device in the IPv6 source VRRP group uses the virtual IP address and virtual MAC address to reply packets. On a stateful failover network, you must configure this feature. Support for this feature varies by device. | ||
IPv6 prefix | Configure the IPv6 address prefix for the prefix translation method. This option is available only when the prefix translation method is | ||
Prefix length | Configure the IPv6 prefix length. This option is available only when the prefix translation method is | ||
Translate destination IP addresses to | Translation method | Select a destination address translation method:
| |
Destination IP after NAT | Set the destination IP address after translation. | ||
Port after NAT | Set the destination port after translation. | ||
IPv6 prefix | Configure the IPv6 address prefix for the prefix translation method. This option is available only when the translation method is | ||
Prefix length | Configure the IPv6 prefix length. This option is available only when the translation method is | ||
General settings | Name | Name of the NAT66 rule, which supports Chinese characters. | |
Rule status | Whether to enable the NAT66 rule. | ||
Advanced settings | Description | Remarks for the NAT66 rule. | |
VRF before NAT | VPN instance to which packets belong before address translation. | ||
VRF after NAT | VPN instance to which packets belong after address translation. | ||
Counting | Enable the counting of times that the NAT66 rule is matched. |
Click
(Optional.) Create a security zone. (Details not shown.)
(Optional.) Create an address object group. For more information, see "Object groups."
(Optional.) Create a service object group. For more information, see "Object groups."
Create a policy-based NAT64 rule.
Click the
In the navigation pane, select
Click the chevron icon next to
Figure-8 Selecting Create SNAT+DNAT
Click the
Figure-9 Configuring a policy-based NAT64 rule
Table-6 Configuration items for policy-based NAT64 rules
Item | Description | ||
Translation method | Translates the source IP address and destination IP address of packets when an IPv4 host first initiates a connection to the IPv6 network. | ||
Translates the source IP address and destination IP address of packets when an IPv6 host first initiates a connection to the IPv4 network. | |||
When IP addresses match the following criteria | Source zone | Select source security zones for packet match. | |
Source IP | Select a source IP address, IP subnet, or address object group for packet match. | ||
Destination IP | Select a destination IP address, IP subnet, or address object group for packet match. | ||
Service | Select a service object group for packet match. | ||
Source address translation | Translation method | Select a source address translation method:
| |
Source IP after NAT | Select a NAT address for source address translation. This option is available only when the translation method is | ||
Port translation | If you enable port translation, the device uses the PAT method to translate the source IP addresses and source ports of packets. If you disable port translation, the device uses the NO-PAT method to translate only the source IP addresses of packets. | ||
Associated IPv4 VRRP Group | After you configure this feature, the master device in the IPv4 source VRRP group uses the virtual IP address and virtual MAC address to reply packets. On a stateful failover network, you must configure this feature. Support for this feature varies by device. | ||
Associated IPv6 VRRP Group | After you configure this feature, the master device in the IPv6 source VRRP group uses the virtual IP address and virtual MAC address to reply packets. On a stateful failover network, you must configure this feature. Support for this feature varies by device. | ||
Prefix translation | Select a prefix translation type:
This option is available only when the translation method is | ||
IPv6 prefix | Configure the IPv6 address prefix for the prefix translation method. This option is available only when the prefix translation type is | ||
Prefix length | Configure the IPv6 prefix length. This option is available only when the prefix translation type is | ||
Destination address translation | Translation method | Select a destination address translation method:
| |
Prefix translation | Select a prefix translation type:
This option is available only when the translation method is | ||
IPv6 prefix | Configure the IPv6 address prefix for the prefix translation method. This option is available only when the prefix translation type is | ||
Prefix length | Configure the IPv6 prefix length. This option is available only when the prefix translation type is | ||
Associated IPv4 VRRP Group | After you configure this feature, the master device in the IPv4 destination VRRP group uses the virtual IP address and virtual MAC address to reply packets. On a stateful failover network, you must configure this feature. Support for this feature varies by device. | ||
Associated IPv6 VRRP Group | After you configure this feature, the master device in the IPv6 destination VRRP group uses the virtual IP address and virtual MAC address to reply packets. On a stateful failover network, you must configure this feature. Support for this feature varies by device. | ||
Destination IP after NAT | Set the destination IP address after translation. | ||
Port after NAT | Set the destination port after translation. This option is available only when the translation method is | ||
General settings | Name | Name of the NAT64 rule, which supports Chinese characters. | |
Rule status | Whether to enable the NAT64 rule. | ||
Advanced settings | Description | Remarks for the NAT64 rule. | |
VRF before NAT | VPN instance to which packets belong before address translation. | ||
VRF after NAT | VPN instance to which packets belong after address translation. | ||
Counting | Enable the counting of times that the NAT64 rule is matched. |
Click