Step by Step Configuration
With dynamic NAT, you must manually define two sets of addresses on your address translation device. One set defines which inside addresses are allowed to be translated (the local addresses), and the other defines what these addresses are to be translated to (the global addresses).
In this example our internal network is using 192.168.0.0 network. We have five public ip address 50.0.0.1 to 50.0.0.5 to use. Router1(1841 Router0) is going to be NAT device. Double click on Router1(1841 Router0) and configure it as given below
Router>enable Router#configure terminal Router(config)#hostname R1 R1(config)#interface fastethernet 0/0 R1(config-if)#ip address 192.168.0.1 255.0.0.0 R1(config-if)#no shutdown R1(config-if)#exit R1(config)#interface serial 0/0/0 R1(config-if)#ip address 30.0.0.1 255.0.0.0 R1(config-if)#clock rate 64000 R1(config-if)#bandwidth 64 R1(config-if)#no shutdown R1(config-if)#exit R1(config)#ip route 0.0.0.0 0.0.0.0 serial 0/0/0 R1(config)#access-list 1 permit 192.168.0.0 0.0.0.255 R1(config)#ip nat pool test 50.0.0.1 50.0.0.5 netmask 255.0.0.0 R1(config)#ip nat inside source list 1 pool test R1(config)#interface fastEthernet 0/0 R1(config-if)#ip nat inside R1(config-if)#exit R1(config)#interface serial 0/0/0 R1(config-if)#ip nat outside R1(config-if)#exit R1(config)#exit
Now double click on R2(1841 Router1) and configure it as given below
Router>enable Router#configure terminal Router(config)#interface fastEthernet 0/0 Router(config-if)#ip address 20.0.0.1 255.0.0.0 Router(config-if)#no shutdown Router(config-if)#exit Router(config)#interface serial 0/0/0 Router(config-if)#ip address 30.0.0.2 255.0.0.0 Router(config-if)#no shutdown Router(config-if)#exit Router(config)#ip route 0.0.0.0 0.0.0.0 serial 0/0/0 Router(config)#hostname R2For testing of NAT go R1 and enable debug for NAT from privilege mode
R1#debug ip natNow go on pc5 and ping to 20.0.0.2
When ICMP ping packet reach to R1. It examines its source address against the access list 1. As this packet is generated form the network of 192.168.0.0 so it will pass the access list. Now router will check NAT pools for free address to translate with this address. Which you can check in the output of debag command in R1
IP NAT debugging is on NAT: s=192.168.0.7->50.0.0.1, d=20.0.0.2[1] NAT*: s=20.0.0.2, d=50.0.0.1->192.168.0.7[1] NAT: s=192.168.0.7->50.0.0.1, d=20.0.0.2[1] NAT*: s=20.0.0.2, d=50.0.0.1->192.168.0.7[1] NAT: s=192.168.0.7->50.0.0.1, d=20.0.0.2[1] NAT*: s=20.0.0.2, d=50.0.0.1->192.168.0.7[1] NAT: s=192.168.0.7->50.0.0.1, d=20.0.0.2[1] NAT*: s=20.0.0.2, d=50.0.0.1->192.168.0.7[1]As you can see in output 192.168.0.5 is translate with 50.0.0.1 before leaving the router.
In real life its best practices to turn off debug after testing so go on Router 1 and turn off debug mode.
R1#no debug ip nat IP NAT debugging is off R1#