IPv6 Network Address Translation

IPv6 Network Address Translation

NAT66, NAT64, and DNS64 are now supported for IPv6. These options provide IPv6 NAT and DNS capabilities withIPv6-IPv4 tunnelling or dual stack configurations. The commands are available only in the CLI.

Fortinet supports all features described in RFC 6146. However, for DNS64 there is no support for handling Domain Name System Security Extensions (DNSSEC). DNSSEC is for securing types of information that are provided by the DNS as used on an IP network or networks. You can find more information about DNS64 in RFC 6147.


NAT64 and DNS64 (DNS proxy)

NAT64 is used to translate IPv6 addresses to IPv4 addresses so that a client on an IPv6 network can communicate transparently with a server on an IPv4 network.

NAT64 is usually implemented in combination with the DNS proxy called DNS64. DNS64 synthesizes AAAA records from A records and is used to synthesize IPv6 addresses for hosts that only have IPv4 addresses. ‘DNS proxy’ and ‘DNS64’ are interchangeable terms.


Example NAT64 configuration

With a NAT64 and DNS64 configuration in place on a FortiGate unit, clients on an IPv6 network can transparently connect to addresses on an IPv4 network. NAT64 and DNS64 perform the IPv4 to IPv6 transition, allowing clients that have already switched to IPv6 addresses to continue communicating with servers that still use IPv4 addresses.


To enable NAT64 and DNS64, use the following CLI commands:

Enable NAT64

config system nat64 set status enable


Enable the DNS proxy on the IPv6 interface

config system dns-server edit internal



In your DHCP6 configuration, configure the IPv6 interface IP address as the DNS6 server IP address. The FortiGate will proxy DNS requests to the system DNS server.


config system dhcp6 server edit 1

set interface internal config ip-range

edit 1

set start-ip 2001:db8:1::11 set end-ip 2001:db8:1::20


set dns-server1 2001:db8:1::10 end


NAT64 policies

You can configure security policies for NAT64 using the web-based manager. For these options to appear, the feature must be enabled using System > Feature Select. You can then configure the policies under Polic& Objects > NAT64 Policy.

NAT64 policies and can also be configured from the CLI using the following command:

config firewall policy64


In the following section, you will configure a NAT64 policy that allows connections from an internal IPv6 network to an external IPv4 network.


Configuring NAT64 to allow a host on the IPv6 network to connect to the Internet server


In this example, the Internal IPv6 network address is 2001:db8:1::/48 and the external IPv4 network address is NAT64 is configured to allow a user on the internal network to connect to the server at IPv4 address In this configuration, sessions exiting the wan1 interface must have their source address changed to an IPv4 address in the range to


Enter the following command to enable NAT64:

config system nat64 set status enable



Enabling NAT64 with the config system nat64 command means that all IPv6 traffic received by the current VDOM can be subject to NAT64 if the source and destination address matches an NAT64 security policy.

By default, the setting always-synthesize-aaaa-record is enabled. If you disable this setting, the DNS proxy (DNS64) will attempt to find an AAAA records for queries to domain names and therefore resolve the host names to IPv6 addresses. If the DNS proxy cannot find an AAAA record, it synthesizes one by adding the NAT64 prefix to the A record.

By using the nat64-prefix option of the config system nat64 command to change the default nat64 prefix from the well-known prefix of 64:ff9b::/96 and setting always-synthesize-aaaa-record to enable (default), the DNS proxy does not check for AAAA records but rather synthesizes AAAA records.

As an alternative to the above entry, there is the optional configuration that would allow the resolution of CNAME queries.

config system nat64 set status enable

set nat64-prefix 64:ff9b::/96

set always-synthesize-aaaa-record enable end

Enter the following command to add an IPv6 firewall address for the internal network:


config firewall address6 edit internal-net6

set ip6 2001:db8:1::/48 end

Enter the following command to add an IPv4 firewall address for the external network:


config firewall address edit external-net4

set subnet

set associated-interface wan1 end

Enter the following command to add an IP pool containing the IPv4 address that the should become the source address of the packets exiting the wan1 interface:


config firewall ippool edit exit-pool4

set startip set endip



Enter the following command to add a NAT64 policy that allows connections from the internal IPv6 network to the external IPv4 network:


config firewall policy64 edit 0

set srcintf internal

set srcaddr internal-net6 set dstintf wan1

set dstaddr external-net4 set action accept

set schedule always set service ANY

set logtraffic enable set ippool enable

set poolname exit-pool4 end


The srcaddr can be any IPv6 firewall address and the dstaddr can be any IPv4 firewall address.


Other NAT64 policy options include fixedport, which can be used to prevent NAT64 from changing the destination port. You can also configure traffic shaping for NAT64 policies.


How a host on the internal IPv6 network communicates with example.server.com that only has IPv4 address on the Internet


1. The host on the internal network does a DNS lookup for example.server.com by sending a DNS query for an AAAA record for example.server.com.

2. The DNS query is intercepted by the FortiGate DNS proxy.

3. The DNS proxy attempts to resolve the query with a DNS server on the Internet and discovers that there are no AAAA records for example.server.com.

4. The previous step is skipped if always-synthesize-aaaa-record is enabled.

5. The DNS proxy performs an A-record query for example.server.com and gets back an RRSet containing a single A record with the IPv4 address

6. The DNS proxy then synthesizes an AAAA record. The IPv6 address in the AAAA record begins with the configured NAT64 prefix in the upper 96 bits and the received IPv4 address in the lower 32 bits. By default, the resulting IPv6 address is 64:ff9b::

7. The host on the internal network receives the synthetic AAAA record and sends a packet to the destination address 64:ff9b::

8. The packet is routed to the FortiGate internal interface where it is accepted by the NAT64 security policy.

9. The FortiGate unit translates the destination address of the packets from IPv6 address 64:ff9b:: to IPv4 address and translates the source address of the packets to (or another address in the IP pool range) and forwards the packets out the wan1 interface to the Internet.


Having trouble configuring your Fortinet hardware or have some questions you need answered? Check Out The Fortinet Guru Youtube Channel! Want someone else to deal with it for you? Get some consulting from Fortinet GURU!

This entry was posted in FortiOS 5.4 Handbook and tagged on by .

About Mike

Michael Pruett, CISSP has a wide range of cyber-security and network engineering expertise. The plethora of vendors that resell hardware but have zero engineering knowledge resulting in the wrong hardware or configuration being deployed is a major pet peeve of Michael's. This site was started in an effort to spread information while providing the option of quality consulting services at a much lower price than Fortinet Professional Services. Owns PacketLlama.Com (Fortinet Hardware Sales) and Office Of The CISO, LLC (Cybersecurity consulting firm).

2 thoughts on “IPv6 Network Address Translation

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.