The documentation set for this product strives to use bias-free language. For the purposes of this documentation set, bias-free is defined as language that does not imply discrimination based on age, disability, gender, racial identity, ethnic identity, sexual orientation, socioeconomic status, and intersectionality. Exceptions may be present in the documentation due to language that is hardcoded in the user interfaces of the product software, language used based on RFP documentation, or language that is used by a referenced third-party product. Learn more about how Cisco is using Inclusive Language.
This document describes how to understand and configure Network Address Translation (NAT).
Cisco recommends that you have knowledge of these topics:
This document is not restricted to specific software and hardware versions.
The information in this document was created from the devices in a specific lab environment. All of the devices used in this document started with a cleared (default) configuration. If your network is live, ensure that you understand the potential impact of any command.
NAT64 is a mechanism for IPv4-to-IPv6 transition and IPv4-IPv6 coexistence. Together with DNS64, the primary purpose of NAT64 is to allow an IPv6-only client to initiate communications to an IPv4-only server. NAT64 can also be used for IPv4-only clients initiating communications with IPv6-only servers using static or manual bindings. Both scenarios are explained in this document.
Since IPv6 is not backward compatible with IPv4, you are left with the necessity of transition mechanisms, which fall into one of three classes:
#Like other transition methods, translation is not a long-term strategy and the ultimate goal can be native IPv6. However translation offers two major advantages over tunneling:
In stateless NAT64, state is not preserved which means for every IPv6 user a dedicated IPv4 address is required. As we are in IPv4 depletion phase, it is very difficult to adopt this mode of NAT64. The only advantage of using stateless NAT64 when you have few numbers of IPv6 addresses (NAT46).
In stateful NAT64, states are maintained. A single IP Address is used for all the private users with different port numbers. In the previous diagram, a single IPv4 address is used with different port numbers for all the users of IPv6 which are in that LAN to access a public IPv4 server.
Here are more details about the difference between Stateful and Stateless NAT64 translation:
Stateless NAT64 |
Stateful NAT64 |
1:1 translation |
1:N translation |
No conservation of IPv4 address |
Conserves IPv4 address |
Assures end-to-end address transparency and scalability |
Uses address overloading, hence lacks in end-to-end address transparency |
No state or bindings created on the translation |
State or bindings are created on every unique translation |
Requires IPv4-translatable IPv6 addresses assignment (mandatory requirement) |
No requirement on the nature of IPv6 address assignment |
Requires either manual or DHCPv6 based address assignment for IPv6 hosts |
Free to choose any mode of IPv6 address assignment viz. Manual, DHCPv6, SLAAC |
There are three main components to NAT64.
1. Suppose, in the previous picture, host present in IPv6 network wants to communicate to web server www.example.com (10.1.113.2) which is IPv4 only server.
2. To make this communication possible, you must have DNS64 server installed in IPv6 network which can understand and resolve DNS for ipv4 requests.
3. The DNS64 server functions as a normal DNS server for IPv6 AAAA records, but can also attempt to locate an IPv4 A record when a AAAA record is not available. If an A record is located, DNS64 converts the IPv4 A record into an IPv6 AAAA record using the NAT64 prefix. This gives the impression to the IPv6-only host that it can communicate with a server using IPv6.
4. Now DNS resolution request for www.example.com is sent to DNS64 server. It first looks up in its IPv6 AAAA record table but it does not find any IPv6 AAAA record because this website server belongs to Ipv4 address. After that, it looks in its IPv4 database and it finds IPv4 address matched to this website. Now DNS64 server can convert this IPv4 address into IPv6 address by converting this IPv4 address into hex and prepending NAT64 prefix to it. By doing so, this can give impression to IPv6 only host that it can communicate with web server using IPv6.
5. The packets gets routed in the IPv6 only network towards device doing NAT64 with the help of NAT64 prefix that was prepended to hex value of IPv4 address.
6. The NAT64 router advertises the NAT64 prefix into the IPv6-only network along with performing the translation between the IPv6-only and IPv4-only networks.
7. Once packet hits device doing NAT64 translation, the packets can be matched against ACL that you have configured for Nat64. If packets match this ACL, then packet can be translated using NAT64 further. If packet does not match configured ACL, then it can be routed using normal IPv6 routing towards its destination.
8. Stateful NAT64 utilizes configured access control lists (ACLs) and prefix lists to filter IPv6-initiated traffic flows that are allowed to create the NAT64 state. Filtering of IPv6 packets is done in the IPv6-to-IPv4 direction because dynamic allocation of mapping between an IPv6 host and an IPv4 address can be done only in this direction. Stateful NAT64 supports endpoint-dependent filtering for the IPv4-to-IPv6 packet flow with PAT configuration.
9. In a Stateful NAT64 PAT configuration, the packet flow must have originated from the IPv6 realm and created the state information in NAT64 state tables. Packets from the IPv4 side that do not have a previously created state are dropped. Endpoint-independent filtering is supported with static Network Address Translation (NAT) and non-PAT configurations.
The first IPv6 packet is routed to the NAT Virtual Interface (NVI) based on the automatic routing setup that is configured for the stateful prefix. Stateful NAT64 performs a series of lookups to determine whether the IPv6 packet matches any of the configured mappings based on an access control list (ACL) lookup. Based on the mapping, an IPv4 address (and port) is associated with the IPv6 destination address.
The IPv6 packet is translated and the IPv4 packet is formed by using these methods:
10. A new NAT64 translation is created in the session database and in the bind database. The pool and port databases are updated depending on the configuration.
11.The return traffic and the subsequent traffic of the IPv6 packet flow can use this session database entry for translation.
Step 1. Host A is an IPv6-only host that wants to communicate with the server www.example.com. This triggers a DNS query (AAAA: www.example.com) to the DNS64 server. The DNS64 is a key component to this process. A DNS64 server is both a DNS server for IPv6 and IPv4. It creates the illusion for the client that IPv4 servers can be reached using an IPv6 address.
Host A sends a DNS query (AAAA: www.example.com) to the DNS64 server. As far as host A is concerned, this is a normal DNS AAAA query for an IPv6 server.
Step 2. The DNS64 server receives the DNS AAAA query from host A. In an attempt to resolve the domain name, the DNS64 server sends a query to the DNS AAAA authoritative server for www.example.com.
Step 3. The IPv6 DNS AAAA authoritative server returns a response indicating that it does not have a AAAA resource record for www.example.com.
Step 4. On receiving an empty answer (name error) response to the AAAA query, this triggers the DNS64 server to send an A query (A: www.example.com) to the IPv4 DNS A authoritative server.
Step 5. The IPv4 DNS A authoritative server does have an A resource record for www.example.com and returns a response with the IPv4 address for the server (A: www.example.com 10.1.113.2).
Step 6. The DNS64 server receives the IPv4 address from the DNS A authoritative server and synthesizes a AAAA record by prefixing the address with its NAT64 prefix, 2800:1503:2000:1:1::/96, and converts the IPv4 address to hexadecimal, 0a01:7102.This address can be used by host A as the destination IPv6 address for reaching the www.example.com server.
Step 7. The synthesized AAAA record is completely transparent to host A. To host A, it appears as if www.example.com is reachable over the IPv6 network and Internet. Host A now has the addressing information necessary to transmit IPv6 packets to www.example.com with these:
Step 8. The NAT64 router receives the IPv6 packet sent by host A on its NAT64-enabled interface .It matches the incoming packets to configured ACL. If match is not found then the packet is forwarded untranslated using normal IPv6 routing. If match is found then the packet undergoes this translation:
Step 9. After the NAT64 translation, the translated IPv4 packet is forwarded using the normal IPv4 route lookup process. In this scenario, the IPv4 destination address 10.1.113.2 is used to forward the packet.
Step 10. The www.example.com server at 10.1.113.2 replies, which is ultimately received by the NAT64 router.
Step 11. The NAT64 router receives the IPv4 packet from the www.example.com server on one of its NAT64-enabled interfaces. The router examines the IPv4 packet to determine whether a NAT64 translation state exists for the IPv4 destination address. If a translation state does not exist, the packet is discarded. If a translation state does exist for the IPv4 destination address, the NAT64 router performs these tasks:
Step 12. After the translation, the IPv6 packet is forwarded using the normal IPv6 route lookup process.
1. IPv6 facing interface:
2. IPv4 facing interface:
3. Create ACL matching ipv6 traffic.
4. Enable NAT64 IPv6-to-IPv4 address mapping:
#nat64 prefix stateful 2800:1503:2000:1:1::/96 ---------------> Server IP can get mapped to this ipv6 ip address. You can configure any ipv6 network address here but this ipv6 network address can be reachable from your ipv6 network. Also, DNS64 server must have mapping of this ipv6 network address to server ipv4 address.
#ping 2800:1503:2000:1:1::0a01:7102
#show nat64 translation
#show nat64 statistics
Step 1. The first step is to configure IPv6-to-IPv4 static mapping on NAT46 router to provide access to the IPv6 server 2001:DB8:3001::9/64 from the IPv4 address 10.1.113.2. Also, the IPv4 address 10.50.50.50 needs to be registered as a DNS resource record for www.examplev6.com on the DNS server. The static NAT64 mapping is created using this command:
NAT64-Router(config)# nat64 v6v4 static 2001:DB8:3001::9 10.50.50.50
Step 2. PC A is an IPv4-only host that wants to communicate with the server www.examplev6.com . This triggers a DNS query (A: www.examplev6.com) to its IPv4 DNS authoritative server.
Step 3. The DNS server responds with an A resource record for www.examplev6.com, 10.50.50.50.
Step 4. Host A now has the addressing information necessary to transmit IPv4 packets to www.examplev6.com with
Step 5. The NAT64 router receives the IPv4 packet on its NAT64-enabled interface and performs these tasks:
Step 6. After the translation, the IPv6 packet is routed using the normal IPv6 routing process. The packet is ultimately routed to the www.examplev6.com server at 2001:DB8:3001::9 .
Step 7. The server www.examplev6.com replies with a packet destined for host A.
Step 8. The NAT64 router receives the IPv6 packet sent by the IPv6 server on its NAT64-enabled interface and performs these tasks:
Step 9. After the translation, the NAT64 router forwards the packet to 10.1.113.2 using the normal IPv4 routing process.
After the configuration is successful, ping 10.50.50.50 from IPv4 host.
#ping 10.50.50.50
Verifying NAT46
#show nat64 translations
#show nat46 statistics
Scenarios for IPv6/IPv4 Translation |
Applicability |
Example |
Scenario 1: An IPv6 network to the IPv4 Internet |
• IPv6-only network wanting to transparently access both IPv6 and existing IPv4 content. • Initiated from IPv6 hosts and network. |
• ISPs rolling out new services and networks for IPv6-only smartphones (third-generation [3G], Long-Term Evolution [LTE], and so on) handsets. • Enterprises deploying IPv6-only network. |
Scenario 2: The IPv4 Internet to an IPv6 network |
• Servers in IPv6-only network wanting to transparently serve both IPv4 and IPv6 users. • Initiated from IPv4 hosts and network. |
Upcoming or existing content providers rolling out services in IPv6-only environment. |
Scenario 3: The IPv6 Internet to an IPv4 network |
• Servers in existing IPv4-only network wanting to serve IPV6 Internet users. • Initiated from IPv6 hosts and network. |
Existing content providers migrating to IPv6 and thus wanting to offer services to IPv6 Internet users as part of coexistence strategy. |
Scenario 4: An IPv4 network to the IPv6 Internet |
Not a viable case in the near future; this scenario can probably occur only some time after the early stage of the IPv6/IPv4 transition. |
None |
Scenario 5: An IPv6 network to an IPv4 network |
Both an IPv4 network and an IPv6 network are within the same organization. |
Similar to scenario 1, catering to Intranet instead of Internet. |
Scenario 6: An IPv4 network to an IPv6 network |
Both an IPv4 network and an IPv6 network are within the same organization. |
Similar to scenario 2, catering to intranet instead of Internet. |
Scenario 7: The IPv6 Internet to the IPv4 Internet |
Would suffer from poor throughput. |
None |
Scenario 8: The IPv4 Internet to the IPv6 Internet |
No viable translation technique to handle unlimited IPv6 address translation. |
None |
#show platform hardware qfp active statistics drop (to see if there are any NAT64 drops)
#show running-config | include nat64 (to see if everything is configures on Cisco IOS®)
#show platform hardware qfp active feature nat64 datapath statistics (to check the reason for drop counter)
#show platform hardware qfp active feature nat64 datapath pool (to check the pool is configured properly)
#show platform hardware qfp active feature nat64 datapath map (to check and see pool to mapping config is done properly)
#show platform software object-manager F0 pending-ack-update (to check if there are any pending objects)
Revision | Publish Date | Comments |
---|---|---|
2.0 |
02-Nov-2023 |
Removed PII.
Added Alt Text.
Updated Title, Introduction, Branding, Article Description, Style Requirements, Machine Translation and Formatting. |
1.0 |
23-Jun-2021 |
Initial Release |