This section provides an example for configuring ESP NAT in a source NAT scenario.
A user on LAN 1 proactively accesses LAN 2. For information transmission security, an IPSec tunnel shall be established between the LANs. However, devices on the LANs, such as PCs, do not support the NAT traversal function, and UDP headers cannot be used to encapsulate ESP packets. Therefore, faults may occur during NAT for ESP packets without port numbers. In this case, you shall configure ESP NAT on the FW to set port numbers for ESP packets during source NAT to differentiate various ESP packets, so that the IPSec tunnel can be successfully established.
Figure 1 shows the networking:
Item |
Data |
|---|---|
| Devices on LAN 1, such as PC1 | IPSec configuration Peer address: 10.1.2.1 Authentication mode: pre-shared key Pre-shared key: Test!1234 Local ID type: IP address Peer ID type: IP address Peer ID: 10.1.2.1 |
| FW | Source NAT configuration Source address: 10.1.1.0/24 Address pool: 1.1.1.10 NAT mode: NAPT |
| Devices on LAN 2, such as PC2 | IPSec configuration Peer address: 1.1.1.10 Authentication mode: pre-shared key Pre-shared key: Test!1234 Local ID type: IP address Peer ID type: IP address Peer ID: 1.1.1.10 |
Huawei FW supports NAT traversal. If Huawei FW is used to establish an IPSec tunnel, you do not need to configure ESP NAT. You need to enable ESP NAT on the intermediate NAT device only when the IPSec initiator and recipient do not support NAT traversal.
Configuration script for the FW:
# sysname FW # interface GigabitEthernet 0/0/0 ip address 10.1.1.254 255.255.255.0 # interface GigabitEthernet 0/0/1 ip address 10.1.5.1 255.255.255.0 # firewall zone trust set priority 85 add interface GigabitEthernet 0/0/0 # firewall zone untrust set priority 5 add interface GigabitEthernet 0/0/1 # security-policy rule name policy1 source-zone trust destination-zone untrust source-address 10.1.1.0 24 destination-address 10.1.2.0 24 action permit # firewall esp nat enable # nat address-group nataddr 1 section 0 1.1.1.10 # nat-policy rule name policy_nat1 source-zone trust destination-zone untrust source-address 10.1.1.0 24 action source-nat address-group nataddr # return