With dynamic NAT, you specify two sets of addresses on your Cisco router:
1. inside addresses that will be translated.
2. a pool of global addresses.
Unlike with static NAT, where you had to manually define a static mapping between a private and a public address, with dynamic NAT the mapping of a local address to a global address happens dynamically. This means that the router dynamically picks an address from the global address pool that is not currently assigned. It can be any address from the pool of global addresses. The dynamic entry stays in the NAT translations table as long as the traffic is exchanged. The entry times out after a period of inactivity and the global IP address can be used for new translations.
To configure dynamic NAT, the following steps are required:
1. configure the router’s inside interface using the ip nat inside command
2. configure the router’s outside interface using the ip nat outside command
3. configure an ACL that has a list of the inside source addresses that will be translated
4. configure the pool of global IP addresses using the ip nat pool NAME FIRST_IP_ADDRESS LAST_IP_ADDRESS netmask SUBNET_MASK command
5. enable dynamic NAT with the ip nat inside source list ACL_NUMBER pool NAME global configuration command
Here is an example.
Computer A requests a web resource from S1. Computer A uses its private IP address when sending the request to router R1. Router R1 receives the request, changes the private IP address to one of the available global addresses in the pool and sends the request to S1. S1 responds to R1. R1 receives the response, looks up in its NAT table and changes the destination IP address to the private IP address of Computer A.
In the example above we need to configure dynamic NAT. To do that, the following commands are required on R1:
1. To configure the router’s inside interface:
2. To configure the router’s outside interface:
3. To configure an ACL that has a list of the inside source addresses that will be translated:
4. To configure the pool of global IP addresses:
The pool configured above consists of 5 addresses: 184.108.40.206, 220.127.116.11, 18.104.22.168, 22.214.171.124, and 126.96.36.199.
5. To enable dynamic NAT:
The command above instructs the router to translate all addresses specified in the access list 1 to the pool of global addresses called MY_POOL.
You can list all NAT translations using the show ip nat translations command:
In the example above, you can see that the private IP address of Computer A (192.168.0.2) has been translated to the first available global address (188.8.131.52).