The NAT64 application level gateway (ALG) provides transparent translation for some application layer protocols in NAT64.
Packets of some protocols such as ICMP and FTP carry IP addresses or port numbers in their payload. After NAT is performed, the IP address and port number in the TCP/UDP header are different from those in the payload, causing communication errors. For example, an FTP server using an internal IP address may be required to send its IP address to an external network host when communicating with the external network host. The internal IP address is encapsulated in the Data field of IP packets, which cannot be translated by NAT64. The external network host then uses the internal IP address carried in the IP packet payload and finds that the FTP server is unreachable.
A good way to solve the NAT64 issue for these special protocols is to use the Application Level Gateway (ALG) function. As a special conversion agent for application protocols, the NAT64 ALG interacts with the NAT device to establish states. It uses NAT state information to change the specific data in the Data field of IP packets and complete other necessary work, so that application protocols can run across internal and external networks.
For example, when an error occurs in packet A which is sent from a host on a private network to a public network, an ICMP unreachable packet is returned. The ICMP packet carries the header of the error packet A. Because the address is translated by a NAT64 device before packet A is sent, the source address is not the actual address of the host. If ICMP ALG is enabled, the ALG interacts with the NAT64 device before the ICMP packet is forwarded. The ALG translates the address in the Data field of packet A to the actual address of the host and completes other necessary work, so the NAT64 device can send the ICMP packet to the host.
NAT64 supports ALG for ICMP, FTP, HTTP, and UDP-based DNS.
NAT64 ALG translates the IP/ICMP packet header, and IP address and port number in the ICMP payload.
The response contains the Location header field. The Location header field is used to complete the request or identify a new resource so that receivers can redirect to the URL specified by the Location header field but not the requested URL. If the URL in the Location header field contains the IPv4 address, the NAT64 device needs to convert IPv4 addresses into IPv6 addresses.
If a network has only the DNS4 server deployed, NAT64 ALG is required to obtain IPv4 addresses. Figure 1 shows the networking and data traffic paths.