Procedure
NAT server mode
# Configure NAT server on public network interface GE0/0/1, to map the private IP address IP 192.168.20.2 and TCP port 8080 to the interface IP address and port 8080.
<Huawei> system-view[Huawei] interface gigabitethernet 0/0/1[Huawei-GigabitEthernet0/0/1] nat server protocol tcp global current-interface 8080 inside 192.168.20.2 8080
NAT static mode
Interface view:
# Map public address 1.1.1.1 and port 2000 in TCP packets to private address 10.10.10.1 and port 3000.
<Huawei> system-view[Huawei] interface gigabitethernet 1/0/0[Huawei-GigabitEthernet1/0/0] nat static protocol tcp global 1.1.1.1 2000 inside 10.10.10.1 3000
System view:
# Map public IP address 1.1.1.1 and port 443 in TCP packets to private address 192.168.2.55.
<Huawei> system-view[Huawei] nat static protocol tcp global 1.1.1.1 443 inside 192.168.2.55 netmask 255.255.255.255[Huawei] interface gigabitethernet 1/0/0[Huawei-GigabitEthernet1/0/0] nat static enable
If a private network device needs to provide a specific service for public network devices using one or more ports, you can configure a mapping between a private IP address with port and a public IP address with port. Public network devices then can use the specified public IP address and port to access the service on the private network device. The mapping configuration can be implemented using the NAT server or NAT static mode. The NAT server mode translates only the IP address but not the port for access from the private network to the public network. The NAT static mode translates both the IP address and port for access from the private network to the public network.