NAT Overload Configuration in Cisco Packet Tracer

Aisyah Aldina

Illustration of envelopes with address labels for a guide on NAT in Cisco Packet Tracer

Hi everyone, the PCs in your office or at home use private IP addresses such as 192.168.x.x or 172.16.x.x. Private IPs cannot travel across the internet, because routers on the internet have no route back to those addresses. So for every PC to still be able to browse, the office router translates those private IPs into a single public IP. That process is called NAT (Network Address Translation).

In this article I practice NAT overload, also known as PAT, which is the most common type of NAT because dozens of PCs can share just one public IP. I did everything in Cisco Packet Tracer 8.2.1. If you are not comfortable with routing yet, read my guide on static routing in Cisco Packet Tracer first.

Download the Packet Tracer lab file
Open with Cisco Packet Tracer 8.2.1 or later · 2 routers, 1 switch, 3 PCs, 1 server · NAT overload already enabled
Download .pkt

The Topology and Cables Used

Build the office to internet topology

Cisco Packet Tracer window showing a NAT topology from the office LAN to the internet

This time I laid out the topology from left to right, so it is easy to picture how a packet travels out of the office. The devices are 3 PCs, 1 Cisco 2960-24TT switch, 2 Cisco 1941 routers, and 1 Server-PT.

Blue inside box for the office LAN and orange outside box for the internet in the NAT topology

The blue box labeled “LAN kantor” is the office LAN, also called the inside, using the private network 172.16.10.0/24. The orange box is the internet, also called the outside, which holds the ISP router and a public server at 198.51.100.10. Router0 in the middle is the office router (“Router kantor”) that runs NAT, and the public IP the ISP gives to the office is 203.0.113.1.

PC0 FastEthernet0     ->  Switch0 FastEthernet0/1     (straight)
PC1 FastEthernet0     ->  Switch0 FastEthernet0/2     (straight)
PC2 FastEthernet0     ->  Switch0 FastEthernet0/3     (straight)
Switch0 Gig0/1        ->  Router0 Gig0/0              (straight)
Router0 Gig0/1        ->  Router1 Gig0/1              (cross-over)
Router1 Gig0/0        ->  Server0 FastEthernet0       (cross-over)

Cross-over cables on the internet side

Cross-over cables between the routers and from the ISP router to the server

There are two Copper Cross-Over cables, shown as dashed lines. Router to router uses cross-over because both devices are the same type. Router to server also uses cross-over, because the router port and the server port both behave like a computer port, so they count as the same type. The cables from the PCs to the switch and from the switch to the router are Copper Straight-Through.

Here is the IP plan I use.

Router0 Gig0/0   172.16.10.1/24      (gateway LAN, inside)
Router0 Gig0/1   203.0.113.1/30      (IP publik kantor, outside)
ISP Gig0/1       203.0.113.2/30
ISP Gig0/0       198.51.100.1/24
Server0          198.51.100.10/24    gateway 198.51.100.1
PC0  172.16.10.10   PC1  172.16.10.11   PC2  172.16.10.12   gateway 172.16.10.1

Configuring the Office Router

Open the Router0 CLI

Router0 marked with a red circle in the NAT topology

Click Router0 in the middle of the topology, which I marked with a red circle.

CLI tab marked in the Router0 window in Cisco Packet Tracer

In the Router0 window, click the CLI tab. When it asks about the initial configuration dialog, type no and press Enter.

Set the IPs and mark inside and outside

IP addresses with ip nat inside and ip nat outside configured on Router0

Type the following commands.

enable
configure terminal
hostname Router0
interface gigabitEthernet0/0
ip address 172.16.10.1 255.255.255.0
ip nat inside
no shutdown
exit
interface gigabitEthernet0/1
ip address 203.0.113.1 255.255.255.252
ip nat outside
no shutdown
exit

The ip nat inside command goes on the port facing the LAN, and ip nat outside goes on the port facing the internet. The router only translates packets that pass from inside to outside, so both of these marks have to be correct.

The NAT overload rule and default route

access-list, ip nat inside source overload, and default route commands on Router0

Still on Router0, continue with the following commands.

access-list 1 permit 172.16.10.0 0.0.0.255
ip nat inside source list 1 interface gigabitEthernet0/1 overload
ip route 0.0.0.0 0.0.0.0 203.0.113.2
end
write memory

Access-list 1 defines which IPs are allowed to be translated, in this case every 172.16.10.x address. The ip nat inside source line means addresses matching list 1 are replaced with the IP of Gig0/1, which is 203.0.113.1. The overload keyword lets many PCs share the same public IP, and the router tells them apart by port number. The default route 0.0.0.0 sends every unknown destination to the ISP.

