Destination NAT is basically configured as follows:
Create a NAT address pool.
Operation |
Command |
|---|---|
Create a NAT address pool. |
destination-nat address-group address-group-name [ address-group-number ] |
Set an IP address range. |
section start-address end-address [ weight weight-value ] |
Configure the black-hole route to prevent routing loop.
ip route-static x.x.x.x 255.255.255.255 NULL0
The NAT function is implemented using NAT rules in the NAT policy. Create a NAT rule to specify the data flow to be translated 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 following rules will no longer be matched. Therefore, pay attention to the configuration sequence.
Create a NAT rule and set matching conditions.
Operation |
Command |
Description |
|---|---|---|
Enter the NAT policy view and create a NAT rule. |
rule name rule-name |
- |
Set the matching condition (address) of the NAT rule. |
|
The matching condition based on the destination IP address is mandatory, and the matching conditions based on other types of IP addresses are optional. For example, NAT is required for users whose destination IP address is 10.1.1.0/24. [sysname] nat-policy [sysname-policy-nat] rule name policy1 [sysname-policy-nat-rule-policy1] destination-address 10.1.1.0 24 |
Set the matching condition (security zone) of the NAT rule. |
Configure the source security zone as the matching condition, which is usually the security zone where the internet resides. source-zone { zone-name &<1-6> | any } |
When configuring a destination NAT policy, you can configure only the source security zone but not the destination security zone. |
Set the matching condition (service) of the NAT rule. |
|
The device supports two modes in which a service is specified:
For example, to specify source ports (TCP ports 123 to 128) as the matching condition: The first configuration method: [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 The second configuration method: [sysname] nat-policy [sysname-policy-nat] rule name policy1 [sysname-policy-nat-rule-policy1] service protocol tcp source-port 123 to 128 |
Set an action for the NAT rule.
action destination-nat