This section describes how to configure static mapping.
By configuring static mapping, you can specify the private IP address pool, public IP address pool, port ranges allocated to public addresses, and their mappings to rapidly translate private addresses to public addresses.
For configurations of the NMS, see server documents. This section focuses on the configuration of static mapping on the CGN, namely the FW.
Run the static-mapping mapping-id inside-ipv4-pool inside-pool-id global-pool global-pool-id [ port-range start-port end-port ] [ port-block-size port-number ] [ ip-first ] command to configure address pool-based static mapping between public and private IP addresses.
When you configure address pool-based static mapping, the addresses in the public IP address pool must meet the mapping requirements of the addresses in the private IP address pool. The advantage and disadvantage are as follows:
ip-first: Indicates that public addresses in the address pool are translated to private addresses first and then ports are translated if this parameter is specified. If this parameter is not specified, ports are translated first and then public addresses in the address pool are translated. By default, ports are translated first.
Run the static-mapping mapping-id inside-ipv4-pool inside-pool-id global-pool global-pool-id [ port-range start-port end-port ] [ port-block-size port-number ] in-section command to configure section-based static mapping between public and private IP addresses.
When you configure section-based static mapping, the section-ids in the private and public IP address pool are in one-to-one mapping relationship. All public sections with a mapping must meet the mapping requirements of the sections in the private IP address pool. The advantage and disadvantage are as follows:
Run the static-mapping mapping-id inside-ipv4-pool inside-pool-id global interface { interface-name | interface-type interface-number } [ port-range start-port end-port ] [ port-block-size port-block-size ] command to configure mapping between private and public interfaces.
If the public address is dynamically obtained in PPPoE or DHCP mode, you can use the public interface address as the public address and configure the mapping between the public interface address and private address pool.
The allocated port range is from 2048 to 65535 by default.
A single private IPv4 address pool can build static mapping relationships with several public IP address pools, and each of those static mapping relationships can only be applied once.
exclude-port start-port end-port static-mapping mapping-id
The start port of the excluded port range must be a multiple of 256, and the end port added by 1 must be a multiple of 256. You can configure only one excluded port range for the static mapping.
Static mapping takes effect only after being applied in the NAT policy view.
Configure matching conditions for the source NAT rule.
By default, all matching conditions are "any." A NAT rule applies only to traffic that meets all the configured conditions in the NAT rule.
Run the source-address { address-set address-set-name &<1-6> | ipv4-address [ ipv4-mask-length | mask mask-address ] | ipv6-address ipv6-prefix-length | range { ipv4-start-address ipv4-end-address | ipv6-start-address ipv6-end-address } | mac-address &<1-6> | any } command to set a source IP address that needs to match the traffic.
Run the destination-address { address-set address-set-name &<1-6> | ipv4-address [ ipv4-mask-length | mask mask-address ] | ipv6-address ipv6-prefix-length | range { ipv4-start-address ipv4-end-address | ipv6-start-address ipv6-end-address } | mac-address &<1-6> | any } command to set a destination IP address that needs to match the traffic.
Run the source-zone { zone-name &<1-6> | any } command to configure the source security zone (the intranet security zone) for traffic.
Run the destination-zone zone-name command to configure the destination security zone (the Internet security zone) for traffic.
To enable the function of sending logs and alarms when the usage of the user table reaches the threshold, run the nat user-table used-up alarm enable command in the system view.
To set an alarm threshold for the usage of the user table, run the nat user-table used-up alarm threshold command.