Experiment 9
Aim: To Implement NAT (Network Address Translation) using CISCO Packet
Tracer.
Theory:
Public and Private Networks
A computer network can be categorized as either private or public based on the type of IP
addresses it uses.
A private network is used for internal communication within an organization, school, or
home. It employs IP addresses that are not routable on the Internet, meaning they are valid
only within the local network. These addresses help in conserving public IP space and
improving internal security. According to RFC 1918, the private IP address ranges are:
Class A: [Link] – [Link]
Class B: [Link] – [Link]
Class C: [Link] – [Link]
On the other hand, a public network uses globally unique IP addresses that are assigned by
Internet Service Providers (ISPs) or regulatory authorities. These addresses are routable over
the Internet, allowing direct communication with external networks. Devices with public IPs
can be accessed from anywhere on the Internet, making them suitable for servers, websites,
and online services.
Network Address Translation (NAT)
Network Address Translation (NAT) is a networking technique used to translate private IP
addresses into public IP addresses and vice versa. It enables devices in a private network to
access external public networks, such as the Internet, using a limited number of public IPs.
NAT is usually implemented on routers or firewalls and acts as an intermediary between private
and public domains.
The working principle of NAT involves replacing the private IP address of a packet with a
public IP address when it leaves the network. When the response is received, the NAT device
reverses the translation using a mapping table, ensuring that the packet reaches the correct
internal host.
There are three main types of NAT:
Static NAT: Provides a one-to-one mapping between a private IP and a public IP.
Dynamic NAT: Uses a pool of public IP addresses to dynamically map with private
IPs.
PAT (Port Address Translation) or NAT Overload: Allows multiple private IPs to
share a single public IP by differentiating connections using port numbers.
64
The advantages of NAT include:
Conservation of public IP address space.
Improved network security by hiding internal IP addresses.
Allowing multiple devices to share one Internet connection.
However, NAT also has some disadvantages, such as:
Reduced end-to-end transparency.
Difficulty for applications requiring direct IP communication (like VoIP or peer-to-peer
connections).
In summary, NAT plays a crucial role in modern networking by enabling seamless
communication between private and public networks, conserving IP address space, and adding
a layer of security to internal systems.
Figure 2: Network Address Translation.
Components Required:
Cisco Packet Tracer Software
2 Routers (Router0 and Router1)
2 Switches (Switch0 and Switch1)
2 PCs (PC0 and PC1)
1 Server (Server0)
Serial and Ethernet cables
65
Stepwise Procedure:
Step 1: Create the Topology
1. Place two routers, two switches, two PCs, and one server in Packet Tracer.
Figure 3: Two routers, two switches, two PCs and one server.
2. Connect the devices as follows:
o Router0 (Fa0/0) → Switch 1
o Router1 (Fa0/0) → Switch 2
o Router0 (Serial2/0) ↔ Router1 (Serial2/0) using a Serial DCE cable
o PC0 and Server0 connected to Switch 1 using Straight-Through cables
o PC1 connected to Switch 2 using a Straight-Through cable
66
Figure 4: Two routers, two switches, two PCs and one server.
Network Overview:
Table 1: Devices and their IP addresses
Device Interface IP Address Subnet Mask Purpose
Router0 FastEthernet0/0 [Link] [Link] LAN side
Router0 Serial2/0 [Link] [Link] WAN link
Router1 FastEthernet0/0 [Link] [Link] LAN side
Router1 Serial2/0 [Link] [Link] WAN link
PC0 FastEthernet0 [Link] [Link] Inside LAN
Server0 FastEthernet0 [Link] [Link] Inside LAN
PC1 FastEthernet0 [Link] [Link] Outside LAN
Step 2: Assign IP Addresses to End Devices
For Inside Network (Switch 1)
PC0:
1. Click PC0 → Desktop → IP Configuration
2. Assign:
o IP Address: [Link]
o Subnet Mask: [Link]
o Default Gateway: [Link]
67
Server0:
1. Click Server0 → Desktop → IP Configuration
2. Assign:
o IP Address: [Link]
o Subnet Mask: [Link]
o Default Gateway: [Link]
Figure 5: Assign IP Address to PCs and Server.
For Outside Network (Switch 2)
PC1:
1. Click PC1 → Desktop → IP Configuration
2. Assign:
o IP Address: [Link]
o Subnet Mask: [Link]
o Default Gateway: [Link]
Step 3: Configure Router0 Interfaces
1. Click Router0 → Config Tab → FastEthernet0/0
o Check Port Status: On
o IPv4 Address: [Link]
o Subnet Mask: [Link]
2. Click Router0 → Config Tab → Serial2/0
o Check Port Status: On
o IPv4 Address: [Link]
o Subnet Mask: [Link]
68
Figure 6: Configure Routers’ Serial Interface.
Step 4: Configure Router1
1. Click Router1 → Config Tab → FastEthernet0/0
o Port Status: On
o IP Address: [Link]
o Subnet Mask: [Link]
Figure 7: Configure Routers’ FastEthernet Interface.
2. Click Router1 → Config Tab → Serial2/0
69
o Port Status: On
o IP Address: [Link]
o Subnet Mask: [Link]
Both routers’ Serial interfaces ([Link] ↔ [Link]) should now be green i.e.
connection is up.
Figure 8: After configuration all connections turn green.
Step 5: Configure Static Routing
On Router0
1. Run command:
Router(config)# ip route [Link] [Link] [Link]
Figure 9: Configure Routing on Router0.
On Router1
1. Run command:
70
Router(config)# ip route [Link] [Link] [Link]
Figure 10: Configure Routing on Router1.
This enables communication between inside and outside networks through routers.
Step 6: Static NAT Configuration on Router0
On Router0, static NAT is used to map internal (private) IP addresses to public IPs.
Commands executed:
Router(config)# ip nat inside source static [Link] [Link]
Router(config)# ip nat inside source static [Link] [Link]
Router(config)# ip nat inside source static [Link] [Link]
Router(config)# interface FastEthernet0/0
Router(config-if)# ip nat inside
Router(config-if)# exit
Router(config)# interface Serial2/0
Router(config-if)# ip nat outside
Router(config-if)# exit
Figure 11: Configure NAT in Router0.
Here, FastEthernet0/0 is configured as the inside interface, and Serial2/0 is configured as
the outside interface.
Each local (private) address is permanently mapped to a unique global (public) address.
71
Step 7: Static NAT Configuration on Router1
Similarly, on Router1, internal IPs are mapped to a different public IP range.
Commands executed:
Router(config)# ip nat inside source static [Link] [Link]
Router(config)# ip nat inside source static [Link] [Link]
Router(config)# ip nat inside source static [Link] [Link]
Router(config)# interface FastEthernet0/0
Router(config-if)# ip nat inside
Router(config-if)# exit
Router(config)# interface Serial2/0
Router(config-if)# ip nat outside
Router(config-if)# exit
Figure 12: Configure NAT in Router1.
Here, FastEthernet0/0 acts as the inside NAT interface, and Serial2/0 as the outside NAT
interface.
Each private IP from the internal LAN is assigned a fixed public IP for consistent translation.
Step 8: Verification of NAT and Connectivity
From PC0, connectivity was tested using the ping command.
1. Ping to [Link] (Private IP):
ping [Link]
Result: Destination host unreachable.
→ The private IP of another LAN is not reachable directly since NAT does not route
private-to-private communication.
2. Ping to [Link] (Public IP):
ping [Link]
72
Result: Replies received successfully (75% success).
→ Indicates that Static NAT translation between Router0 and Router1 is working
correctly.
Figure 13: Verify Connectivity using ping command.
Observation:
1. All devices in the same subnet communicated successfully.
2. Devices in different networks communicated via NAT through the router.
3. The network allowed secure communication between private and public addresses.
Conclusion:
In this experiment, Network Address Translation (NAT) was successfully implemented using
Cisco Packet Tracer. The private internal IP addresses were translated into public addresses,
enabling communication between the internal and external networks. The experiment verified
that static NAT correctly allowed a host in the public network to access a private server while
conserving IP addresses and maintaining security.
73