This section provides an example for configuring NAPT for intranet users to access the Internet.
An enterprise has deployed a FW as a security gateway on the intranet border. A source NAT policy needs to be configured on the FW so that users on the intranet 10.1.1.0/24 can access the Internet. In addition to the public IP address of the WAN interface on the FW, the enterprise has also been allocated public addresses 1.1.1.10 through 1.1.1.15 by the Internet service provider (ISP). The FW uses source NAT to map private addresses of the intranet (10.1.1.0/24) to these public addresses. If there are many intranet users access the Internet, port conflicts may occur during NAT. To reduce the possibility of port conflicts, you can set the maximum number of private addresses corresponding to a public address. Figure 1 illustrates the source NAT policy networking. The router is an access gateway on the ISP network.
Item |
Data |
Description |
|
|---|---|---|---|
GigabitEthernet 0/0/1 |
IP address: 10.1.1.1/24 Security zone: trust |
Set the default gateway address on each intranet host to 10.1.1.1. |
|
GigabitEthernet 0/0/2 |
IP address: 1.1.1.1/24 Security zone: untrust |
1.1.1.1/24 is a public address provided by the ISP. |
|
Intranet segment that is allowed to access the Internet |
10.1.1.0/24 |
- |
|
Public addresses mapped to private addresses |
1.1.1.10 to 1.1.1.15 |
As private addresses far outnumber public addresses, one-to-one mapping cannot be implemented. To translate all private addresses into public addresses, enable port translation. |
|
Maximum number of private addresses corresponding to a public address |
256 |
- |
|
Routing information |
FW's default route |
Destination address: 0.0.0.0 Next hop address: 1.1.1.254 |
Configure a default route on the FW to direct intranet traffic to the ISP network. |
Router's static route |
Destination address: 1.1.1.10 to 1.1.1.15 Next hop address: 1.1.1.1 |
The public addresses mapped to private addresses are not assigned to physical ports. As a result, the router cannot use a routing protocol to discover routes to the public addresses. Ask the ISP network administrator to configure a static route destined for the network segment address of the address pool on the router. |
|
The configuration roadmap is as follows:
Contact your ISP administrator to perform this step.
Configuration script for the FW:
# sysname FW # interface GigabitEthernet0/0/1 undo shutdown ip address 10.1.1.1 255.255.255.0 # interface GigabitEthernet0/0/2 undo shutdown ip address 1.1.1.1 255.255.255.0 # firewall zone trust set priority 85 add interface GigabitEthernet0/0/1 # firewall zone untrust set priority 5 add interface GigabitEthernet0/0/2 # ip route-static 0.0.0.0 0.0.0.0 1.1.1.254 # nat address-group addressgroup1 0 mode pat route enable section 0 1.1.1.10 1.1.1.15 srcip-car-num 256 # security-policy rule name policy1 source-zone trust destination-zone untrust source-address 10.1.1.0 24 action permit # nat-policy rule name policy_nat1 source-zone trust destination-zone untrust source-address 10.1.1.0 24 action source-nat address-group addressgroup1 # return