NAT66 is generally configured as follows:
The NAT function is implemented using NAT rules in a NAT policy. Create a NAT rule to specify the data flow that requires NAT and the translation action.
If multiple NAT rules are configured, the device matches them from top to bottom in the NAT rule list. If the traffic matches a NAT rule, the subsequent rules will no longer be matched. Therefore, pay attention to the configuration sequence.
Create a NAT rule and configure matching conditions.
All matching conditions are optional for traffic matching. However, when configuring a NAT policy, you must configure the source or destination address as the matching condition. When configuring the destination NAT policy, you must set the matching condition for the destination security zone to any.
Operation |
Command |
Description |
|---|---|---|
Enter the NAT policy view and create a NAT rule. |
rule name rule-name |
- |
Configure the NAT policy type. |
nat-type nat66 |
- |
Configure a matching condition for the NAT rule: address. |
|
Only one address prefix can be configured for the source address matching condition of the NAT66 policy, and it is also true for the destination address matching condition. For example, set the address prefix to 3000:1000::/48 in the matching condition. [sysname] nat-policy [sysname-policy-nat] rule name policy1 [sysname-policy-nat-rule-policy1] source-address 3000:1000:: 48 When configuring static NAT66, ensure that the length of the address prefix in the matching condition is the same as the length of the post-NAT address prefix. For example, configure NAT for users whose address prefix is 3000:1000::/48. [sysname] nat-policy [sysname-policy-nat] rule name policy1 [sysname-policy-nat-rule-policy1] source-address 3000:1000:: 48 [sysname-policy-nat-rule-policy1] action destination-nat static 3000:1100:: 48 When configuring static NAT66, do not configure the same source NAT action if the protocol, destination address, and destination security zone in the matching conditions are the same. (For example, when the protocol, destination address, and destination security zone in the matching conditions of two NAT policies are the same but the source IP addresses of users belong to different network segments, if the same source NAT action is configured, the source addresses of packets will be translated into the same address, causing access conflicts). If the source address, source security zone, and protocol in the matching conditions are the same, do not configure the same destination NAT action. (For example, when the source address, destination security zone, and protocol in the matching conditions of two NAT policies are the same but users access different destination addresses, if the same destination NAT action is configured, the destination addresses of packets will be translated into the same address, causing access conflicts.) |
Configure a matching condition for the NAT rule: security zone. |
|
When configuring destination NAT, set the destination security zone to any. |
Configure a matching condition for the NAT rule: service. |
|
You can specify a service in either of the following ways:
For example, specify source TCP ports 123 to 128 as the matching condition. First configuration mode: [sysname] ip service-set set1 type object [sysname-object-service-set-set1] service protocol tcp source-port 123 to 128 [sysname-object-service-set-set1] quit [sysname] nat-policy [sysname-policy-nat] rule name policy1 [sysname-policy-nat-rule-policy1] service set1 Second configuration mode: [sysname] nat-policy [sysname-policy-nat] rule name policy1 [sysname-policy-nat-rule-policy1] service protocol tcp source-port 123 to 128 |
Configure an action for the NAT rule.
action { source-nat | destination-nat } nptv6 ipv6-prefix nptv6_prefix_len
action source-nat static ipv6-prefix static_prefix_len
action destination-nat static ipv6-prefix static_prefix_len [ port ]
source-nat indicates that source NAT is performed for data flows, and destination-nat indicates that destination NAT is performed for data flows.