Firewall NAT Technologies · Topic 3 of 3

NAT ALG and NAT Server

Learn NAT ALG, ASPF and server map entries for FTP and other multi-channel protocols, and how to publish servers with nat server on USG firewalls.

  • 6 min
  • Includes a diagram
In a nutshell
  • Multi-channel protocols such as FTP, SIP, H.323 and RTSP carry addresses and ports in the payload.
  • ASPF learns the data channel and creates a temporary server map entry; NAT ALG rewrites addresses in the payload.
  • Both are enabled with detect, for example firewall detect ftp or detect ftp in an interzone view.

What it is

NAT ALG (Application Level Gateway) translates IP addresses and ports that a protocol carries inside the payload, not just in the IP header. Without it, protocols such as FTP break as soon as NAT is applied.

NAT Server publishes an inside server on a public address and port. It is the main form of destination NAT on a USG firewall and creates server map entries that the firewall uses to translate incoming traffic.

Control channelFTP port 21ASPFreads PORT commandNAT ALGrewrites payloadServer mapdata channel entryData channel allowed

How it works

Multi-channel protocols

A single-channel protocol, such as HTTP, uses one connection. A multi-channel protocol opens a control channel and then negotiates a second, data channel whose address and port are written in the control messages.

ProtocolHow the data channel is negotiated
FTP active modeThe client sends a PORT command with its address and port; the server connects back from port 20
FTP passive modeThe server answers PASV with its address and port; the client connects to it
SIP, H.323, RTSPSignaling messages carry the media addresses and ports

Two problems follow. The security policy has no rule for the dynamic data channel, and after NAT the address in the payload is the private one, which the outside peer cannot reach.

ASPF and NAT ALG

ASPF (Application Specific Packet Filter) inspects the application layer of the control channel. It learns the negotiated data channel and creates a temporary server map entry, so the data connection is allowed without opening a wide rule.

NAT ALG works with ASPF. When NAT is applied, it replaces the private address and port in the payload with the translated public ones, so the peer connects to an address that works.

Both are enabled per protocol with the detect command, globally or between two zones:

firewall detect ftp
#
firewall interzone trust untrust
 detect ftp

The server map

The server map is a table of mappings, separate from the session table. When a first packet matches no session, the firewall checks the server map, translates if needed, and creates a session.

Server map typeCreated byPurpose
ASPFASPF learning a data channelLets the negotiated data connection through; ages out quickly
NAT Server and its reverse entrynat server configurationStatic translation of the published address; stays while configured
No-PATNAT No-PAT translationsFixed private to public mapping in both directions
FullConeTriplet NAT translationsLets outside hosts reach the mapped address and port

A server map entry is not a session. Use display firewall server-map for the mappings and display firewall session table for live connections.

Configuring NAT Server

NAT Server: an internet client in the Untrust zone connects to public address 202.1.1.5 port 80; the firewall's nat server web mapping changes the destination to the DMZ web server at 10.2.0.7 port 8080.

nat server web protocol tcp global 202.1.1.5 www inside 10.2.0.7 8080
nat server mail global 202.1.1.6 inside 10.2.0.8

The first line maps TCP port 80 (www) on 202.1.1.5 to port 8080 on 10.2.0.7, a port based mapping. The second maps every port of 202.1.1.6 to 10.2.0.8, an address based mapping that publishes the whole server.

NAT Server creates two static server map entries. The forward entry translates incoming traffic from the public to the private address. The reverse entry lets the server start connections to the internet with the public address as its source. The no-reverse keyword creates only the forward entry.

A security policy from Untrust to DMZ must still permit the traffic, using the private server address, and the public address should have a blackhole route to prevent loops.

Internet clientto 202.1.1.5 port 80Server mapNAT Server entrySecurity policyto 10.2.0.7DMZ serverport 8080

A worked example

Users in the Trust zone use Easy IP to reach an FTP server on the internet in active mode. The data connection fails: the client logs in, but directory listings never arrive.

The PORT command still carries the private client address, and no rule permits the server's data connection. After firewall detect ftp, NAT ALG rewrites the PORT command with the public address, ASPF creates a server map entry for the data channel, and the listing works.

How the exam asks about this

  • "Which feature translates addresses carried in the FTP payload?" -> NAT ALG.
  • "Which table holds the entry that lets the negotiated FTP data channel through?" -> The server map, with an ASPF entry.
  • "What does the reverse server map entry created by NAT Server allow?" -> The inside server can start outbound connections using its public address.

What to remember for the exam

  • Multi-channel protocols such as FTP, SIP, H.323 and RTSP carry addresses and ports in the payload.
  • ASPF learns the data channel and creates a temporary server map entry; NAT ALG rewrites addresses in the payload.
  • Both are enabled with detect, for example firewall detect ftp or detect ftp in an interzone view.
  • nat server creates static forward and reverse server map entries; no-reverse keeps only the forward one.
  • The security policy for a published server uses the private server address, and the public address needs a blackhole route.
Watch out

Configuring NAT Server does not permit any traffic. Without a security policy from Untrust to the server's zone, the default deny policy still drops every request.

Common mistakes

Confusing the server map with the session table. The server map holds mappings that let a first packet be translated or admitted; the session table holds the live connections that result.

Blaming the NAT policy when FTP lists fail. Login works because the control channel is fine. The data channel fails until ASPF and NAT ALG handle the payload.

Expecting no-reverse to keep outbound access. Without the reverse entry, the server's own outbound connections are not translated by the NAT Server mapping.

Check yourself

  • Why does FTP need NAT ALG when NAT is used?

    FTP sends the data channel address and port inside the control messages, so they must be translated in the payload too.

  • What two server map entries does nat server create?

    A forward entry for incoming traffic to the public address and a reverse entry for connections the server starts outward.

  • Which command shows the server map entries?

    display firewall server-map, which lists ASPF, NAT Server and other mapping entries.

Topic 3 of 3 in Firewall NAT Technologies

Test yourself on Firewall NAT Technologies

The full Huawei HCIA-Security H12-711 question bank has 600 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Huawei. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.