Example For Configuring The NAT Function
Example For Configuring The NAT Function
This section provides an example for configuring the centralized NAT function to implement
multiple-to-multiple translations from internal addresses of enterprise users to external addresses
and allow only PCs on a specified network segment to access the Internet.
Networking Requirements
On the network shown in Figure 1-79, the device performs the NAT function to help PCs within
the enterprise network access the Internet. The device uses Ethernet interface 0/1/0 to connect
to the enterprise network. The device connects to the Internet using GE 0/1/1 interface. The
enterprise has five public IP addresses ranging from 1.1.1.101/32 to 1.1.1.105/32.
Figure 1-79 shows the interface IP addresses that are configured to meet the following
requirements:
● Only PCs on the network segment of 192.168.10.0/24 can access the Internet.
● Multiple-to-multiple NAT translation is performed for internal and external IP
addresses.
Figure 1-79 NAT networking
In this example, interface 1 and interface 2 stand for GE 0/1/0 and GE 0/1/1, respectively.
Configuration Roadmap
The configuration roadmap is as follows:
Data Preparation
To complete the configuration, you need the following data:
● service-location backup group index: 1
● service-instance-group service instance group name: group1
● NAT instance name: nat1; NAT instance index: 1
● NAT address pool name for NATA: address-group1; NAT address pool ID: 1; IP
address segment: 1.1.1.101 to 1.1.1.105
● ACL name: 3001
● Number and IP address of the interface that applies the NAT traffic policy
Procedure
Create a NAT instance named nat1 and bind it to the service board.
<HUAWEI> system-view
[~HUAWEI] sysname NATA
[*HUAWEI] commit
[~NATA] service-location 1
[*NATA-service-location-1] location follow-forwarding-mode
[*NATA-service-location-1] commit
[~NATA-service-location-1] quit
[~NATA] service-instance-group group1
[*NATA-service-instance-group-group1] service-location 1
[*NATA-service-instance-group-group1] commit
[~NATA-service-instance-group-group1] quit
[~NATA] nat instance nat1 id 1
[*NATA-nat-instance-nat1] service-instance-group group1
[*NATA-nat-instance-nat1] commit
● [~NATA-nat-instance-nat1] quit
Configure a NAT address pool with IP addresses ranging from 1.1.1.101 to 1.1.1.105.
[~NATA] nat instance nat1
[~NATA-nat-instance-nat1] nat address-group address-group1 group-id 1
[*NATA-nat-instance-nat1-nat-address-group-address-group1] section 1 1.1.1.101 1.1.1.105
[*NATA-nat-instance-nat1-nat-address-group-address-group1] commit
[~NATA-nat-instance-nat1-nat-address-group-address-group1] quit
● [~NATA-nat-instance-nat1] quit
2. Configure an outbound NAT traffic policy.
Configure an ACL numbered 3001, an ACL rule numbered 1, and an ACL-based traffic
classification rule to allow only hosts with a network segment address of 192.168.10.0/24 to
access the Internet.
[~NATA] acl 3001
[*NATA-acl4-advance-3001] rule 1 permit ip source 192.168.10.0 0.0.0.255
[*NATA-acl4-advance-3001] commit
● [~NATA-acl4-advance-3001] quit
Apply the NAT traffic policy for ACL users in the view of GE 0/1/1.
[~NATA] interface gigabitEthernet 0/1/1
[~NATA-GigabitEthernet0/1/1] ip address 11.2.3.4 24
[*NATA-GigabitEthernet0/1/1] nat bind acl 3001 instance nat1
[*NATA-GigabitEthernet0/1/1] commit
● [~NATA-GigabitEthernet0/1/1] quit
● [~NATA-GigabitEthernet0/1/0] quit
3. ---------------------------------------------------------------------------
Configuration Files
● return
Networking Requirements
In Figure 1-80, a host on a private network is connected to the Internet through the router on
which NAT traffic distribution on an outbound interface is configured. The host uses a public IP
address to access an internal server that is created in easy IP mode on the same NAT device.
The router is connected to the private network through 0/1/0. The router's GE 0/1/1 is connected
to the Internet. The public IP addresses 11.1.1.2/32 and 11.1.1.3/32 are available.
Figure 1-80 shows IP addresses of interfaces. The configuration requirements are as follows:
● PCs on the private network segment of 10.1.1.4/32 can access the Internet.
● PCs on the private network segment of 10.1.1.4/32 can access the internal server
using a public IP address.
● The host uses a public IP address to access an internal server that is created in easy
IP mode on the same NAT device.
Figure 1-80 Scenario in which NAT traffic distribution on an outbound interface, easy IP, and the
hairpin function are configured
In this example, interface 1 and interface 2 are GE 0/1/0 and GE 0/1/1, respectively.
Configuration Roadmap
The configuration roadmap is as follows:
Data Preparation
To complete the configuration, you need the following data:
● NAT instance name (nat1) and index (1)
● NAT Device's NAT address pool name (address-group1), address pool number (1), a
range of public IP addresses (11.1.1.2 and 11.1.1.3)
● ACL number (3001) to match traffic that a private network host sends to the Internet
● ACL number (3002) to match traffic that a private network host sends to the private
network server
● Name and IP address of each interface to which a NAT traffic distribution policy is
applied
Procedure
Configure a NAT address pool and specify a range of IP addresses 11.1.1.2 to 11.1.1.3 in the
pool.
[~NAT Device] nat instance nat1
[~NAT Device-nat-instance-nat1] nat address-group address-group1 group-id 1 11.1.1.2
11.1.1.3
[*NAT Device-nat-instance-nat1] commit
Configure an internal server. In this example, TCP port 80 is used on an internal server.
[~NAT Device] nat instance nat1
[~NAT Device-nat-instance-nat1] nat server protocol tcp global unnumbered interface
GigabitEthernet0/1/1 80 inside 10.1.1.254 80
[*NAT Device-nat-instance-nat1] commit
Configure an ACL to match traffic that a private network host sends to the Internet, and to match
traffic that a private network host sends to the private network server..
[~NAT Device] acl 3001
[*NAT Device-acl4-advance-3001] rule 1 permit ip source 10.1.1.4 0.0.0.0
[*NAT Device-acl4-advance-3001] rule 2 permit tcp source 10.1.1.254 0.0.0.0
[*NAT Device-acl4-advance-3001] commit
● [~NAT Device-acl4-advance-3001] quit
Configuration File
#
sysname NAT Device
#
service-location 1
location follow-forwarding-mode
#
service-instance-group group1
service-location 1
#
acl number 3001
rule 1 permit ip source 10.1.1.4 0.0.0.0
rule 2 permit tcp source 10.1.1.254 0.0.0.0
#
nat instance nat1 id 1
service-instance-group group1
nat address-group address-group1 group-id 1 11.1.1.2 11.1.1.3
nat server protocol tcp global unnumbered interface GigabitEthernet0/1/1 80 inside 10.1.1.254
80
#
interface gigabitEthernet 0/1/0
undo shutdown
ip address 10.1.1.2 255.255.255.0
nat bind acl 3001 instance nat1
#
interface gigabitEthernet 0/1/1
undo shutdown
ip address 11.1.1.1 255.255.255.0
nat bind acl 3001 instance nat1
#
return
Networking Requirements
On the network shown in Figure 1-81, the device performs the NAT function to help PCs within
the enterprise network access the Internet. The device uses the GE 0/1/0 interface to connect to
an internal network and the GE 0/1/1 interface to connect to the Internet.
The internal network address of the enterprise network is 192.168.0.0/16. The internal server
address is 192.168.10.10/24. Only PCs on the network segment of 192.168.10.0/24 can access
the Internet. External PCs can access the internal server. The enterprise has five valid IP
addresses ranging from 11.11.11.101/24 to 11.11.11.105/24. The internal server of the enterprise
has an independent public address 11.11.11.100. The internal server can be accessed from the
external network address 13.13.13.2 through 1:1 NAT.
Figure 1-81 Networking of the internal NAT server
The configurations in this example are mainly performed on NAT A and Device B.
In this example, interface 1, interface 2, and interface 3 stand for GE 0/1/0, GE 0/1/1, and GE
0/1/2, respectively.
Configuration Roadmap
The configuration roadmap is as follows:
Data Preparation
To complete the configuration, you need the following data:
● service-location backup group index: 1
● service-instance-group service instance group name: group1
● NAT instance name: nat1; NAT instance index: 1
● NAT address pool name for NAT A: address-group1; NAT address pool ID: 1; IP
address segment: 11.11.11.101 to 11.11.11.105
● ACL number: 3001
● Traffic classifier name: classifier1
● Traffic behavior name: behavior1
● Traffic policy name: policy1
● Number and IP address of the interface that applies the NAT traffic policy: 0/1/0,
192.168.10.1/24
● Private IP address of the internal NAT server: 192.168.10.10; public IP address of the
internal NAT server: 11.11.11.100
Procedure
Create a NAT instance named nat1 and bind it to the service board.
<HUAWEI> system-view
[~HUAWEI] sysname NATA
[*HUAWEI] commit
[~NATA] service-location 1
[*NATA-service-location-1] location follow-forwarding-mode
[*NATA-service-location-1] commit
[~NATA-service-location-1] quit
[~NATA] service-instance-group group1
[*NATA-service-instance-group-group1] service-location 1
[*NATA-service-instance-group-group1] commit
[~NATA-service-instance-group-group1] quit
[~NATA] nat instance nat1 id 1
[*NATA-nat-instance-nat1] service-instance-group group1
[*NATA-nat-instance-nat1] commit
● [~NATA-nat-instance-nat1] quit
Configure a NAT address pool with IP addresses ranging from 11.11.11.101 to 11.11.11.105.
[~NATA] nat instance nat1
[~NATA-nat-instance-nat1] nat address-group address-group1 group-id 1 11.11.11.101
11.11.11.105
[*NATA-nat-instance-nat1] commit
● [~NATA-nat-instance-nat1] quit
2. Configure a NAT traffic policy.
● [~NATA-acl4-advance-3001] quit
Configure a traffic classifier named classifier1 and define an ACL-based matching rule.
[~NATA] traffic classifier classifier1
[*NATA-classifier-classifier1] if-match acl 3001
[*NATA-classifier-classifier1] commit
● [~NATA-classifier-classifier1] quit
Configure a traffic behavior named behavior1 and bind it to the NAT instance.
[~NATA] traffic behavior behavior1
[*NATA-behavior-behavior1] nat bind instance nat1
[*NATA-behavior-behavior1] commit
● [~NATA-behavior-behavior1] quit
Define a NAT traffic policy named policy1 to associate the ACL rule with the traffic behavior.
[~NATA] traffic policy policy1
[*NATA-trafficpolicy-policy1] classifier classifier1 behavior behavior1
[*NATA-trafficpolicy-policy1] commit
● [~NATA-trafficpolicy-policy1] quit
● [~NATA-GigabitEthernet0/1/0] quit
Define the internal server address as 192.168.10.10 and external address as 11.11.11.100. Use
the address-level mode to ensure 1:1 relationship between the public and private IP addresses.
[~NATA] nat instance nat1
[~NATA-nat-instance-nat1] nat server global 11.11.11.100 inside 192.168.10.10
[*NATA-nat-instance-nat1] commit
3. [~NATA-nat-instance-nat1] quit
4. CPE IP:192.168.10.10
Configuration Files
● return
● return
Example for Configuring Bidirectional NAT
This section provides an example for configuring bidirectional NAT on an enterprise network.
This function protects data within the enterprise network and translates both the source and
destination, without exposing internal server data. A configuration networking diagram is
provided to help you understand the configuration procedure.
Networking Requirements
On the network shown in Figure 1-82, the device translates private IP address of servers A and B
to public IP addresses before the servers communicate with the Internet. When server A
attempts to access server B, server A sends a packet with a private source IP address of
10.78.1.2 and the destination IP address of 11.11.11.1 (server B's public address). When server
B attempts to access server A, server B sends a packet with a private source IP address of
10.67.1.2 and the destination IP address of 11.11.11.2 (server A's public address).
Figure 1-82 Bidirectional NAT networking
In this example, interface 1 and interface 2 are GE 0/1/1 and GE 0/1/0, respectively.
Configuration Roadmap
The configuration roadmap is as follows:
1. Create a NAT instance and associate a service board with the NAT instance.
2. Configure a mapping between the NAT address pool, internal servers' private IP
addresses, and public addresses.
3. Configure an outbound NAT traffic distribution policy.
Data Preparation
To complete the configuration, you need the following data:
● service-location backup group index: 1
● service-instance-group service instance group name: group1
● NAT instance names and indexes: nata with index 1; natb with index 2
● NAT A's address pools: address-groupa and address-groupb
● Server public IP address: 11.11.11.2 for server A and 11.11.11.1 for server B
● ACL numbers: 2464 and 2465
● Names and IP addresses of interfaces to which an outbound NAT traffic distribution
policy applies: GE 0/1/1 with IP address 10.78.1.1/24 and GE 0/1/0 with IP address
10.67.1.1/24
Procedure
Create a NAT instance and associate a service board with the NAT instance.
<HUAWEI> system-view
[~HUAWEI] sysname NATA
[*HUAWEI] commit
[~NATA] service-location 1
[*NATA-service-location-1] location follow-forwarding-mode
[*NATA-service-location-1] commit
[~NATA-service-location-1] quit
[~NATA] service-instance-group group1
[*NATA-service-instance-group-group1] service-location 1
[*NATA-service-instance-group-group1] commit
[~NATA-service-instance-group-group1] quit
[~NATA] nat instance nata id 1
[*NATA-nat-instance-nata] service-instance-group group1
[*NATA-nat-instance-nata] commit
[~NATA-nat-instance-nata] quit
[~NATA] nat instance natb id 2
[*NATA-nat-instance-natb] service-instance-group group1
[*NATA-nat-instance-natb] commit
1. [~NATA-nat-instance-natb] quit
Configure a mapping between the NAT address pool, internal servers' private IP addresses, and
public addresses.
# In the view of a NAT instance named nata, configure an IP address pool named
address-groupa with an IP address segment ranging from 11.1.1.1 to 11.1.1.10 and map the
NAT-A's private IP address of 10.78.1.2 to a public IP address of 11.11.11.2.
[~NATA] nat instance nata
[~NATA-nat-instance-nata] nat address-group address-groupa group-id 111 11.1.1.1
11.1.1.10
[*NATA-nat-instance-nata] nat server protocol udp global 11.11.11.2 inside 10.78.1.2
[*NATA-nat-instance-nata] commit
[~NATA-nat-instance-nata] quit
# In the view of a NAT instance named natb, configure an IP address pool named
address-groupb with an IP address segment ranging from 11.1.1.11 to 11.1.1.20 and map the
NAT-B's private IP address of 10.67.1.2 to a public IP address of 11.11.11.1.
[~NATA] nat instance natb
[~NATA-nat-instance-natb] nat address-group address-groupb group-id 112 11.1.1.11
11.1.1.20
[*NATA-nat-instance-natb] nat server protocol udp global 11.11.11.1 inside 10.67.1.2
[*NATA-nat-instance-natb] commit
2. [~NATA-nat-instance-natb] quit
3. Configure an outbound NAT traffic policy.
● [~NATA-acl4-basic-2465] quit
Apply the outbound NAT traffic distribution policy to GE 0/1/0 and GE 0/1/1.
# Bind the ACL numbered 2464 and the NAT instance named nata to GE 0/1/0.
[~NATA] interface GigabitEthernet0/1/0
[~NATA-GigabitEthernet0/1/1] ip address 10.67.1.1 24
[*NATA-GigabitEthernet0/1/0] nat bind acl 2464 instance nata
[*NATA-GigabitEthernet0/1/0] commit
[~NATA-GigabitEthernet0/1/0] quit
# Bind the ACL numbered 2465 and the NAT instance named natb to GE 0/1/1.
[~NATA] interface GigabitEthernet0/1/1
[~NATA-GigabitEthernet0/1/1] ip address 10.78.1.1 24
[*NATA-GigabitEthernet0/1/1] nat bind acl 2465 instance natb
[*NATA-GigabitEthernet0/1/1] commit
● [~NATA-GigabitEthernet0/1/1] quit
Verify the configuration.
# View NAT user information.
[~NATA] display nat instance
nat instance nata id 1
service-instance-group group1
nat address-group address-groupa group-id 111 11.1.1.1 11.1.1.10
nat server protocol udp global 11.11.11.2 inside 10.78.1.2
nat instance natb id 2
service-instance-group group1
nat address-group address-groupb group-id 112 11.1.1.11 11.1.1.20
nat server protocol udp global 11.11.11.1 inside 10.67.1.2
# Run the display nat server-map command on the device. The command output shows the
mapping between the public IP address and private IP address of the NAT server.
[~NATA] display nat server-map
This operation will take a few minutes. Press 'Ctrl+C' to break ...
Slot: 9
Total number: 4.
NAT Instance: nata
Protocol:UDP, VPN:--->-
Server:10.78.1.2[11.11.11.2]->ANY
Tag:0x0, TTL:-, Left-Time:-
CPE IP:10.78.1.2
NAT Instance: nata
Protocol:UDP, VPN:--->-
Server reverse:ANY->11.11.11.2[10.78.1.2]
Tag:0x0, TTL:-, Left-Time:-
CPE IP:10.78.1.2
4. CPE IP:10.67.1.2
Configuration Files
#
sysname NATA
#
service-location 1
location follow-forwarding-mode
#
service-instance-group group1
service-location 1
#
nat instance nata id 1
service-instance-group group1
nat address-group address-groupa group-id 111 11.1.1.1 11.1.1.10
nat server protocol udp global 11.11.11.2 inside 10.78.1.2
nat instance natb id 2
service-instance-group group1
nat address-group address-groupb group-id 112 11.1.1.11 11.1.1.20
nat server protocol udp global 11.11.11.1 inside 10.67.1.2
#
acl number 2464
rule 5 permit source 10.78.1.0 0.0.0.255
#
acl number 2465
rule 5 permit source 10.67.1.0 0.0.0.255
#
interface GigabitEthernet0/1/1
undo shutdown
ip address 10.78.1.1 255.255.255.0
undo dcn
nat bind acl 2465 instance natb
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.67.1.1 255.255.255.0
undo dcn
nat bind acl 2464 instance nata
#
return
Networking Requirements
On the network shown in Figure 1-83, the PCs in an enterprise use the CPE to perform NAT and
then are connected to the BRAS. The BRAS is connected to the RADIUS server. The CR is
connected to the NAT device in bypass mode for IPv4 network access. The NAT device is
connected to the CR through GE 0/2/0. The enterprise has 100 public IP addresses ranging from
11.11.11.1/24 to 11.11.11.100/24.
The configuration requirement is as follows:
● Only PCs on the network segment ranging from 10.0.0.1/24 to 10.0.0.255/24 can
access the Internet.
Figure 1-83 Static NAT source tracing
Configuration Roadmap
The configuration roadmap is as follows:
Data Preparation
To complete the configuration, you need the following data:
● Index of the service-location backup group: 1; name of the service-instance-group
service instance group: group 1; index of the NAT instance named nat1: 1
● Numbers of the private and public address pools for static NAT source tracing
● Number and IP address of the interface that applies the NAT traffic policy
● Private network address segment for static NAT source tracing: 10.0.0.1 to 10.0.0.255;
public network address segment for static NAT source tracing 11.11.11.1 to
11.11.11.100
● Port number range for the public address pool: 256 to 1023; port segment size: 256
● ACL number: 3001; traffic classification rule name: c1; traffic behavior name: b1; traffic
policy name: p1
Procedure
Configure a service-instance-group service instance group.
<HUAWEI> system-view
[~HUAWEI] service-location 1
[*HUAWEI-service-location-1] location slot 1 engine 0
[*HUAWEI-service-location-1] commit
[~HUAWEI-service-location-1] quit
[~HUAWEI] service-instance-group group1
[*HUAWEI-service-instance-group-group1] service-location 1
[*HUAWEI-service-instance-group-group1] commit
1. [~HUAWEI-service-instance-group-group1] quit
Configure a NAT instance named nat1 and bind it to the CGN service board.
[~HUAWEI] nat instance nat1 id 1
[*HUAWEI-nat-instance-nat1] service-instance-group group1
[*HUAWEI-nat-instance-nat1] commit
2. [~HUAWEI-nat-instance-nat1] quit
Configure a group of static NAT source tracing algorithm parameters, with the private address
pool containing IP addresses from 10.0.0.1 to 10.0.0.255, the public address pool containing IP
addresses from 11.11.11.1 to 11.11.11.100, the port range from 256 to 1023, and port segment
size as 256.
[~HUAWEI] nat static-mapping
[*HUAWEI-nat-static-mapping] inside-pool 1
[*HUAWEI-nat-static-mapping-inside-pool-1] section 1 10.0.0.1 10.0.0.255
[*HUAWEI-nat-static-mapping-inside-pool-1] quit
[*HUAWEI-nat-static-mapping] global-pool 1
[*HUAWEI-nat-static-mapping-global-pool-1] section 1 11.11.11.1 11.11.11.100
[*HUAWEI-nat-static-mapping-global-pool-1] quit
[*HUAWEI-nat-static-mapping] static-mapping 10 inside-pool 1 global-pool 1 port-range 256
1023 port-size 256
[*HUAWEI-nat-static-mapping] commit
3. [~HUAWEI-nat-static-mapping] quit
Enable static NAT source tracing algorithm on the NAT instance named nat1 and specify the
algorithm ID as 10.
[~HUAWEI] nat instance nat1
[~HUAWEI-nat-instance-nat1] nat bind static-mapping 10
[*HUAWEI-nat-instance-nat1] commit
4. [~HUAWEI-nat-instance-nat1] quit
5. Configure a traffic classification rule and NAT behavior.
Configure an ACL rule for traffic classification. Only PCs with the internal network segment
address as 10.0.0.0/24 can access the Internet.
[~HUAWEI] acl 3001
[*HUAWEI-acl4-advance-3001] rule 1 permit ip source 10.0.0.0 0.0.0.255
[*HUAWEI-acl4-advance-3001] commit
● [~HUAWEI-acl4-advance-3001] quit
● [~HUAWEI-classifier-c1] quit
Configure a traffic behavior and bind the traffic behavior to the NAT instance named nat1.
[~HUAWEI] traffic behavior b1
[*HUAWEI-behavior-b1] nat bind instance nat1
[*HUAWEI-behavior-b1] commit
● [~HUAWEI-behavior-b1] quit
Define a NAT traffic policy to associate the ACL rule with the traffic behavior.
[~HUAWEI] traffic policy p1
[*HUAWEI-trafficpolicy-p1] classifier c1 behavior b1
[*HUAWEI-trafficpolicy-p1] commit
● [~HUAWEI-trafficpolicy-p1] quit
● [~HUAWEI-GigabitEthernet0/2/0] quit
6. ---------------------------------------------------------------------------
Configuration Files
#
sysname HUAWEI
#
license
active nat session-table size 16 slot 1 engine 0
#
nat static-mapping
inside-pool 1
section 1 10.0.0.1 10.0.0.255
global-pool 1
section 1 11.11.11.1 11.11.11.100
static-mapping 10 inside-pool 1 global-pool 1 port-range 256 1023 port-size 256
#
service-location 1
locate slot 1 engine 0
#
service-instance-group group1
service-location 1
#
nat instance nat1 id 1
service-instance-group group1
nat bind static-mapping 10
#
acl number 3001
rule 1 permit ip source 10.0.0.0 0.0.0.255
#
traffic classifier c1
if-match acl 3001
#
traffic behavior b1
nat bind instance nat1
#
traffic policy p1
classifier c1 behavior b1 precedence 1
#
interface GigabitEthernet 0/2/0
undo shutdown
ip address 10.1.1.1 255.255.255.0
traffic-policy p1 inbound
#
return
Networking Requirements
In Figure 1-84, NAT-Device performs the NAT function to help PCs within an enterprise network
access the Internet. NAT-Device uses GE 0/1/0 to connect to the enterprise network.
NAT-Device's GE 0/1/1 is connected to the Internet. The enterprise is assigned five public IP
addresses of 11.11.11.101/32 through 11.11.11.105/32. The peer device connected to
NAT-Device is assigned an IP address of 1.1.1.5.
Figure 1-84 shows IP addresses of interfaces. The configuration requirements are as follows:
● PCs only on the network segment of 192.168.10.0/24 can access the Internet.
● Multiple-to-multiple NAT translation is performed for IP addresses between private and
public networks.
Figure 1-84 Configuring NAT in the address pool mode
In this example, interface 1 and interface 2 are GE 0/1/0 and GE 0/1/1, respectively.
Configuration Roadmap
The configuration roadmap is as follows:
Data Preparation
To complete the configuration, you need the following data:
● NAT instance name (nat1) and index (1)
● NAT-Device's NAT address pool name (address-group1), address pool number (1), a
range of public IP addresses (11.11.11.101 through 11.11.11.105)
● ACL number (3001)
● Name and IP address of each interface to which a NAT distribution policy is applied
Procedure
● [~NAT-Device-nat-instance-nat1] quit
Configure a NAT address pool and specify a range of IP addresses of 11.11.11.101 through
11.11.11.105 in the pool.
[~NAT-Device] nat address-group address-group1 group-id 1 11.11.11.101 11.11.11.105
● [*NAT-Device] commit
2. [~NAT-Device-acl4-advance-3001] quit
3. [~NAT-Device-GigabitEthernet0/1/1] quit
Configure a default route as a static route and set the next hop address of the default route to
1.1.1.5.
[~NAT-Device] ip route-static 0.0.0.0 0.0.0.0 1.1.1.5
4. [*NAT-Device] commit
5. ---------------------------------------------------------------------------
#
sysname NAT-Device
#
nat instance nat1 id 1 simple-configuration
#
nat address-group address-group1 group-id 1 11.11.11.101 11.11.11.105
#
acl number 3001
rule 1 permit ip source 192.168.10.0 0.0.0.255
#
interface GigabitEthernet 0/1/1
undo shutdown
ip address 1.1.1.4 255.255.255.0
nat bind acl 3001 instance nat1
#
ip route-static 0.0.0.0 0.0.0.0 1.1.1.5
#
return
Networking Requirements
In Figure 1-85, traffic is to be sent from an enterprise network to an external carrier network.
NAT-Device translates a private IP address of an enterprise network user to the IP address of a
public network interface so that the user accesses the external carrier network.
NAT-Device uses GE 0/1/0 to connect to the enterprise network. NAT-Device uses GE 0/1/1 to
connect to the Internet. The enterprise is assigned only the public IP address of 1.1.1.4. The peer
device connected to NAT-Device is assigned an IP address of 1.1.1.5.
Figure 1-85 shows IP addresses of interfaces. The configuration requirements are as follows:
● PCs only on the network segment of 192.168.10.0/24 can access the Internet.
● NAT-Device uses only the IP address of a public network interface, not other public IP
addresses.
Figure 1-85 Configuring easy IP for NAT
In this example, interface 1 and interface 2 are GE 0/1/0 and GE 0/1/1, respectively.
Configuration Roadmap
The configuration roadmap is as follows:
Data Preparation
To complete the configuration, you need the following data:
● NAT instance name (nat1) and index (1)
● NAT-Device's NAT address pool name (address-group1) and sequence number (1)
● ACL number (3001)
● Name (GE 0/1/1) and IP address (1.1.1.4/24) of an interface to which a NAT
distribution policy is applied
Procedure
● [~NAT-Device-nat-instance-nat1] quit
● [~NAT-Device-GigabitEthernet0/1/1] quit
Configure a mapping between the address pool and the IP address of the outbound interface.
[~NAT-Device] nat address-group address-group1 group-id 1 unnumbered interface
GigabitEthernet 0/1/1
● [*NAT-Device] commit
Configure a NAT distribution policy.
Configure an ACL numbered 3001, an ACL rule numbered 1, and an ACL-based traffic
classification rule to allow hosts only with a network segment address of 192.168.10.0/24 to
access the Internet.
[~NAT-Device] acl 3001
[*NAT-Device-acl4-advance-3001] rule 1 permit ip source 192.168.10.0 0.0.0.255
[*NAT-Device-acl4-advance-3001] commit
2. [~NAT-Device-acl4-advance-3001] quit
3. [~NAT-Device-GigabitEthernet0/1/1] quit
Configure a default route as a static route and set the next hop address of the default route to
1.1.1.5.
[~NAT-Device] ip route-static 0.0.0.0 0.0.0.0 1.1.1.5
4. [*NAT-Device] commit
5. ---------------------------------------------------------------------------
#
sysname NAT-Device
#
nat instance nat1 id 1 simple-configuration
#
nat address-group address-group1 group-id 1 unnumbered interface GigabitEthernet 0/1/1
#
acl number 3001
rule 1 permit ip source 192.168.10.0 0.0.0.255
#
interface GigabitEthernet 0/1/1
undo shutdown
ip address 1.1.1.4 255.255.255.0
nat bind acl 3001 instance nat1
#
ip route-static 0.0.0.0 0.0.0.0 1.1.1.5
#
return
In this example, interface 1 and interface 2 are GE 0/1/0 and GE 0/1/1, respectively.
Configuration Roadmap
The configuration roadmap is as follows:
Data Preparation
To complete the configuration, you need the following data:
● NAT instance name (nat1) and index (1)
● NAT-Device's NAT address pool name (address-group1), address pool number (1),
and IP address range in easy IP mode
● ACL numbers (3001 and 3002)
● Name (GE 0/1/0) and IP address (192.168.1.1/24) of an interface to which a NAT
distribution policy is applied; name (GE 0/1/1) and IP address (11.11.11.1/8) of another
interface to which a NAT distribution policy is applied
Procedure
■ [~NAT-Device-nat-instance-nat1] quit
■ [~NAT-Device-GigabitEthernet0/1/1] quit
■ [*NAT-Device] commit
2. [*NAT-Device] commit
3. Configure a NAT distribution policy.
■ Configure an ACL-based traffic classification rule. Configure an ACL
numbered 3001 and a rule numbered 1 for a private network host to
access the internal server using the IP address of 11.11.11.6. The ACL is
used to allow GE 0/1/0 to perform NAT only for services initiated inside the
private network.
■ Configure an ACL numbered 3002, an ACL rule numbered 2, and an
ACL-based traffic classification rule to allow the private network host to
access the Internet.
4. [~NAT-Device-acl4-advance-3002] quit
5. Apply the NAT distribution policy.
■ Apply the traffic classification policy with ACL 3001 to the view of GE 0/1/0.
■ Apply the traffic classification policy with ACL 3002 to the view of GE 0/1/1.
6. [~NAT-Device-GigabitEthernet0/1/1] quit
Configure a default route as a static route and set the next hop address of the default route to
11.11.11.2.
[~NAT-Device] ip route-static 0.0.0.0 0.0.0.0 11.11.11.2
7. [*NAT-Device] commit
8. ---------------------------------------------------------------------------
#
sysname NAT-Device
#
nat instance nat1 id 1 simple-configuration
#
nat address-group 1 group-id 1 unnumbered interface GigabitEthernet 0/1/1
#
nat server global 11.11.11.6 inside 192.168.1.2
#
acl number 3001
rule 1 permit ip source 192.168.1.0 0.0.0.255 destination 192.168.1.2 0
rule 2 permit ip source 192.168.1.2 0 destination 192.168.1.0 0.0.0.255
#
acl number 3002
rule 2 permit ip
#
interface GigabitEthernet 0/1/0
undo shutdown
ip address 192.168.1.1 255.255.255.0
nat bind acl 3001 instance nat1
#
interface GigabitEthernet 0/1/1
undo shutdown
ip address 11.11.11.1 255.0.0.0
nat bind acl 3002 instance nat1
#
ip route-static 0.0.0.0 0.0.0.0 11.11.11.2
#
return
Networking Requirements
In Figure 1-87, the private IP address 192.168.0.100/24 and port 8080 are assigned to a web
server to provide web services. The public IP address of the web server is 11.1.1.3/24, and the
domain name is www.huawei.com. The outbound interface GE 0/1/1 of NAT-Device is
11.1.1.2/24, and the LAN-side gateway's IP address is 192.168.0.1. The enterprise has no other
public IP addresses. The IP address of the peer device on the carrier side is 11.1.1.1/24. The
enterprise attempts to use the private network web server to provide web services for Internet
users and to allow private network users to access the Internet. Private network users can also
access the private network web server through a DNS server on the Internet.
The configuration requirements are as follows:
● PCs only on the network segment of 192.168.0.200/24 can access the Internet.
● NAT-Device uses the public IP address of a public interface and the public IP address
of an internal server. No other public IP addresses are used.
● Public network users access the internal web server at 192.168.0.100/24 using the
public IP address of 11.1.1.3/24 and the domain name of www.huawei.com.
● Private network users access the internal web server at 192.168.0.100/24 using the
public IP address of 11.1.1.3/24 and the domain name of www.huawei.com.
Figure 1-87 Configuring NAT and an internal server
In this example, interface 1 and interface 2 are GE 0/1/0 and GE 0/1/1, respectively.
Configuration Roadmap
The configuration roadmap is as follows:
Data Preparation
To complete the configuration, you need the following data:
● NAT instance name (nat1) and index (1)
● NAT-Device's NAT address pool name (address-group1), address pool number (1),
and IP address range in Easy IP mode
● ACL number (3001)
● Name (GE 0/1/1) and IP address (11.1.1.2/24) of an interface to which a NAT
distribution policy is applied
Procedure
● [~NAT-Device-GigabitEthernet0/1/1] quit
● [*NAT-Device] commit
2. [~NAT-Device] commit
Configure DNS mapping between the DNS domain name of www.huawei.com, the public IP
address of 11.1.1.3 and the private IP address of 192.168.0.100.
[~NAT-Device] nat instance nat1
[~NAT-Device-nat-instance-nat1] nat dns-mapping domain www.huawei.com global-address
11.1.1.3 inside-address 192.168.0.100
[*NAT-Device-nat-instance-nat1] commit
3. [~NAT-Device-nat-instance-nat1] quit
4. [~NAT-Device-nat-instance-nat1] quit
Configure a NAT distribution policy. Configure an ACL numbered 3001, an ACL rule numbered 1,
and an ACL-based traffic classification rule to allow hosts only with a network segment address
of 192.168.0.200/24 to access the Internet.
[~NAT-Device] acl 3001
[*NAT-Device-acl4-advance-3001] rule 1 permit ip source 192.168.0.200 0.0.0.255
[*NAT-Device-acl4-advance-3001] commit
5. [~NAT-Device-acl4-advance-3001] quit
Apply the NAT distribution policy. Apply the ACL-based traffic classification rule to the view of the
outbound interface named GE 0/1/1.
[~NAT-Device] interface gigabitEthernet 0/1/1
[~NAT-Device-GigabitEthernet0/1/1] nat bind acl 3001 instance nat1
[*NAT-Device-GigabitEthernet0/1/1] commit
6. [~NAT-Device-GigabitEthernet0/1/1] quit
Configure a default route as a static route and set the next hop address of the default route to
11.1.1.1.
[~NAT-Device] ip route-static 0.0.0.0 0.0.0.0 11.1.1.1
7. [*NAT-Device] commit
8. ---------------------------------------------------------------------------
#
sysname NAT-Device
#
nat instance nat1 id 1 simple-configuration
#
nat address-group 1 group-id 1 unnumbered interface GigabitEthernet0/1/1
#
nat server protocol tcp global 11.1.1.3 www inside 192.168.0.100 8080
#
nat instance nat1
nat alg dns
nat dns-mapping domain www.huawei.com global-address 11.1.1.3 inside-address
192.168.0.100
#
acl number 3001
rule 1 permit ip source 192.168.0.200 0.0.0.255
#
interface GigabitEthernet 0/1/1
undo shutdown
ip address 11.1.1.2 24
nat bind acl 3001 instance nat1
#
ip route-static 0.0.0.0 0.0.0.0 11.1.1.1
#
return
Networking Requirements
In Figure 1-88, the outbound interface GE 0/1/1 of NAT-Device is 1.1.1.2/24, and the LAN-side
gateway's IP address is 192.168.0.1/24. The IP address of the peer carrier device is 1.1.1.1/24.
The private IP address of the host is 192.168.0.2/24 and is mapped to a fixed IP address of
1.1.1.3/24 for NAT processing. The private IP address needs to be translated to the public IP
address within the Internet to connect to the WAN.
Figure 1-88 Configuring static 1:1 NAT
In this example, interface 1 and interface 2 are GE 0/1/0 and GE 0/1/1, respectively.
Configuration Roadmap
The configuration roadmap is as follows:
Data Preparation
To complete the configuration, you need the following data:
● NAT instance name (nat1) and index (1)
● ACL number (3001)
● Name (GE 0/1/1) and IP address (1.1.1.2/24) of an interface to which a NAT
distribution policy is applied
● Internal server's private IP address (192.168.0.2) and public IP address (1.1.1.3)
Procedure
● [~NAT-Device-nat-instance-nat1] quit
Configure a NAT address pool and specify a range of IP addresses of 11.11.11.101 through
11.11.11.105 in the pool.
[~NAT-Device] nat address-group address-group1 group-id 1 11.11.11.101 11.11.11.105
● [*NAT-Device] commit
Configure an internal server in 1:1 static NAT mapping. Set the internal server's private IP
address to 192.168.0.2 and public IP address to 1.1.1.3.
[*NAT-Device] nat server global 1.1.1.3 inside 192.168.0.2
2. [*NAT-Device] commit
Configure a NAT distribution policy. Configure an ACL numbered 3001, an ACL rule numbered 1,
and an ACL-based traffic classification rule to allow hosts only with a network segment address
of 192.168.0.2/24 to access the Internet.
[~NAT-Device] acl 3001
[*NAT-Device-acl4-advance-3001] rule 1 permit ip source 192.168.0.0 0.0.0.255
[*NAT-Device-acl4-advance-3001] commit
3. [~NAT-Device-acl4-advance-3001] quit
Apply the NAT distribution policy. Apply the ACL-based traffic classification rule to the view of the
outbound interface named GE 0/1/1.
[~NAT-Device] interface gigabitEthernet 0/1/1
[~NAT-Device-GigabitEthernet0/1/1] ip address 1.1.1.2 24
[*NAT-Device-GigabitEthernet0/1/1] nat bind acl 3001 instance nat1
[*NAT-Device-GigabitEthernet0/1/1] commit
4. [~NAT-Device-GigabitEthernet0/1/1] quit
Configure a default route as a static route and set the next hop address of the default route to
1.1.1.1.
[~NAT-Device] ip route-static 0.0.0.0 0.0.0.0 1.1.1.1
5. [*NAT-Device] commit
6. CPE IP:192.168.0.2
#
sysname NAT-Device
#
nat instance nat1 id 1 simple-configuration
#
nat address-group address-group1 group-id 1 11.11.11.101 11.11.11.105
#
nat server global 1.1.1.3 inside 192.168.0.2
#
acl number 3001
rule 1 permit ip source 192.168.0.0 0.0.0.255
#
interface GigabitEthernet 0/1/1
undo shutdown
ip address 1.1.1.2 255.255.255.0
nat bind acl 3001 instance nat1
#
ip route-static 0.0.0.0 0.0.0.0 1.1.1.1
#
return
Networking Requirements
In Figure 1-89, private network users in areas A and B of an enterprise are connected to the
Internet. The public IP address of GE 0/1/0 on NAT-Device is 11.11.11.1/24, and the IP address
of the peer device on the carrier side is 11.11.11.2/24. Users in area A want to replace private
host IP addresses (on the network segment of 192.168.20.0/24) with public IP addresses in the
address pool (11.11.11.100 through 11.11.11.200) in No-PAT mode before accessing the Internet.
Since a few public IP addresses are used in area B, users in area B want to replace private host
IP addresses (on the network segment of 10.0.0.0/24) with the public IP addresses and public
port numbers in PAT mode in the public IP address pool (11.11.11.80 through 11.11.11.83) before
accessing the Internet.
Figure 1-89 shows IP addresses of interfaces. The configuration requirements are as follows:
● PCs on the private network segment of 192.168.20.0/24 can access the Internet.
● PCs on the private network segment of 10.0.0.0/24 can access the Internet.
Figure 1-89 Networking for configuring NAT for VPN users
In this example, interface 1, interface 2, and interface 3 stand for GE 0/1/0, GE 0/1/1, and GE
0/1/2, respectively.
Configuration Roadmap
The configuration roadmap is as follows:
1. Configure a NAT instance and a No-PAT address pool for users in area A.
2. Configure a NAT instance and a PAT address pool for users in area B.
3. Configure a NAT diversion policy.
4. Apply the NAT diversion policy.
5. Configure static routes.
Data Preparation
To complete the configuration, you need the following data:
● Area A's private network segment address (192.168.20.0/24)
● In area A, NAT instance name (nat1) and index (1), NAT address pool name
(address-group1), address pool number (1), and IP address range (11.11.11.100
through 11.11.11.200)
● Area B's private network segment address (10.0.0.0/24)
● In area B, NAT instance name (nat2) and index (2), NAT address pool name
(address-group2), address pool number (2), and IP address range (11.11.11.80
through 11.11.11.83)
● ACL numbers (3001 for area A and 3002 for area B)
● Name (GE 0/1/0) and IP address (11.11.11.1/24) of an interface to which a NAT
diversion policy is applied
Procedure
1. Configure a NAT instance and a No-PAT address pool for users in area A.
■ [~NAT-Device-nat-instance-nat1] quit
Configure a NAT address pool and specify a range of public IP addresses 11.11.11.100 through
11.11.11.200 in the pool. Set the No-PAT mode for the address pool.
[~NAT-Device] nat instance nat1 id 1
[~NAT-Device-nat-instance-nat1] nat address-group address-group1 group-id 1 11.11.11.100
11.11.11.200 No-PAT
[*NAT-Device-nat-instance-nat1] commit
■ [~NAT-Device-nat-instance-nat1] quit
2. Configure a NAT instance and a PAT address pool for users in area B.
■ [~NAT-Device-nat-instance-nat2] quit
Configure a NAT address pool and specify a range of public IP addresses 11.11.11.80 through
11.11.11.83 in the pool. Set the PAT mode for the address pool.
[~NAT-Device] nat instance nat2 id 2
[~NAT-Device-nat-instance-nat2] nat address-group address-group2 group-id 2 11.11.11.80
11.11.11.83
[*NAT-Device-nat-instance-nat2] commit
■ [~NAT-Device-nat-instance-nat2] quit
3. Configure a NAT diversion policy.
■ In area A, configure an ACL numbered 3001, an ACL rule numbered 1,
and an ACL-based traffic classification rule to allow hosts only with a
network segment address of 192.168.20.0/24 to access the Internet.
■ In area B, configure an ACL numbered 3002, an ACL rule numbered 2,
and an ACL-based traffic classification rule to allow only hosts with a
network segment address of 10.0.0.0/24 to access the Internet.
4. [~NAT-Device-acl4-advance-3002] quit
Apply the NAT diversion policy. Apply the ACL-based traffic classification rule to the view of the
outbound interface named GE 0/1/0.
[~NAT-Device] interface GigabitEthernet 0/1/0
[~NAT-Device-GigabitEthernet0/1/0] ip address 11.11.11.1 24
[*NAT-Device-GigabitEthernet0/1/0] nat bind acl 3001 instance nat1
[*NAT-Device-GigabitEthernet0/1/0] nat bind acl 3002 instance nat2
[*NAT-Device-GigabitEthernet0/1/0] commit
5. [~NAT-Device-GigabitEthernet0/1/0] quit
Configure a default route as a static route and set the next hop address of the default route to
11.11.11.2.
[~NAT-Device] ip route-static 0.0.0.0 0.0.0.0 11.11.11.2
6. [*NAT-Device] commit
7. ---------------------------------------------------------------------------
#
sysname NAT-Device
#
service-location 1
location follow-forwarding-mode
#
service-instance-group group1
service-location 1
#
nat instance nat1 id 1
service-instance-group group1
nat address-group address-group1 group-id 1 11.11.11.100 11.11.11.200 no-pat
#
nat instance nat2 id 2
service-instance-group group1
nat address-group address-group2 group-id 2 11.11.11.80 11.11.11.83
#
acl number 3001
rule 1 permit ip source 192.168.20.0 0.0.0.255
#
acl number 3002
rule 2 permit ip source 10.0.0.0 0.0.0.255
#
interface GigabitEthernet 0/1/0
undo shutdown
ip address 11.11.11.1 255.255.255.0
nat bind acl 3001 instance nat1
nat bind acl 3002 instance nat2
#
ip route-static 0.0.0.0 0.0.0.0 11.11.11.2
#
return
Networking Requirements
In Figure 1-90, NAT-Device functions as a gateway of an enterprise, and the FTP server is an
internal server on the enterprise network. Users on the Internet want to access the FTP server on
the private network. During the access process, public IP addresses are translated so that no
public network routes are imported to the private network. The peer device connected to
NAT-Device is assigned an IP address of 11.11.1.2.
Figure 1-90 shows IP addresses of interfaces. The configuration requirements are as follows:
● PCs on the Internet can access the FTP server inside the enterprise network.
● NAT-Device does not import public network routes.
Figure 1-90 Networking for configuring NAT to translate both the source and destination IP
addresses
In this example, interface 1 and interface 2 stand for GE 0/2/0 and GE 0/2/1, respectively.
Configuration Roadmap
The configuration roadmap is as follows:
Data Preparation
To complete the configuration, you need the following data:
● NAT instance names (nat1 and nat2) and indexes (1 and 2)
● NAT instance named nat1: NAT address pool name (address-group1), address pool
number (1), a range of public IP addresses (11.11.11.10 through 11.11.11.15); NAT
instance named nat2: NAT address pool name (address-group2), address pool
number (2), a range of public IP addresses (11.11.11.16 through 11.11.11.20)
● ACL numbers (3001 and 3002)
● Name (GE 0/2/0) and IP address (192.168.1.1/24) of a private network interface to
which a NAT diversion policy is applied; name (GE 0/2/1) and IP address (11.11.11.1)
of a public network interface to which a NAT diversion policy is applied
● Internal server's advertised public IP address (11.11.11.10) and internal IP address
(192.168.1.2)
Procedure
Create a VSM HA backup group and a VSM HA service instance group and bind a NAT service
board to the VSM HA backup group.
<HUAWEI> system-view
[~HUAWEI] sysname NAT-Device
[*HUAWEI] commit
[~NAT-Device] service-location 1
[*NAT-Device-service-location-1] location follow-forwarding-mode
[*NAT-Device-service-location-1] commit
[~NAT-Device-service-location-1] quit
[~NAT-Device] service-instance-group group1
[*NAT-Device-service-instance-group-group1] service-location 1
[*NAT-Device-service-instance-group-group1] commit
■ [~NAT-Device-service-instance-group-group1] quit
Create NAT instances named nat1 and nat2 and bind the VSM HA service instance group to the
NAT instances so that service traffic can be processed by the NAT service board.
[~NAT-Device] nat instance nat1 id 1
[*NAT-Device-nat-instance-nat1] service-instance-group group1
[*NAT-Device-nat-instance-nat1] commit
[~NAT-Device-nat-instance-nat1] quit
[~NAT-Device] nat instance nat2 id 2
[*NAT-Device-nat-instance-nat2] service-instance-group group1
[*NAT-Device-nat-instance-nat2] commit
■ [~NAT-Device-nat-instance-nat2] quit
■ [~NAT-Device-nat-instance-nat1] quit
Enable NAT ALG for FTP to translate the application-layer IP addresses and port numbers of
traffic of the NAT instance named nat1.
[~NAT-Device] nat instance nat1
[~NAT-Device-nat-instance-nat1] nat alg ftp
[*NAT-Device-nat-instance-nat1] commit
5. [~NAT-Device-acl4-advance-3002] quit
6. Apply the NAT diversion policy.
■ Apply the traffic classification policy with ACL 3001 to the view of GE 0/2/1
on the public network side.
■ Apply the traffic classification policy with ACL 3002 to the view of GE 0/2/0
on the private network side.
7. [~NAT-Device-GigabitEthernet0/2/0] quit
Configure a default route as a static route and set the next hop address of the default route to
11.11.11.2.
[~NAT-Device] ip route-static 0.0.0.0 0.0.0.0 11.11.11.2
8. [*NAT-Device] commit
9. extendable:false
#
sysname NAT-Device
#
service-location 1
location follow-forwarding-mode
#
service-instance-group group1
service-location 1
#
nat instance nat1 id 1
service-instance-group group1
nat server-mode enable
nat address-group address-group1 group-id 1 11.11.11.10 11.11.11.15
nat server global 11.11.11.10 inside 192.168.1.2
#
nat instance nat2 id 2
service-instance-group group1
nat address-group address-group2 group-id 2 11.11.11.16 11.11.11.20
nat alg ftp
#
acl number 3001
rule 1 permit ip source 192.168.1.0 0.0.0.255
#
acl number 3002
rule 2 permit ip source any
#
interface GigabitEthernet 0/2/1
undo shutdown
ip address 11.11.11.1 255.255.255.0
nat bind acl 3001 instance nat1
#
interface GigabitEthernet 0/2/0
undo shutdown
ip address 192.168.1.1 255.255.255.0
nat bind acl 3002 instance nat2
#
ip route-static 0.0.0.0 0.0.0.0 11.11.11.2
#
return
Networking Requirements
In Figure 1-91, an enterprise deploys an FTP server on the Internet, and NAT-Device functions
as the gateway of the enterprise network. To secure traffic transmission, the enterprise wants
that traffic exchanged between public network users and the FTP server is forwarded by
NAT-Device and that public network users and the FTP server are not aware of IP addresses of
one another.
Figure 1-91 Networking for configuring bidirectional NAT and using easy IP to create an internal
server
In this example, interface 1 and interface 2 stand for GE 0/2/1 and GE 0/2/2, respectively.
Configuration Roadmap
The configuration roadmap is as follows:
Data Preparation
To complete the configuration, you need the following data:
● NAT instance names (nat1 and nat2) and indexes (1 and 2)
● NAT-Device's address pool names (address-group1 and address-group2) and address
pool numbers (1 and 2), and Eazy IP address range
● ACL number (3001)
● Names (GE 0/2/1 and GE 0/2/2) and IP addresses (1.1.1.1/24 and 2.1.1.1/24) of
interfaces that apply a NAT diversion policy
Procedure
● [~NAT-Device-nat-instance-nat2] quit
● [~NAT-Device-GigabitEthernet0/2/2] quit
● [~NAT-Device-nat-instance-nat2] quit
2. [~NAT-Device-nat-instance-nat2] quit
3. [~NAT-Device-nat-instance-nat2] quit
Configure a NAT diversion policy. Configure an ACL numbered 3001, an ACL rule numbered 1,
and an ACL-based traffic classification rule to allow hosts to access the Internet.
[~NAT-Device] acl 3001
[*NAT-Device-acl4-advance-3001] rule 1 permit source any
[*NAT-Device-acl4-advance-3001] commit
4. [~NAT-Device-acl4-advance-3001] quit
Apply the NAT diversion policy. Apply the ACL-based traffic classification rule to the view of the
outbound interface named GE 0/2/1 and GE 0/2/2.
[~NAT-Device] interface GigabitEthernet 0/2/1
[~NAT-Device-GigabitEthernet0/2/1] nat bind acl 3001 instance nat1
[*NAT-Device-GigabitEthernet0/2/1] commit
[~NAT-Device-GigabitEthernet0/2/1] quit
[~NAT-Device] interface GigabitEthernet 0/2/2
[~NAT-Device-GigabitEthernet0/2/2] nat bind acl 3001 instance nat2
[*NAT-Device-GigabitEthernet0/2/2] commit
5. [~NAT-Device-GigabitEthernet0/2/2] quit
6. ---------------------------------------------------------------------------
#
sysname NAT-Device
#
service-location 1
location follow-forwarding-mode
#
service-instance-group group1
service-location 1
#
nat instance nat1 id 1
service-instance-group group1
nat address-group address-group1 group-id 1 unnumbered interface GigabitEthernet0/2/1
nat server protocol tcp global unnumbered interface GigabitEthernet0/2/1 ftp inside 2.1.1.2 ftp
nat alg ftp
#
nat instance nat2 id 2
service-instance-group group1
nat address-group address-group2 group-id 2 unnumbered interface GigabitEthernet0/2/2
nat server protocol tcp global unnumbered interface GigabitEthernet0/2/2 ftp inside 1.1.1.2 ftp
nat alg ftp
#
acl number 3001
rule 1 permit source any
#
interface GigabitEthernet 0/2/1
undo shutdown
ip address 1.1.1.1 24
nat bind acl 3001 instance nat1
#
interface GigabitEthernet 0/2/2
undo shutdown
ip address 2.1.1.1 24
nat bind acl 3001 instance nat2
#
return
Networking Requirements
In Figure 1-92, NAT-Device functions as an enterprise network gateway and is dual-homed to the
Internet through interfaces 2 and 3. NAT is configured to convert private IP addresses to public
IP addresses. The enterprise network wants to provide web and FTP server access services for
Internet users. The web server is assigned 192.168.4.1/16 and 192.168.5.1/16, and the FTP
server is assigned 192.168.2.1/16 and 192.168.3.1/16.
Figure 1-92 shows IP addresses of interfaces. The configuration requirements are as follows:
● External network users can access the web and FTP servers within the enterprise
network.
● Internal users and servers can access one another, without NAT conversion.
● The traffic sent from the enterprise network to the Internet is load-balanced based on
source IP addresses.
Figure 1-92 Networking for configuring outbound-interface NAT load balancing on an enterprise
network
Interfaces 1 through 3 in this example represent GE 0/2/0, GE 0/2/1, and GE 0/2/2, respectively.
Configuration Roadmap
The configuration roadmap is as follows:
Data Preparation
To complete the configuration, you need the following data:
● NAT instance names (nat1 and nat2) and indexes (1 and 2)
● Address pool name (address-group1) and ID (1)
● Private IP addresses of FTP server and web server in NAT instance nat1 (192.168.2.1
and 192.168.4.1, respectively) and in NAT instance nat2 (192.168.3.1 and
192.168.5.1, respectively)
● IP addresses (192.168.0.1/16, 11.11.1.1/24, and 11.11.2.1/24) of GE 0/2/0, GE 0/2/1,
and GE 0/2/2
● ACL numbers (3000 through 3005)
● NAT traffic diversion policy applied to GE 0/2/0; ACL 3000 to NAT instance nat1 bound
to GE 0/2/1; ACL 3000 to NAT instance nat1 bound to GE 0/2/2
Procedure
Enable the NAT device to load-balance received packets based on source IP addresses in all
slots.
<HUAWEI> system-view
[~HUAWEI] sysname NAT-Device
[*HUAWEI] commit
[~NAT-Device] load-balance hash-key ip source-ip slot all
● [*NAT-Device] commit
● [~NAT-Device-nat-instance-nat2] quit
Assign IP addresses to interfaces.
[~NAT-Device] interface gigabitEthernet 0/2/0
[~NAT-Device-GigabitEthernet0/2/1] ip address 192.168.0.1 16
[*NAT-Device-GigabitEthernet0/2/1] commit
[~NAT-Device-GigabitEthernet0/2/1] quit
[~NAT-Device] interface gigabitEthernet 0/2/1
[~NAT-Device-GigabitEthernet0/2/1] ip address 11.11.1.1 24
[*NAT-Device-GigabitEthernet0/2/1] commit
[~NAT-Device-GigabitEthernet0/2/1] quit
[~NAT-Device] interface gigabitEthernet 0/2/2
[~NAT-Device-GigabitEthernet0/2/2] ip address 11.11.2.1 24
[*NAT-Device-GigabitEthernet0/2/2] commit
● [~NAT-Device-GigabitEthernet0/2/2] quit
● [~NAT-Device-nat-instance-nat2] quit
Configure the NAT ALG function. Enable the NAT ALG function for FTP and DNS in each NAT
instance. Configure a DNS mapping entry that contains a domain name, a public IP address, and
a private IP address in each NAT instance for NAT processing that is performed after the DNS
server resolves the IP address of the internal server.
[~NAT-Device] nat instance nat1
[~NAT-Device-nat-instance-nat1] nat alg ftp
[*NAT-Device-nat-instance-nat1] nat alg dns
[*NAT-Device-nat-instance-nat1] nat dns-mapping domain www.huawei.com global-address
11.11.1.1 inside-address 192.168.4.1
[*NAT-Device-nat-instance-nat1] commit
[~NAT-Device-nat-instance-nat1] quit
[~NAT-Device] nat instance nat2
[~NAT-Device-nat-instance-nat2] nat alg ftp
[*NAT-Device-nat-instance-nat2] nat alg dns
[*NAT-Device-nat-instance-nat2] nat dns-mapping domain www.huawei.com global-address
11.11.2.1 inside-address 192.168.5.1
[*NAT-Device-nat-instance-nat2] commit
3. [~NAT-Device-nat-instance-nat2] quit
4. [~NAT-Device-nat-instance-nat2] quit
5. Configure a NAT traffic diversion policy.
Configure an ACL numbered 3000 to allow hosts on the enterprise network to access the
Internet.
[~NAT-Device] acl 3000
[*NAT-Device-acl4-advance-3000] rule 1 permit ip
[*NAT-Device-acl4-advance-3000] commit
● [~NAT-Device-acl4-advance-3000] quit
Configure an ACL numbered 3001 to allow hosts on the enterprise network to access one
another.
[~NAT-Device] acl 3001
[*NAT-Device-acl4-advance-3001] rule 1 permit ip source 192.168.0.0 0.0.255.255
[*NAT-Device-acl4-advance-3001] commit
● [~NAT-Device-acl4-advance-3001] quit
Configure an ACL numbered 3002 to allow the host at 192.168.2.1/32 on the enterprise network
to access the Internet.
[~NAT-Device] acl 3002
[*NAT-Device-acl4-advance-3002] rule 1 permit ip source 192.168.2.1 0.0.0.0
[*NAT-Device-acl4-advance-3002] commit
● [~NAT-Device-acl4-advance-3002] quit
Configure an ACL numbered 3003 to allow the host at 192.168.3.1/32 on the enterprise network
to access the Internet.
[~NAT-Device] acl 3003
[*NAT-Device-acl4-advance-3003] rule 1 permit ip source 192.168.3.1 0.0.0.0
[*NAT-Device-acl4-advance-3003] commit
● [~NAT-Device-acl4-advance-3003] quit
Configure an ACL numbered 3004 to allow the host at 192.168.4.1/32 on the enterprise network
to access the Internet.
[~NAT-Device] acl 3004
[*NAT-Device-acl4-advance-3004] rule 1 permit ip source 192.168.4.1 0.0.0.0
[*NAT-Device-acl4-advance-3004] commit
● [~NAT-Device-acl4-advance-3004] quit
Configure an ACL numbered 3005 to allow the host at 192.168.5.1/32 on the enterprise network
to access the Internet.
[~NAT-Device] acl 3005
[*NAT-Device-acl4-advance-3005] rule 1 permit ip source 192.168.5.1 0.0.0.0
[*NAT-Device-acl4-advance-3005] commit
● [~NAT-Device-acl4-advance-3005] quit
● [~NAT-Device-classifier-redirectover5] quit
Configure traffic behaviors for data that needs to be redirected. Set the redirected next-hop IP
address to 11.11.1.2 in a traffic behavior named redirectover2 and 11.11.2.2 in a traffic behavior
named redirectover3.
[~NAT-Device] traffic behavior redirectover1
[*NAT-Device-behavior-redirectover1] commit
[~NAT-Device-behavior-redirectover1] quit
[~NAT-Device] traffic behavior redirectover2
[*NAT-Device-behavior-redirectover2] redirect ip-nexthop 11.11.1.2
[*NAT-Device-behavior-redirectover2] commit
[~NAT-Device-behavior-redirectover2] quit
[~NAT-Device] traffic behavior redirectover3
[*NAT-Device-behavior-redirectover3] redirect ip-nexthop 11.11.2.2
[*NAT-Device-behavior-redirectover3] commit
● [~NAT-Device-behavior-redirectover3] quit
● Bind the traffic classifiers with the traffic behaviors in a traffic policy.
■ Data flows exchanged by users on the network segment of
192.168.0.0/16 within the enterprise network are assigned a
priority value of 1 (higher) and are not processed by NAT.
■ Data flows with the source IP address 192.168.2.1/32 pass
through outbound interface 2 and are assigned a priority value
of 2.
■ Data flows with the source IP address 192.168.3.1/32 pass
through outbound interface 3 and are assigned a priority value
of 3.
■ Data flows with the source IP address 192.168.4.1/32 pass
through outbound interface 2 and are assigned a priority value
of 4.
■ Data flows with the source IP address 192.168.5.1/32 pass
through outbound interface 3 and are assigned a priority value
of 5.
● [~NAT-Device-trafficpolicy-redirect] quit
6. [~NAT-Device-GigabitEthernet0/2/2] quit
7. [*NAT-Device] commit
Configuration File
#
sysname NAT-Device
#
load-balance hash-key ip source-ip slot all
#
service-location 1
location follow-forwarding-mode
#
service-instance-group group1
service-location 1
#
nat instance nat1 id 1
service-instance-group group1
nat address-group address-group1 group-id 1 unnumbered interface GigabitEthernet 0/2/1
nat server protocol tcp global unnumbered interface GigabitEthernet 0/2/1 ftp inside 192.168.2.1
ftp
nat server protocol tcp global unnumbered interface GigabitEthernet 0/2/1 www inside
192.168.4.1 www
nat alg ftp
nat alg dns
redirect ip-nexthop 11.11.1.2 outbound
nat dns-mapping domain www.huawei.com global-address 11.11.1.1 inside-address 192.168.4.1
#
nat instance nat2 id 2
service-instance-group group1
nat address-group address-group1 group-id 1 unnumbered interface GigabitEthernet 0/2/2
nat server protocol tcp global unnumbered interface GigabitEthernet 0/2/2 ftp inside 192.168.3.1
ftp
nat server protocol tcp global unnumbered interface GigabitEthernet 0/2/2 www inside
192.168.5.1 www
nat alg ftp
nat alg dns
redirect ip-nexthop 11.11.2.2 outbound
nat dns-mapping domain www.huawei.com global-address 11.11.2.1 inside-address 192.168.5.1
#
acl number 3000
rule 1 permit ip
#
acl number 3001
rule 1 permit ip source 192.168.0.0 0.0.255.255
#
acl number 3002
rule 1 permit ip source 192.168.2.1 0
#
acl number 3003
rule 1 permit ip source 192.168.3.1 0
#
acl number 3004
rule 1 permit ip source 192.168.4.1 0
#
traffic classifier redirectover1 operator or
if-match acl 3001
#
traffic classifier redirectover2 operator or
if-match acl 3002
#
traffic classifier redirectover3 operator or
if-match acl 3003
#
traffic classifier redirectover4 operator or
if-match acl 3004
#
traffic classifier redirectover5 operator or
if-match acl 3005
#
traffic behavior redirectover1
#
traffic behavior redirectover2
redirect ip-nexthop 11.11.1.2
#
traffic behavior redirectover3
redirect ip-nexthop 11.11.2.2
#
traffic policy redirect
classifier redirectover1 behavior redirectover1 precedence 1
classifier redirectover2 behavior redirectover2 precedence 2
classifier redirectover3 behavior redirectover3 precedence 3
classifier redirectover4 behavior redirectover2 precedence 4
classifier redirectover5 behavior redirectover3 precedence 5
#
interface GigabitEthernet 0/2/0
undo shutdown
ip address 192.168.0.1 255.255.0.0
traffic-policy redirect inbound
#
interface GigabitEthernet 0/2/1
undo shutdown
ip address 11.11.1.1 255.255.255.0
nat bind acl 3000 instance nat1
#
interface GigabitEthernet 0/2/2
undo shutdown
ip address 11.11.2.1 255.255.255.0
nat bind acl 3000 instance nat2
#
ip route-static 0.0.0.0 0.0.0.0 11.11.1.2
ip route-static 0.0.0.0 0.0.0.0 11.11.2.2
#
return
Networking Requirements
In Figure 1-93, home users access a BRAS using IPoE. The BRAS implements user
authentication, authorization, and accounting. It also provides the NAT service to convert
between the private and public IP addresses of home users, so that the home users can access
the Internet.
Home users of user group 1 can access the Internet.
Figure 1-93 Example for configuring IPoEoVLAN access together with NAT
Data Preparation
To complete the configuration, you need the following data:
● Name of a NAT instance
● NAT address pool's number and start and end IP addresses
● User group name
● ACL and UCL numbers
● NAT traffic diversion policy information
Procedure
Create a NAT instance named nat1.
<HUAWEI> system-view
[~HUAWEI] service-location 1
[*HUAWEI-service-location-1] location follow-forwarding-mode
[*HUAWEI-service-location-1] commit
[~HUAWEI-service-location-1] quit
[~HUAWEI] service-instance-group group1
[*HUAWEI-service-instance-group-group1] service-location 1
[*HUAWEI-service-instance-group-group1] commit
[~HUAWEI-service-instance-group-group1] quit
[~HUAWEI] nat instance nat1 id 1
[*HUAWEI-nat-instance-nat1] service-instance-group group1
[*HUAWEI-nat-instance-nat1] commit
1. [~HUAWEI-nat-instance-nat1] quit
2. [~HUAWEI-nat-instance-nat1] quit
3. Configure NAT user information.
● Create a user group named group1.
[~HUAWEI] user-group group1
● [~HUAWEI-aaa] quit
4. Configure a traffic classification rule, a NAT behavior, and a NAT traffic policy and
apply the policy.
Configure UCLs for user traffic. A UCL number ranges from 6000 to 9999.
Configure ACL-based traffic classification rule and set the ACL number to 6001 and ACL rule
number to 1.
[~HUAWEI] acl number 6001
[*HUAWEI-acl-ucl-6001] rule 1 permit ip source user-group group1
[*HUAWEI-acl-ucl-6001] commit
● [~HUAWEI-acl-ucl-6001] quit
● [~HUAWEI-classifier-c1] quit
Configure a traffic behavior named b1 and bind the traffic behavior to the NAT instance named
nat1.
[~HUAWEI] traffic behavior b1
[*HUAWEI-behavior-b1] nat bind instance nat1
[*HUAWEI-behavior-b1] commit
● [~HUAWEI-behavior-b1] quit
Configure a NAT diversion policy and associate the ACL rule with the traffic behavior.
[~HUAWEI] traffic policy p1
[*HUAWEI-trafficpolicy-p1] share-mode
[*HUAWEI-trafficpolicy-p1] classifier c1 behavior b1 precedence 1
[*HUAWEI-trafficpolicy-p1] commit
● [~HUAWEI-trafficpolicy-p1] quit
Apply the NAT diversion policy in the system view.
[~HUAWEI] traffic-policy p1 inbound
● [*HUAWEI] commit
5. [*HUAWEI-Eth-Trunk2.1] quit
Configuration Files
● return
Precautions
Table 1-40 Precautions for deploying NAT together with DAA
1 After DAA services are If DAA services are Plan DAA services
deployed for users in the web deployed in the web in the web
pre-authentication domain, pre-authentication authentication
these users cannot be domain, users domain when both
switched to the web cannot log in to the web and DAA
authentication domain. web authentication services are
domain. deployed.
2 A DAA service policy cannot A DAA service policy None
be delivered by the Common can be delivered
Open Policy Service (COPS). only through domain
binding, the RADIUS
server, or Diameter
server.
Prerequisites
(2) If RADIUS
accounting is
applied to a
user's
value-added
services (BOD
and DAA),
accounting
packets carry
the user's
Acct-Session-Id
as the
Multi-Session-Id
.
(3) When
Multi-Link
Point-to-Point
Protocol
(MLPPP) is
used, the
Acct-Session-Id
of the first user
of the MP-group
interface is used
as the
Multi-Session-Id
.
44 Acct-Ses String All The formats of The length
sion-Id Acct-Session-Id of
are as follows: Acct-Sessi
on-Id is as
follows:
The value
Version 1: host contains
name (7 bits) + 27 to 33
slot number (2 bytes for
bits) + card version 1
number (1 bit) + format due
port number (2 to the
bits) + {VPI (4 variable-le
bits) + VCI (5 ngth host
bits), outer name, 16
VLAN (4 bits) + bytes for
inner VLAN (5 version 2
bits)} + format, 8
CPUTICK (in bytes for
hexadecimal version 3
format, 6 bits) + format,
user connection and 15
index (6 bits) bytes for
version 4
format.
Version 2: {VPI
(4 bits), outer
VLAN (4 bits)} + The value
CPUTICK (in contains
hexadecimal 26 to 32
format, 6 bits) + bytes for
user connection the DSG
index (6 bits) service
due to the
variable-le
ngth host
Version 3:
name.
CPUTICK (in
hexadecimal
format, the
lower order 2
bits) + user
connection
index (6 bits)
Version 4: host
name (7 bits) +
serial number (2
bits) + user
connection
index (6 bits)
The format in
the DSG service
is: host name (7
bits) + slot
number (2 bits)
+ card number
(1 bit) + port
number (2 bits)
+ SSG + service
ID (5 bits) +
CPUTICK (in
hexadecimal
format, 6 bits) +
user connection
index (6 bits)
Networking Requirements
Assume that a user has two types of service traffic: enterprise internal service traffic and external
public network service traffic. Enterprise internal services match DAA, requiring separate rate
limit and no accounting. External services do not match DAA, requiring separate rate limit and
RADIUS accounting.
● The user sends a login request to the BRAS, which then sends an authentication
request to the AAA server. The AAA server then returns an authentication success
message to the BRAS.
● When the user goes online, the BRAS assigns a private IP address to the user and
performs NAT on the BRAS to translate the private IP address into a public IP
address.
● When the user accesses the network, ACL rules are used to match the destination
address of the user to determine whether the network accessed by the user is an
enterprise intranet or an external network. In this way, separate rate limiting is
performed.
● The BRAS sends an accounting start request packet for external services to the AAA
server.
Figure 1-94 Networking diagram for configuring NAT together with DAA
Configuration Roadmap
For the CX600 chassis-shaped device used outside China, NE40E, and ME60, the engine
parameter must be specified when resource licenses are allocated and NAT service boards are
bound.
When NAT is deployed on an NE20E, no license needs to be configured.
When NAT is deployed on an NE8000-M series device, only the resource license needs to be
configured. The bandwidth license does not need to be configured.
[~HUAWEI] license
[*HUAWEI-license] active nat session-table size 6 slot 1 engine 0
[*HUAWEI-license] active nat session-table size 6 slot 2 engine 0
[*HUAWEI-license] active nat bandwidth-enhance 40 slot 1
[*HUAWEI-license] active nat bandwidth-enhance 40 slot 2
[*HUAWEI-license] commit
[~HUAWEI-license] quit
[~HUAWEI] service-location 1
[*HUAWEI-service-location-1] location slot 1 engine 0 backup slot 2 engine 0
[*HUAWEI-service-location-1] quit
[*HUAWEI] service-instance-group group1
[*HUAWEI-service-instance-group-group1] service-location 1
[*HUAWEI-service-instance-group-group1] commit
[~HUAWEI-service-instance-group-group1] quit
# Configure a NAT instance.
[~HUAWEI] nat instance nat1
[*HUAWEI-nat-instance-nat1] nat address-group address-group1 group-id 1
[*HUAWEI-nat-instance-nat1-nat-address-group-address-group1] section 1 11.11.11.0 mask 24
[*HUAWEI-nat-instance-nat1-nat-address-group-address-group1] quit
[*HUAWEI-nat-instance-nat1] port-range 1024
[*HUAWEI-nat-instance-nat1] service-instance-group group1
[*HUAWEI-nat-instance-nat1] nat outbound any address-group address-group1
[*HUAWEI-nat-instance-nat1] nat alg all
[*HUAWEI-nat-instance-nat1] nat filter mode full-cone
[*HUAWEI-nat-instance-nat1] commit
1. [~HUAWEI-nat-instance-nat1] quit
2. [~HUAWEI-ip-pool-pool1] quit
# Configure a user group. Assign different user groups based on user attributes to
control different access permissions and policies.
■ If a user is in the pre-authentication domain, the device assigns
user-group preweb to the user. This user group is used to control user
access permissions so that the user can access only the web server.
■ If a user is in the authentication domain, the user has gone online
successfully. The device then assigns user-group web to the user. This
user group grants the user access permissions. It diverts traffic for NAT
when the user accesses external network services.
■ After a DAA service policy is delivered to a user, the device assigns
user-group daa to the user. This user group increases the bandwidth for
the user to access specific resources.
The user groups in the pre-authentication domain, authentication domain, and the DAA service
policy must be bound to the same NAT instance.
[~HUAWEI] aaa
[~HUAWEI-aaa] authentication-scheme none
[*HUAWEI-aaa-authen-none] authentication-mode none
[*HUAWEI-aaa-authen-none] commit
[~HUAWEI-aaa-authen-none] quit
[~HUAWEI-aaa] accounting-scheme none
[*HUAWEI-aaa-accounting-none] accounting-mode none
[*HUAWEI-aaa-accounting-none] commit
[~HUAWEI-aaa-accounting-none] quit
[~HUAWEI-aaa] domain preweb
[*HUAWEI-aaa-domain-preweb] authentication-scheme none
[*HUAWEI-aaa-domain-preweb] accounting-scheme none
[*HUAWEI-aaa-domain-preweb] user-group preweb bind nat instance nat1
[*HUAWEI-aaa-domain-preweb] commit
[~HUAWEI-aaa-domain-preweb] ip-pool pool1
[~HUAWEI-aaa-domain-preweb] web-server 192.168.10.2
[~HUAWEI-aaa-domain-preweb] web-server url http://192.168.10.2
[~HUAWEI-aaa-domain-preweb] quit
[~HUAWEI-aaa] quit
# Configure an authentication domain. Users in the authentication domain are online users and
require RADIUS authentication and accounting.
[~HUAWEI] aaa
[~HUAWEI-aaa] authentication-scheme radius
[*HUAWEI-aaa-authen-radius] authentication-mode radius
[*HUAWEI-aaa-authen-radius] commit
[~HUAWEI-aaa-authen-radius] quit
[~HUAWEI-aaa] accounting-scheme radius
[*HUAWEI-aaa-accounting-radius] accounting-mode radius
[*HUAWEI-aaa-accounting-radius] commit
[~HUAWEI-aaa-accounting-radius] quit
[~HUAWEI-aaa] domain web
[*HUAWEI-aaa-domain-web] authentication-scheme radius
[*HUAWEI-aaa-domain-web] accounting-scheme radius
[*HUAWEI-aaa-domain-web] radius-server group radius
[*HUAWEI-aaa-domain-web] user-group web bind nat instance nat1
[*HUAWEI-aaa-domain-web] qos-profile qos-prof1 inbound
[*HUAWEI-aaa-domain-web] qos-profile qos-prof1 outbound
[*HUAWEI-aaa-domain-web] commit
[~HUAWEI-aaa-domain-web] portal-server 192.168.10.2
[~HUAWEI-aaa-domain-web] portal-server url http://192.168.10.2/portal/admin
[~HUAWEI-aaa-domain-web] quit
[~HUAWEI-aaa] quit
# Configure ACL rules. The user group is used to control the access permissions of users in the
pre-authentication domain.
[~HUAWEI] acl number 6000
[*HUAWEI-acl-ucl-6000] rule 5 permit ip source user-group preweb destination ip-address
127.0.0.1 0
[*HUAWEI-acl-ucl-6000] rule 15 permit ip source ip-address 127.0.0.1 0 destination
user-group preweb
[*HUAWEI-acl-ucl-6000] rule 20 permit ip source user-group preweb destination ip-address
192.168.10.2 0
[*HUAWEI-acl-ucl-6000] rule 25 permit ip source ip-address 192.168.10.2 0 destination
user-group preweb
[*HUAWEI-acl-ucl-6000] commit
[~HUAWEI-acl-ucl-6000] quit
[~HUAWEI] acl number 6001
[*HUAWEI-acl-ucl-6001] rule 5 permit tcp source user-group preweb destination-port eq
www
[*HUAWEI-acl-ucl-6001] rule 10 permit tcp source user-group preweb destination-port eq
8080
[*HUAWEI-acl-ucl-6001] commit
[~HUAWEI-acl-ucl-6001] quit
[~HUAWEI] acl number 6002
[*HUAWEI-acl-ucl-6002] rule 5 permit ip source ip-address any destination user-group
preweb
[*HUAWEI-acl-ucl-6002] rule 10 permit ip source user-group preweb destination ip-address
any
[*HUAWEI-acl-ucl-6002] commit
[~HUAWEI-acl-ucl-6002] quit
# Configure traffic classifiers.
[~HUAWEI] traffic classifier web-permit
[*HUAWEI-classifier-web-permit] if-match acl 6000
[*HUAWEI-classifier-web-permit] commit
[~HUAWEI-classifier-web-permit] quit
[~HUAWEI] traffic classifier web-redirect
[*HUAWEI-classifier-preweb] if-match acl 6001
[*HUAWEI-classifier-preweb] commit
[~HUAWEI-classifier-preweb] quit
[~HUAWEI] traffic classifier web-deny
[*HUAWEI-classifier-web-deny] if-match acl 6002
[*HUAWEI-classifier-web-deny] commit
3. [~HUAWEI-classifier-web-deny] quit
Configure the DAA service. The corresponding acceleration is performed when a user accesses
a specific resource.
# Enable the DAA service.
[~HUAWEI] value-added-service enable
[*HUAWEI] commit
# Configure DAA traffic policies.
[~HUAWEI] acl number 6010
[*HUAWEI-acl-ucl-6010] rule 5 permit ip source user-group web destination any
[*HUAWEI-acl-ucl-6010] rule 10 permit ip source any destination user-group web
[*HUAWEI-acl-ucl-6010] quit
[*HUAWEI] acl number 6011
[*HUAWEI-acl-ucl-6011] rule 5 permit ip source user-group daa destination ip-address
192.168.200.0 0.0.0.255
[*HUAWEI-acl-ucl-6011] rule 10 permit ip source ip-address 192.168.200.0 0.0.0.255
destination user-group daa
[*HUAWEI-acl-ucl-6011] commit
[*HUAWEI] acl number 6012
[*HUAWEI-acl-ucl-6012] rule 5 permit ip source user-group daa destination any
[*HUAWEI-acl-ucl-6012] rule 10 permit ip source any destination user-group daa
[*HUAWEI-acl-ucl-6012] commit
[~HUAWEI-acl-ucl-6012] quit
# Configure DAA traffic classifiers.
[~HUAWEI] traffic classifier daa_default
[*HUAWEI-classifier-daa_default] if-match acl 6010
[*HUAWEI-classifier-daa_default] quit
[*HUAWEI] traffic classifier daa_t1
[*HUAWEI-classifier-daa_tc1] if-match acl 6011
[*HUAWEI-classifier-daa_tc1] commit
[*HUAWEI] traffic classifier daa_t2
[*HUAWEI-classifier-daa_tc2] if-match acl 6012
[*HUAWEI-classifier-daa_tc2] commit
[~HUAWEI-classifier-daa_tc2] quit
# Configure DAA service policies. A DAA service policy must be bound to a NAT instance.
Otherwise, NAT cannot be performed, and services are interrupted.
In NAT load balancing scenarios, to prevent uneven load balancing of NAT users, you are
advised not to bind a user group to a NAT instance in the default DAA service policy.
[~HUAWEI] value-added-service policy vp_daa_default daa
[*HUAWEI-vas-policy-vp_daa_default] user-group web bind nat instance nat1
[*HUAWEI-vas-policy-vp_daa_default] traffic-separate enable
[*HUAWEI-vas-policy-vp_daa_default] accounting-together enable
[*HUAWEI-vas-policy-vp_daa_default] quit
[*HUAWEI] value-added-service policy vp_daa daa
[*HUAWEI-vas-policy-vp_daa] user-group daa bind nat instance nat1
[*HUAWEI-vas-policy-vp_daa] traffic-separate enable
[*HUAWEI-vas-policy-vp_daa] tariff-level 5 qos-profile qos-prof2
[*HUAWEI-vas-policy-vp_daa] commit
[~HUAWEI-vas-policy-vp_daa] quit
# Bind DAA to the authentication domain. In this step, you can mark a user as a DAA user. DAA
policies can be dynamically delivered only after the user is marked as a DAA user. There are two
ways to mark a user as a DAA user: static configuration in the domain or dynamic delivery by the
RADIUS server. To facilitate maintenance, you are advised to choose static configuration unless
otherwise specified.
[~HUAWEI-aaa] domain web
[~HUAWEI-aaa-domain-web] value-added-service account-type radius radius
[*HUAWEI-aaa-domain-web] value-added-service policy vp_daa_default
[*HUAWEI-aaa-domain-web] commit
[~HUAWEI-aaa-domain-web] quit
3. [~HUAWEI-aaa] quit
Configure policy binding.
# Configure traffic behaviors for users in the web pre-authentication domain.
[~HUAWEI] traffic behavior web-deny
[*HUAWEI-behavior-web-deny] deny
[*HUAWEI-behavior-web-deny] commit
[~HUAWEI-behavior-web-deny] quit
[~HUAWEI] traffic behavior web-permit
[*HUAWEI-behavior-web-permit] nat bind instance nat1
[*HUAWEI-behavior-web-permit] commit
[~HUAWEI-behavior-web-permit] quit
[~HUAWEI] traffic behavior web-redirect
[*HUAWEI-behavior-web-preweb] http-redirect
[*HUAWEI-behavior-web-preweb] commit
[~HUAWEI-behavior-web-preweb] quit
# Configure a traffic policy for the web pre-authentication domain.
[~HUAWEI] traffic policy preweb
[*HUAWEI-policy-preweb] share-mode
[*HUAWEI-policy-preweb] classifier web-permit behavior web-permit
[*HUAWEI-policy-preweb] classifier web-redirect behavior web-redirect
[*HUAWEI-policy-preweb] classifier web-deny behavior web-deny
[*HUAWEI-policy-preweb] commit
[~HUAWEI-policy-preweb] quit
# Apply the traffic policy for the web pre-authentication domain.
[~HUAWEI] traffic-policy preweb inbound
# Configure DAA traffic policies for users in the web authentication domain.
[~HUAWEI] traffic behavior daa_default
[*HUAWEI-behavior-daa_default] nat bind instance nat1
[*HUAWEI-behavior-daa_default] traffic-statistic
[*HUAWEI-behavior-daa_default] quit
[*HUAWEI] traffic behavior daa_b1
[*HUAWEI-behavior-daa_b1] nat bind instance nat1
[*HUAWEI-behavior-daa_b1] tariff-level 5
[*HUAWEI-behavior-daa_b1] car
[*HUAWEI-behavior-daa_b1] traffic-statistic
[*HUAWEI-behavior-daa_b1] quit
[*HUAWEI] traffic behavior daa_b2
[*HUAWEI-behavior-daa_b2] nat bind instance nat1
[*HUAWEI-behavior-daa_b2] commit
[~HUAWEI-behavior-daa_b2] quit
# Bind a DAA user policy.
[~HUAWEI] traffic policy daa
[*HUAWEI-policy-daa] share-mode
[*HUAWEI-policy-daa] classifier daa_default behavior daa_default
[*HUAWEI-policy-daa] classifier daa_c1 behavior daa_b1
[*HUAWEI-policy-daa] classifier daa_c2 behavior daa_b2
[*HUAWEI-policy-daa] commit
[~HUAWEI-policy-daa] quit
# Apply DAA user traffic policies.
The traffic-policy inbound command in the system view does not take effect for DAA users. If a
user is marked as a DAA user, you can only perform this step to control the traffic diversion
policy.
[~HUAWEI] accounting-service-policy daa
# Configure the authentication interface.
[~HUAWEI] interface gigabitEthernet0/1/1
[~HUAWEI-GigabitEthernet0/1/1] bas
[~HUAWEI-GigabitEthernet0/1/1] access-type layer2-subscriber default-domain
pre-authentication preweb authentication web
[~HUAWEI-GigabitEthernet0/1/1] authentication-method web ppp
4. [~HUAWEI-GigabitEthernet0/1/1] quit
Configuration Files
#
radius-server group radius
radius-server authentication 172.16.45.220 1812 weight 0
radius-server accounting 172.16.45.220 1813 weight 0
radius-server shared-key %^%#`E)v.Q@BHVzxxZ;ij{>&_M0!TGP7YRA@8a7mq<\/%^%#
#
service-location 1
location slot 1 engine 0 backup slot 2 engine 0
#
service-instance-group group1
service-location 1
#
nat instance nat1 id 1
port-range 1024
service-instance-group group1
nat address-group address-group1 group-id 1
section 0 11.11.11.0 mask 24
nat outbound any address-group 1
nat alg all
nat filter mode full-cone
#
ip pool pool1 bas local
gateway 10.0.0.1 255.255.255.0
section 0 10.0.0.2 10.0.0.200
excluded-ip-address 10.0.0.101
#
web-auth-server 192.168.10.2 port 50100 key cipher huawei
#
value-added-service enable
#
qos-profile qos-prof1
car cir 5000 cbs 935000 green pass red discard inbound
car cir 5000 cbs 935000 green pass red discard outbound
qos-profile qos-prof2
car cir 10000 cbs 1870000 green pass red discard inbound
car cir 10000 cbs 1870000 green pass red discard outbound
#
user-group preweb
user-group web
user-group daa
#
aaa
authentication-scheme none
authentication-mode none
authentication-scheme radius
authentication-mode radius
#
accounting-scheme none
accounting-mode none
accounting-scheme radius
accounting-mode radius
#
domain preweb
authentication-scheme none
accounting-scheme none
ip-pool pool1
user-group preweb bind nat instance nat1
web-server 192.168.10.2
web-server url http://192.168.10.2
#
domain web
authentication-scheme radius
accounting-scheme radius
radius-server group radius
user-group web bind nat instance nat1
qos-profile qos-prof1 inbound
qos-profile qos-prof1 outbound
value-added-service account-type radius radius
value-added-service policy vp_daa_default
portal-server 192.168.10.2
portal-server url http://192.168.10.2/portal/admin
#
#
value-added-service policy vp_daa_default daa
user-group web bind nat instance nat1
accounting-together enable
traffic-separate enable
#
value-added-service policy vp_daa daa
user-group daa bind nat instance nat1
traffic-separate enable
tariff-level 5 qos-profile qos-prof2
#
acl number 6000
rule 5 permit ip source user-group preweb destination ip-address 127.0.0.1 0
rule 15 permit ip source ip-address 127.0.0.1 0 destination user-group preweb
rule 20 permit ip source user-group preweb destination ip-address 192.168.10.2 0
rule 25 permit ip source ip-address 192.168.10.2 0 destination user-group preweb
#
acl number 6001
rule 5 permit tcp source user-group preweb destination-port eq www
rule 10 permit tcp source user-group preweb destination-port eq 8080
#
acl number 6002
rule 5 permit ip source ip-address any destination user-group preweb
rule 10 permit ip source user-group preweb destination ip-address any
#
acl number 6010
rule 5 permit ip source user-group web destination any
rule 15 permit ip source any destination user-group preweb
#
acl number 6011
rule 5 permit ip source user-group daa destination ip-address 192.168.200.0 0.0.0.255
rule 10 permit ip source ip-address 192.168.200.0 0.0.0.255 destination user-group daa
#
acl number 6012
rule 5 permit ip source user-group daa destination any
rule 10 permit ip source any destination user-group daa
#
traffic classifier web-deny operator or
if-match acl 6002
traffic classifier web-permit operator or
if-match acl 6000
traffic classifier web-redirect operator or
if-match acl 6001
traffic classifier daa_default operator or
if-match acl 6010
traffic classifier daa_c1 operator or
if-match acl 6011
traffic classifier daa_c2 operator or
if-match acl 6012
#
traffic behavior web-deny
deny
traffic behavior web-permit
nat bind instance nat1
traffic behavior web-redirect
http-redirect
traffic behavior daa_default
nat bind instance nat1
traffic behavior daa_b1
nat bind instance nat1
tariff-level 5
car
traffic-statistic
traffic behavior daa_b2
nat bind instance nat1
#
traffic policy preweb
share-mode
classifier web-permit behavior web-permit
classifier web-redirect behavior web-redirect
classifier web-deny behavior web-deny
traffic policy daa
share-mode
classifier daa_default behavior daa_default
classifier daa_c1 behavior daa_b1
classifier daa_c2 behavior daa_b2
#
traffic-policy preweb inbound
#
accounting-service-policy daa
#
interface gigabitEthernet0/1/1
bas
#
access-type layer2-subscriber default-domain pre-authentication preweb authentication web
authentication-method web ppp
#
#
return
Precautions
Table 1-44 Precautions for centralized NAT automatic load balancing in inter-chassis 1:1 cold
backup scenarios
5 The resource licenses of all CPUs If you do not Before running the
configured in the service-instance do so, load service-instance-g
group view must be the same, as balancing will roup command,
too must the bandwidth licenses of be uneven. check the resource
the CPUs. and bandwidth
licenses of each
CPU.
6 In dual-device backup scenarios, If this Before configuring
you need to specify the slave parameter is dual-device backup,
parameter in the nat ip-pool not specified, manually select a
command on one device. some device as the
addresses backup device for
may be which the slave
allocated parameter is to be
twice, causing specified.
traffic to enter
an incorrect
device.
7 After the load balancing solution is For the public You are advised to
used, the addresses in the NAT IP addresses run the port-range
address pool configured using the that are command to limit
nat ip-pool command are assigned first, the number of ports
dynamically allocated to CPUs. their port for a single user or
During off-peak hours, user usage is high run the nat ip
services all use the first assigned or their ports access-user limit
public IP addresses, for example, are command to limit
the addresses from the initial exhausted. In the number of
address segment. Because one contrast, the private network
user can be assigned ports of only port usage of users using a single
a specific public IP address, not the addresses public IP address.
ports of the other addresses, that are
problems will occur as the number assigned later
of services grows. is low.
Prerequisites
Networking Requirements
In the centralized deployment scenario shown in Figure 1-95, CGN1 and CGN2 are deployed
near the IGW at the metro network core as standalone devices. They need to be configured with
different public IP addresses and static default routes to be advertised to the user-side router. In
addition, BGP local preference values need to be configured on the user-side router to ensure
that the preference of the route advertised by CGN1 is higher than that advertised by CGN2.
Typically, if a CGN service board fails, BGP does not withdraw the default route advertised to a
downstream device. As a result, traffic is interrupted when it is forwarded to the CGN device over
the static default route. To address this problem, configure the function of associating NAT
inter-chassis cold backup with CGN boards. Specifically, by associating a serviceif interface with
an HA service status monitoring group, this function can promptly detect the running status of
CGN service boards and switch the traffic to the backup device if necessary.
Figure 1-95 Networking diagram for configuring centralized NAT automatic load balancing in an
inter-chassis 1:1 cold backup scenario
Before configuring CGN devices, ensure that BGP local-preference has been configured on the
user-side router and that the router preferentially selects the default route from one CGN device.
The two CGN devices must have the same configurations except for the preference parameter.
Procedure
Configure basic NAT functions. The configuration of CGN2 is similar to that of CGN1. For
configuration details, see the configuration files.
Configure NAT licenses and bind them to boards.
<HUAWEI> system-view
[~HUAWEI] sysname CGN1
[*HUAWEI] commit
[~CGN1] license
[*CGN1-license] active nat session-table size 16 slot 4 engine 0
[*CGN1-license] active nat session-table size 16 slot 5 engine 0
[*CGN1-license] active nat bandwidth-enhance slot 4 engine 0
[*CGN1-license] commit
[~CGN1-license] quit
For the CX600 chassis-shaped device used outside China, NE40E, and ME60, the engine
parameter must be specified when resource licenses are allocated and NAT service boards are
bound.
# Configure a service-instance group.
[~CGN1] service-instance-group nat1
[*CGN1-service-instance-group-nat1] service-location 1
[*CGN1-service-instance-group-nat1] service-location 2
[*CGN1-service-instance-group-nat1] commit
[~CGN1-service-instance-group-nat1] quit
Do not specify the same CPU multiple times in the service-instance group view. Otherwise, load
balancing is uneven.
# Configure a global address pool, set the mask length of the initial address segment, and set the
mask length of the extended address segment to be used after the initial address segment is
exhausted.
[~CGN1] nat ip-pool nat_pool1
[*CGN1-nat-nat-ip-pool-nat_pool1] section 0 11.11.11.0 mask 24
[*CGN1-nat-nat-ip-pool-nat_pool1] nat-instance subnet length initial 26 extend 28
[*CGN1-nat-nat-ip-pool-nat_pool1] commit
[~CGN1-nat-nat-ip-pool-nat_pool1] quit
# Configure a NAT instance and the ALG function to ensure that NAT is performed for packets
containing IP addresses and port numbers.
[~CGN1] nat instance nat1
[*CGN1-nat-instance-nat1] port-range 4096
[*CGN1-nat-instance-nat1] service-instance-group nat1
[*CGN1-nat-instance-nat1] nat address-group 1 group-id 1 bind-ip-pool nat_pool1
[*CGN1-nat-instance-nat1] nat outbound any address-group 1
[*CGN1-nat-instance-nat1] nat alg all
[*CGN1-nat-instance-nat1] nat filter mode full-cone
[*CGN1-nat-instance-nat1] nat statistics port-usage enable
[*CGN1-nat-instance-nat1] nat statistics session-usage enable
[*CGN1-nat-instance-nat1] nat statistics address-pool-usage enable
[*CGN1-nat-instance-nat1] commit
[~CGN1-nat-instance-nat1] quit
# Configure an ACL rule.
[~CGN1] acl number 3001
[*CGN1-acl-ucl-3001] rule 5 permit ip source 10.0.0.0 0.0.255.255
[*CGN1-acl-ucl-3001] commit
[~CGN1-acl-ucl-3001] quit
# Configure a traffic policy.
[~CGN1] traffic classifier nat1
[*CGN1-classifier-web-permit] if-match acl 3001
[*CGN1-classifier-web-permit] commit
[~CGN1-classifier-web-permit] quit
[~CGN1] traffic behavior nat1
[*CGN1-behavior-nat1] nat bind instance nat1
[*CGN1-behavior-nat1] commit
[~CGN1-behavior-nat1] quit
[~CGN1] traffic policy NAT
[*CGN1-policy-NAT] share mode
[*CGN1-policy-NAT] classifier nat1 behavior nat
[*CGN1-policy-NAT] commit
1. [~CGN1-policy-NAT] quit
Configure association of NAT board faults with inter-chassis NAT cold backup. The configuration
of CGN2 is similar to that of CGN1. For configuration details, see the configuration files.
# Configure a VPN instance.
[~CGN1] ip vpn-instance inside_vrf
[*CGN1-vpn-instance-inside_vrf] ipv4-family
[*CGN1-vpn-instance-inside_vrf] route-distinguisher 100:1
[*CGN1-vpn-instance-inside_vrf] vpn-target 111:1 both
[*CGN1-vpn-instance-inside_vrf] commit
[~CGN1-vpn-instance-inside_vrf] quit
# Configure a monitor-location group.
[~CGN1] monitor-location-group cgn1
[*CGN1-monitor-location-group-cgn1] service-location 1
[*CGN1-monitor-location-group-cgn1] service-location 2
[*CGN1-monitor-location-group-cgn1] commit
[~CGN1-monitor-location-group-cgn1] quit
# Configure an interface named serviceif1 and bind it to the monitor-location group.
[~CGN1] interface serviceif1
[*CGN1-serviceif1] ip binding vpn-instance inside_vrf
[*CGN1-serviceif1] ip address 10.0.0.0 255.255.255.255
[*CGN1-serviceif1] track monitor-location-group cgn1
[*CGN1-serviceif1] commit
2. [~CGN1-serviceif1] quit
Configure routing-related functions. The configuration of CGN2 is similar to that of CGN1. For
configuration details, see the configuration files.
# Configure a static route on the device and set the outbound interface of the route to serviceif1.
[~CGN1] ip route-static vpn-instance inside_vrf 0.0.0.0 0.0.0.0 serviceif1
[*CGN1] commit
# Configure a route advertisement policy.
[~CGN1] bgp 65000
[*CGN1-bgp] peer 10.1.1.11 as-number 65000
[*CGN1-bgp] peer 10.1.1.11 connect-interface LoopBack0
[*CGN1-bgp] peer 10.1.1.12 as-number 65000
[*CGN1-bgp] peer 10.1.1.12 connect-interface LoopBack0
[*CGN1-bgp] ipv4-family unicast
[*CGN1-bgp-af-ipv4] undo synchronization
[*CGN1-bgp-af-ipv4] peer 10.1.1.12 enable
[*CGN1-bgp-af-ipv4] quit
[*CGN1-bgp] ipv4-family vpn-instance inside_vrf
[*CGN1-bgp-inside_vrf] peer 10.1.1.11 enable
[*CGN1-bgp-inside_vrf] peer 10.1.1.11 default-route-advertise
[*CGN1-bgp-inside_vrf] commit
3. [~CGN1-bgp-inside_vrf] quit
Configure interface-related functions. The configuration of CGN2 is similar to that of CGN1. For
configuration details, see the configuration files.
# Bind the traffic policy to the interface.
[*CGN1] interface gigabitEthernet 2/0/0
[*CGN1-GigabitEthernet2/0/0] ip binding vpn-instance inside_vrf
[*CGN1-GigabitEthernet2/0/0] traffic-policy NAT inbound
[*CGN1-GigabitEthernet2/0/0] quit
4. [*CGN1] commit
Configuration Files
The configurations on CGN1 and CGN2 are as follows:
# #
sysname CGN1 sysname CGN2
1. Set a
system name.
# #
license license
active nat session-table size 16 active nat session-table size 16
slot 4 engine 0 slot 4 engine 0
2. Configure active nat session-table size 16 active nat session-table size 16
licenses. slot 5 engine 0 slot 5 engine 0
active nat bandwidth-enhance active nat bandwidth-enhance
slot 4 engine 0 slot 4 engine 0
# #
# #
# #
7. Configure a
traffic
classifier. # #
traffic behavior nat1 traffic behavior nat1
nat bind instance nat1 nat bind instance nat1
8. Configure a
traffic
behavior. # #
# #
# #
# #
interface GigabitEthernet 2/0/0 interface GigabitEthernet 2/0/0
ip binding vpn-instance ip binding vpn-instance
inside_vrf inside_vrf
14. Bind the traffic-policy NAT inbound traffic-policy NAT inbound
traffic policy to
the desired
interface.
# #
Prerequisites
RADIUS Attributes
Table 1-48 RADIUS attributes
Networking Requirements
In the mobile Internet private line service, users can be classified into either high-end users or
common users. Carriers can preferentially forward traffic of high-end users and provide
differentiated acceleration services.
As shown in Figure 1-96, the networking requirements of centralized NAT deployment applied in
distributed NAT mode are as follows:
● Preferential forwarding for upstream traffic of high-end users on the intranet: High-end
user traffic is identified based on IP addresses. The packets are re-marked with DSCP
values, and the values are sent to the upstream MAN router. In this way, the
processing priority of the packets is adjusted, and the traffic is preferentially forwarded
on the intranet.
● Differentiated acceleration for intranet and extranet downstream traffic: The RADIUS
server and DAA are used to implement differentiated acceleration package policies.
The BRAS identifies intranet and extranet traffic based on the DSCP values of the
received IP packets. For example, if the DSCP value of the downstream traffic is 14,
the BRAS determines that the traffic is extranet traffic. Differentiated acceleration is
implemented for intranet downstream traffic without affecting the inter-network
downstream bandwidth.
● NAT is necessary for the coexistence of high-end users and common users due to the
scarce public IP addresses. In addition to DSCP marking and DAA differentiated
acceleration for intranet and extranet traffic, NAT is required to map private IP
addresses to public IP addresses after users go online. Common users and high-end
users share the same service domain and NAT address pool.
Figure 1-96 Networking diagram of centralized NAT deployment applied in distributed NAT mode
Configuration Roadmap
Procedure
Configure the NAT service. When an intranet user accesses an external network, the private IP
address of the user can be translated into a public IP address.
# Configure NAT licenses and bind them to boards.
When NAT is deployed on an NE8000-M series device, you only need to run the active nat
session-table size command to configure the NAT session resource license. In this case, you
do not need to run the active nat bandwidth-enhance command to configure the bandwidth
license.
<HUAWEI> system-view
[~HUAWEI] license
[~HUAWEI-license] active nat session-table size 6 slot 1 engine 0
[*HUAWEI-license] active nat session-table size 6 slot 2 engine 0
[*HUAWEI-license] active nat bandwidth-enhance 40 slot 1
[*HUAWEI-license] active nat bandwidth-enhance 40 slot 2
[*HUAWEI-license] commit
[~HUAWEI-license] quit
# Configure a NAT instance.
[~HUAWEI] service-location 1
[*HUAWEI-service-location-1] location slot 1 engine 0 backup slot 2 engine 0
[*HUAWEI-service-location-1] quit
[*HUAWEI] service-instance-group group1
[*HUAWEI-service-instance-group-group1] service-location 1
[*HUAWEI-service-instance-group-group1] commit
[~HUAWEI-service-instance-group-group1] quit
[~HUAWEI] nat instance nat1 id 1
[*HUAWEI-nat-instance-nat1] nat address-group address-group1 group-id 1
[*HUAWEI-nat-instance-nat1-nat-address-group-address-group1] section 1 11.11.11.0 mask 24
[*HUAWEI-nat-instance-nat1-nat-address-group-address-group1] quit
[*HUAWEI-nat-instance-nat1] port-range 256 extended-port-range 1024 extended-times 3
[*HUAWEI-nat-instance-nat1] service-instance-group group1
[*HUAWEI-nat-instance-nat1] commit
[~HUAWEI-nat-instance-nat1] quit
# Configure the NAT log function.
When intranet users access the external network through the NAT device, multiple users share
the same external IP address. As a result, the users accessing the external network cannot be
located. The log function can be used to trace and record the access of intranet users to external
networks in real time, enhancing network maintainability.
[~HUAWEI] nat instance nat1 id 1
[~HUAWEI-nat-instance-nat1] nat alg all
[*HUAWEI-nat-instance-nat1] nat filter mode full-cone
[*HUAWEI-nat-instance-nat1] nat log session enable
[*HUAWEI-nat-instance-nat1] nat log host 10.179.13.230 514 source 10.179.34.241 65532
[*HUAWEI-nat-instance-nat1] commit
1. [~HUAWEI-nat-instance-nat1] quit
2. [~HUAWEI-aaa]
Configure a QoS policy and configure the policy group to take effect in the upstream direction.
The QoS policy is used to preferentially forward the traffic of high-end users on the intranet.
A multi-field classification policy is configured based on the user group of high-end users. The
user group is determined based on the Filter-Id attribute delivered by the RADIUS server. And
the priority of the packets is re-marked in the QoS profile and the remark is transmitted to the
upstream router. In this manner, traffic is preferentially forwarded on the intranet. The preceding
configuration only needs to be performed for upstream (user-to-network) traffic.
# Configure an ACL rule to match packets from user group 12m_gold_user.
[~HUAWEI] user-group 12m_gold_user
[*HUAWEI] acl number 6000
[*HUAWEI-acl-ucl-6000] description for_daauser_gold_user-remark_qos
[*HUAWEI-acl-ucl-6000] rule 5 permit ip source user-group 12m_gold_user
[*HUAWEI-acl-ucl-6000] commit
[~HUAWEI-acl-ucl-6000] quit
# Configure a traffic classifier, traffic behavior, and traffic policy, and remark the DSCP value.
[~HUAWEI] traffic classifier gold_user_qos
[*HUAWEI-classifier-gold_user_qos] if-match acl 6000
[*HUAWEI-classifier-gold_user_qos] quit
[*HUAWEI] traffic behavior gold_user_qos_af22
[*HUAWEI-behavior-gold_user_qos_af22] remark dscp af22
[*HUAWEI-behavior-gold_user_qos_af22] quit
[*HUAWEI] commit
[~HUAWEI] traffic policy p1
[*HUAWEI-trafficpolicy-p1] classifier gold_user_qos behavior gold_user_qos_af22
[*HUAWEI-trafficpolicy-p1] quit
[*HUAWEI] commit
# Configure the policy group to take effect in the upstream (user-to-network) direction.
[~HUAWEI] traffic-policy p1 inbound
3. [*HUAWEI] commit
Configure DAA service to implement differentiated acceleration for intranet and extranet
downstream traffic.
# Enable the DAA service.
[~HUAWEI] value-added-service enable
4. [*HUAWEI] commit
# Configure intranet and extranet traffic policies.
Define ACL rule 6001 to control users' extranet traffic. Match the data flow whose destination
user group is 12m_gold_user and DSCP value is 14.
[~HUAWEI] acl number 6001
[*HUAWEI-acl-ucl-6001] description for_12m_gold_user-to-outside
[*HUAWEI-acl-ucl-6001] rule 5 permit ip destination user-group 12m_gold_user dscp 14
[*HUAWEI-acl-ucl-6001] quit
● [*HUAWEI] commit
Configure a traffic classifier and a traffic behavior to modify the tariff level, CAR, and statistics
collection functions of the traffic behavior.
Configure car in the traffic behavior to enable traffic policing for DAA. Then, configure
traffic-statistic to collect DAA service traffic statistics and provide the statistics to the accounting
system for accounting.
[~HUAWEI] traffic classifier 12m_gold_user_to_outside
[*HUAWEI-classifier-12m_gold_user_to_outside] if-match acl 6001
[*HUAWEI-classifier-12m_gold_user_to_outside] quit
[*HUAWEI] traffic behavior 12m_gold_user_to_outside
[*HUAWEI-behavior-12m_gold_user_to_outside] tariff-level 1
[*HUAWEI-behavior-12m_gold_user_to_outside] car
[*HUAWEI-behavior-12m_gold_user_to_outside] traffic-statistic
[*HUAWEI-behavior-12m_gold_user_to_outside] quit
● [*HUAWEI] commit
Define ACL rule 6002 to control users' intranet traffic. Match the data flow whose destination user
group is 12m_gold_user.
[~HUAWEI] acl number 6002
[*HUAWEI-acl-ucl-6002] description for_12m_gold_user-to-intranet
[*HUAWEI-acl-ucl-6002] rule 5 permit ip destination user-group 12m_gold_user
[*HUAWEI-acl-ucl-6002] quit
● [*HUAWEI] commit
Configure a traffic classifier and a traffic behavior to modify the tariff level, CAR, and statistics
collection functions of the traffic behavior.
[~HUAWEI] traffic classifier 12m_gold_user_to_intranet
[*HUAWEI-classifier-12m_gold_user_to_intranet] if-match acl 6002
[*HUAWEI-classifier-12m_gold_user_to_intranet] quit
[*HUAWEI] traffic behavior 12m_gold_user_to_intranet
[*HUAWEI-behavior-12m_gold_user_to_intranet] tariff-level 2
[*HUAWEI-behavior-12m_gold_user_to_intranet] car
[*HUAWEI-behavior-12m_gold_user_to_intranet] traffic-statistic
[*HUAWEI-behavior-12m_gold_user_to_intranet] quit
● [*HUAWEI] commit
● [*HUAWEI] commit
● [*HUAWEI] commit
# Configure QoS profiles. Generally, two or more QoS profiles need to be configured for basic
user bandwidth and DAA service acceleration bandwidth, respectively.
[~HUAWEI] qos-profile qos-prof1
[*HUAWEI-qos-profile-qos-prof1] car cir 12288 pir 12288 inbound
[*HUAWEI-qos-profile-qos-prof1] car cir 16384 pir 16384 outbound
[*HUAWEI-qos-profile-qos-prof1] quit
[*HUAWEI] qos-profile qos-prof2
[*HUAWEI-qos-profile-qos-prof2] car cir 12288 pir 12288 inbound
[*HUAWEI-qos-profile-qos-prof2] car cir 12288 pir 12288 outbound
[*HUAWEI-qos-profile-qos-prof2] commit
[~HUAWEI-qos-profile-qos-prof2] quit
# Configure DAA service policies. Associate the configured tariff levels with the QoS profiles.
[*HUAWEI] value-added-service policy 12m_gold_user_daa daa
[*HUAWEI-vas-policy-12m_gold_user_daa] accounting-scheme acc-gmcc-radius
[*HUAWEI-vas-policy-12m_gold_user_daa] user-group 12m_gold_user
[*HUAWEI-vas-policy-12m_gold_user_daa] accounting-together enable
[*HUAWEI-vas-policy-12m_gold_user_daa] tariff-level 1 qos-profile qos-prof1
[*HUAWEI-vas-policy-12m_gold_user_daa] tariff-level 2 qos-profile qos-prof2
[*HUAWEI-vas-policy-12m_gold_user_daa] commit
[~HUAWEI-vas-policy-12m_gold_user_daa] quit
# Bind DAA to a high-end user domain. In this step, you can mark a user as a DAA user. DAA
policies can be dynamically delivered only after the user is marked as a DAA user. DAA user
marking can be statically configured in a domain or dynamically delivered by the RADIUS server.
[~HUAWEI-aaa] domain 12m_gold_user
[~HUAWEI-aaa-12m_gold_user] value-added-service account-type radius radius
[*HUAWEI-aaa-12m_gold_user] value-added-service policy 12m_gold_user_daa
[*HUAWEI-aaa-12m_gold_user] commit
[~HUAWEI-aaa-12m_gold_user] quit
5. [~HUAWEI-aaa] quit
5. [*HUAWEI] commit
# Configure the NAT function for common users.
● [*HUAWEI] commit
● [~HUAWEI-aaa] quit
Configure a traffic classifier, a traffic behavior, and a NAT traffic diversion policy, and apply the
policy.
[~HUAWEI] acl 7000
[*HUAWEI-acl-ucl-7000] description For-NAT-Policy
[*HUAWEI-acl-ucl-7000] rule 5 permit ip source user-group pppoe_nat
[*HUAWEI-acl-ucl-7000] commit
[~HUAWEI-acl-ucl-7000] quit
[~HUAWEI] traffic classifier pppoe-nat operator or
[*HUAWEI-classifier-pppoe-nat] if-match acl 7000
[*HUAWEI-classifier-pppoe-nat] commit
[~HUAWEI-classifier-pppoe-nat] quit
[~HUAWEI] traffic behavior pppoe-nat
[*HUAWEI-behavior-pppoe-nat] nat bind instance nat1
[*HUAWEI-behavior-pppoe-nat] commit
[~HUAWEI-behavior-pppoe-nat] quit
[~HUAWEI] traffic policy p1
[~HUAWEI-trafficpolicy-global] classifier pppoe-nat behavior pppoe-nat
[*HUAWEI-trafficpolicy-global] commit
● [~HUAWEI-trafficpolicy-global] quit
● [~HUAWEI-nat-instance-nat1] quit
6. [~HUAWEI-GigabitEthernet0/2/0.2] quit
Configuration Files
#
radius-server group ip-radius
radius-server shared-key-cipher %^%#`E)v.Q@BHVzxxZ;ij{>&_M0!TGP7YRA@8a7mq<\/%^%#
radius-server authentication 172.16.45.220 1812 weight 0
radius-server accounting 172.16.45.220 1813 weight 0
radius-server retransmit 5 timeout 20
radius-server class-as-car
radius-server traffic-unit kbyte
radius-server algorithm loading-share
#
radius-server authorization 221.179.9.19 shared-key-cipher
%^%#LwVJ>q<d1($K:\VbOw.76&vZ7/Eim"q[jZ#;&`K-%^%# server-group ip-radius
#
service-location 1
location slot 1 engine 0 backup slot 2 engine 0
#
service-instance-group group1
service-location 1
#
nat instance nat1 id 1
port-range 256 extended-port-range 1024 extended-times 3
service-instance-group group1
nat address-group address-group1 group-id 1
section 1 11.11.11.0 mask 24
nat outbound 2000 address-group address-group1
nat log host 10.179.13.230 514 source 10.179.34.241 65532
nat alg all
nat filter mode full-cone
nat log session enable
#
ip pool pool1 bas local
gateway 172.16.0.1 255.255.0.0
section 0 172.16.0.2 172.16.255.254
dns-server 10.179.155.161 10.179.155.177
#
web-auth-server 192.168.10.2 port 50100 key cipher huawei
#
value-added-service enable
#
qos-profile qos-prof1
car cir 12288 pir 12288 cbs 2297856 pbs 2297856 green pass yellow pass red discard inbound
car cir 16384 pir 16384 cbs 3063808 pbs 3063808 green pass yellow pass red discard outbound
qos-profile qos-prof2
car cir 12288 pir 12288 cbs 2297856 pbs 2297856 green pass yellow pass red discard inbound
car cir 12288 pir 12288 cbs 2297856 pbs 2297856 green pass yellow pass red discard outbound
#
user-group 12m_gold_user
user-group pppoe_nat
#
aaa
authentication-scheme auth-gmcc-radius
#
accounting-scheme acc-gmcc-radius
accounting interim interval 15
accounting start-fail online
#
domain user
authentication-scheme auth-gmcc-radius
accounting-scheme acc-gmcc-radius
radius-server group ip-radius
ip-pool pool1
accounting-service-policy inbound disable
user-group pppoe_nat
qos rate-limit-mode car outbound
#
domain 12m_gold_user
authentication-scheme auth-gmcc-radius
accounting-scheme acc-gmcc-radius
radius-server group ip-radius
value-added-service account-type radius radius
value-added-service policy 12m_gold_user_daa
ip-pool pool1
user-group 12m_gold_user bind nat instance nat1
#
#
license
active nat session-table size 6 slot 1 engine 0
active nat session-table size 6 slot 2 engine 0
active nat bandwidth-enhance 40 slot 1
active nat bandwidth-enhance 40 slot 2
#
value-added-service policy 12m_gold_user_daa daa
accounting-scheme acc-gmcc-radius
user-group 12m_gold_user
accounting-together enable
tariff-level 1 qos-profile qos-prof2
tariff-level 2 qos-profile qos-prof1
#
acl number 2000
description For-PPPOE-NAT-CustomerIP
rule 5 permit source 172.16.0.0 0.0.255.255
#
acl number 6000
description for_daauser_gold_user-remark_qos
rule 5 permit ip source user-group 12m_gold_user
#
acl number 6001
description for_12m_gold_user-to-outside
rule 5 permit ip destination user-group 12m_gold_user dscp 14
#
acl number 6002
description for_12m_gold_user-to-intranet
rule 5 permit ip destination user-group 12m_gold_user
#
acl number 7000
description For-PPPOE-NAT-Policy
rule 5 permit ip source user-group pppoe_nat
#
traffic classifier gold_user_qos operator or
if-match acl 6000
#
traffic classifier pppoe-nat operator or
if-match acl 7000
#
traffic classifier 12m_gold_user_to_outside operator or
if-match acl 6001
#
traffic classifier 12m_gold_user_to_intranet operator or
if-match acl 6002
#
traffic behavior gold_user_qos_af22 operator or
remark dscp 20
nat bind instance nat1
#
traffic behavior 12m_gold_user_to_outside operator or
tariff-level 1
car
traffic-statistic
nat bind instance nat1
#
traffic behavior 12m_gold_user_to_intranet operator or
tariff-level 2
car
traffic-statistic
nat bind instance nat1
#
traffic behavior pppoe-nat operator or
nat bind instance nat1
#
traffic policy daa
share-mode
classifier 12m_gold_user_to_outside behavior 12m_gold_user_to_outside
classifier 12m_gold_user_to_intranet behavior 12m_gold_user_to_intranet
#
traffic policy p1
classifier gold_user_qos behavior gold_user_qos_af22
classifier pppoe-nat behavior pppoe-nat
#
traffic-policy p1 inbound
#
accounting-service-policy daa
#
interface Virtual-Template1
ppp authentication-mode auto
#
interface GigabitEthernet0/2/0.1
user-vlan 1
pppoe-server bind Virtual-Template 1
bas
access-type layer2-subscriber default-domain authentication user
authentication-method ppp
#
interface GigabitEthernet0/2/0.2
user-vlan 2
pppoe-server bind Virtual-Template 1
bas
access-type layer2-subscriber default-domain authentication 12m_gold_user
authentication-method ppp
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
#
radius-server source interface LoopBack0
#
return