Configuring the ISP Router

Open the Router1 CLI

Router1 ISP marked with a red circle in the NAT topology

Close the Router0 window, then click Router1 inside the orange box. Open the CLI tab and answer no to the initial configuration dialog.

Set the ISP router IPs

ISP router IP configuration with no route to the private network
enable
configure terminal
hostname ISP
interface gigabitEthernet0/1
ip address 203.0.113.2 255.255.255.252
no shutdown
exit
interface gigabitEthernet0/0
ip address 198.51.100.1 255.255.255.0
no shutdown
end
write memory

Notice that I deliberately gave the ISP router no route to 172.16.10.0. Just like routers on the real internet, the ISP knows nothing about the office private IPs. It only knows 203.0.113.0/30, and thanks to NAT, every packet from the office really does arrive with the address 203.0.113.1.

Setting the Server and PC IPs

Open Server0

Server0 marked with a red circle in the NAT topology

Close the Router1 window, then click Server0 at the far right of the topology.

Desktop tab and IP Configuration icon marked in the Server0 window

In the Server0 window, click the Desktop tab and then click IP Configuration.

The public server IP

Public server IP 198.51.100.10 with gateway 198.51.100.1

Enter 198.51.100.10 as the IPv4 Address, 255.255.255.0 as the Subnet Mask, and 198.51.100.1 as the Default Gateway. The HTTP service on the server is already on by default, so you can use it right away for a browsing test.

Open PC0

PC0 marked with a red circle in the office LAN

Close the Server0 window, then click PC0 inside the blue box.

PC0 Desktop tab with the IP Configuration, Command Prompt, and Web Browser icons marked

In the PC0 window, click the Desktop tab. We use the three marked icons in this article: IP Configuration, Command Prompt, and Web Browser.

PC IPs in the office LAN

IP 172.16.10.10, subnet 255.255.255.0, and gateway 172.16.10.1 on PC0

Click IP Configuration, then enter 172.16.10.10 as the IPv4 Address, 255.255.255.0 as the Subnet Mask, and 172.16.10.1 as the Default Gateway. Repeat this on PC1 with 172.16.10.11 and on PC2 with 172.16.10.12.

Warning: When you type the IP 172.16.10.10, Packet Tracer automatically fills in the subnet mask 255.255.0.0 because 172.16 is a class B address. Change it by hand to 255.255.255.0 so it matches the subnet on the router.

Testing NAT

Ping the internet server from PC2

Successful ping from PC2 to server 198.51.100.10 through NAT

Open the Command Prompt on PC2 and run the following command.

ping 198.51.100.10

The first ping timed out twice because of ARP on the two networks, and the second ping succeeded completely. Remember that the ISP router has no route to 172.16.10.0, so the only reason the server reply can make it back is that the PC2 packets were already translated to 203.0.113.1.

Browse from PC0

PC0 Web Browser opening the page on server 198.51.100.10

On PC0, open the Web Browser, type http://198.51.100.10 and click Go. The default Cisco Packet Tracer page from the server shows up. If it stays blank or says Host Name Unresolved, wait a moment and click Go once more.

Check the NAT translation table

Output of show ip nat translations with inside local and inside global addresses

Open the Router0 CLI again and run the following command.

show ip nat translations

In this table you can see Inside local 172.16.10.10:1025, which is PC0, translated to Inside global 203.0.113.1:1025 while it opens the web server 198.51.100.10 on port 80. Ping entries usually disappear quickly, so run this command right after your test.

NAT statistics

Output of show ip nat statistics with the inside and outside interfaces
show ip nat statistics

This command shows the number of translations, the outside interface Gig0/1, the inside interface Gig0/0, and the number of hits. If Outside interfaces or Inside interfaces is empty, it means ip nat inside or ip nat outside has not been applied yet.

Common Problems and How to Fix Them

Ping to the server keeps showing Request timed out

Check the inside and outside marks on Router0. If they are swapped, NAT does not work and the ISP has no way back to 172.16.10.0.

show ip nat translations is empty

Make sure access-list 1 covers the PC network and that its wildcard is 0.0.0.255, not the subnet mask 255.255.255.0.

The PC cannot ping the gateway 172.16.10.1

The problem is in the LAN, not in NAT. Check that the PC subnet mask is 255.255.255.0 and that the cable from the PC to the switch is green.

At this point every PC in the office LAN can reach the internet through one public IP using NAT overload. In the next article we cover ACLs, which let you control who is allowed to access what on the network. If you run into any other error while trying this, just leave a comment below.

Leave a Comment