In my last post Configuring Static NAT on Cisco Routers we saw how you can translate 1 IP address into another single IP address. This tutorial will cover how to translate many IP addresses into many IP addresses, otherwise referred to as many-to-many translation.
Dynamic NAT allows us to translate many IP addresses into a pool of many IP addresses. The big thing to realize here is that the pool does not need to contain enough IP addresses to translate all the internal addresses at the same time, as would be the case if we used Static NAT. Dynamic NAT allows internal hosts to be translated into an IP address in the pool when it requires a connection. Once the internal host has finished it’s session the NAT entry is removed from the NAT table allowing another internal host to use the external IP address for it’s session.
Assume we have 50 hosts in our inside network but only have 5 public IP addresses available to use. With Dynamic NAT we can allow all 50 internal addresses to share the 5 public addresses as and when they need them. This of course does impose a limit of only 5 simultaneous connections to the outside world and that is where PAT would come in and solve that problem.
On of the benefits of using Dynamic NAT vs Static NAT, is that Dynamic NAT requires the session to originate from the inside network. No outside connections can be established to the inside network. This is obviously a more secure solution as connections from the outside won’t work; only traffic originating from the inside will be translated. Static NAT is different in the fact that the entry is added to the NAT table on a permanent basis and will allow connections in either direction.
Here are the steps to configure Dynamic NAT on a Cisco Router.
Step 1 : I need to define the IP address range that will be translated (my inside IP addresses). I can do this with a standard access-list
AOIP.ORG (config)# access-list 1 permit 10.0.1.0 0.0.0.255
(don’t forget, access-lists use wildcard masks, not subnet masks)
Step 2 : I need to configure the range of addresses that my internal network will be translated into by using a NAT pool.
AOIP.ORG (config) # ip nat pool MY_POOL 10.50.1.1 10.50.1.5 netmask 255.255.255.0
(There are 5 IP addresses that can be used for translation in this example)
Step3 : Define inside and outside interfaces
AOIP.ORG (config) # interface FastEthernet 0/0
AOIP.ORG (config-if) # ip nat inside
AOIP.ORG (config-if) # interface Serial 0
AOIP.ORG (config-if) # ip nat outside
Step 4 : Configure the translation to take place.
AOIP.ORG (config) # ip nat inside source list 1 pool MY_POOL
(List 1 is my access-list that defined my inside IP addresses, MY_POOL defined the IP addresses to be used for the translation)