Lab Objective:
Learn how to configure static network address translation (NAT).
Lab Purpose:
NAT is used by routers and firewalls to swap one address for another. Many manuals tell you that it’s used to allow private IP addresses (non-routable RFC 1918) to access the internet. This is true, but actually you can NAT routable addresses to different routable addresses. You would do this if you wanted to keep your address masked from hosts outside your network.
Lab Tool:
Packet Tracer
Lab Topology:
Please use the following topology to complete this lab exercise:
Lab Walkthrough:
Task 1:
Connect a host to a router via a crossover cable. Add another router, which will be the IP address the host pings.
Task 2:
Set the IP configuration for the host. The Ethernet interface should be 172.16.1.2 and the default gateway 172.16.1.1, which will be the closest IP address of R0.
Task 3:
Configure IP addressing on R0 and R1. The routers are connected via G0/1.
Router(config)#host R0
R0(config)#int g0/0
R0(config-if)#ip add 172.16.1.1 255.255.0.0
R0(config-if)#no shut
%LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to up
R0(config-if)#int g0/1
R0(config-if)#ip add 192.168.1.1 255.255.255.0
R0(config-if)#no shut
R1(config)#int g0/1
R1(config-if)#ip add 192.168.1.2 255.255.255.0
R1(config-if)#no shut
R1(config-if)#exit
Task 4:
Add a static route on R1 to send all traffic to R0. We do this because the NAT address won’t be in any routing tables and will otherwise be dropped by the router.
R1(config)#ip route 0.0.0.0 0.0.0.0 192.168.1.1
Task 5:
Add your NAT configuration to R0. The address 172.16.1.2 should be NAT-ted to 10.0.0.1. We would usually use a routable address, but I don’t want to take the risk here, so we’ll stick to private IP addressing. Note also that you must tell the router which interfaces are inside and outside your network for the purposes of NAT.
R0(config)#ip nat inside source static 172.16.1.2 10.0.0.1
R0(config)#int g0/0
R0(config-if)#ip nat inside
R0(config-if)#int g0/1
R0(config-if)#ip nat outside
R0(config-if)#end
Task 6:
Test your configuration by pinging 192.168.1.2 from your host. R0 should swap (NAT) this address for 10.0.0.1.
Check the NAT table on R0. The inside global address is the NAT address. The inside local is your host, and the outside local is the destination address.
R0#show ip nat translations
Pro Inside global Inside local Outside local Outside global
icmp 10.0.0.1:1 172.16.1.2:1 192.168.1.2:1 192.168.1.2:1
icmp 10.0.0.1:2 172.16.1.2:2 192.168.1.2:2 192.168.1.2:2
icmp 10.0.0.1:3 172.16.1.2:3 192.168.1.2:3 192.168.1.2:3
icmp 10.0.0.1:4 172.16.1.2:4 192.168.1.2:4 192.168.1.2:4
— 10.0.0.1 172.16.1.2 — —
R0#show ip nat statistics
Total translations: 5 (1 static, 4 dynamic, 4 extended)
Outside Interfaces: GigabitEthernet0/1
Inside Interfaces: GigabitEthernet0/0
Hits: 3 Misses: 4
Expired translations: 0
Dynamic mappings:
R0#
Note:
NAT is used on every IPv4 network, including your home network.


