Skip to content

5.5 NAT

Network Address Translation (NAT) is a technique used in networking to translate private IP addresses used in a local network into a public IP address before packets are forwarded to the internet. This allows multiple devices on a local network to share a single public IP address.

βœ… Why Use NAT?

  • Conserves public IP addresses.
  • Adds a layer of security by hiding internal IPs.
  • Required when private IPs (like 192.168.x.x) need to access the internet.

πŸ”§ Types of NAT

  • Static NAT – One-to-one mapping of internal to public IP.
  • Dynamic NAT – Pool of public IPs assigned as needed.
  • PAT (Port Address Translation) – Many-to-one using ports (most common).

1. Configuring NAT

Play

NAT - Part 01

NAT - Part 02

2. πŸ“˜ Simple NAT Example in Cisco Packet Tracer

🎯 Goal: PC in a private network (192.168.1.x) accesses the internet using a router with NAT.

πŸ–₯ Network Setup

DeviceIP AddressInterface
PC0192.168.1.10---
RouterFa0/0: 192.168.1.1 (Inside)Fa0/1: 203.0.113.2 (Outside)
Server203.0.113.5 (Public Web Server)---

πŸ›  Step-by-Step in Packet Tracer

1. Add Devices

  • 1 PC
  • 1 Router
  • 1 Server
  • 2 Switches (optional, for realism)

2. Configure IPs

PC0:

IP: 192.168.1.10
Subnet: 255.255.255.0
Gateway: 192.168.1.1

Router:

interface fa0/0
ip address 192.168.1.1 255.255.255.0
ip nat inside
no shutdown
interface fa0/1
ip address 203.0.113.2 255.255.255.0
ip nat outside
no shutdown

Server:

IP: 203.0.113.5
Subnet: 255.255.255.0

3. Configure NAT on Router

access-list 1 permit 192.168.1.0 0.0.0.255
ip nat inside source list 1 interface fa0/1 overload

πŸ” This means:

  • NAT will translate packets from 192.168.1.x range
  • It will use the public IP of interface fa0/1
  • Overload means multiple internal IPs can share one public IP using ports (PAT)

4. Test

  • From PC0, open Command Prompt
  • Type: ping 203.0.113.5

If NAT is configured correctly, the ping will succeed.

In networking, ACLs (Access Control Lists) are rules used to control the flow of traffic into or out of a network. They’re used mainly on routers, switches, and firewalls to filter traffic based on specified conditions.

πŸ” What an ACL Does

An ACL defines what kind of traffic is allowed or denied. Each rule in the list checks packet attributes like:

  • Source IP address
  • Destination IP address
  • Port numbers (e.g., TCP/UDP ports)
  • Protocol (e.g., TCP, UDP, ICMP)

πŸ“‹ Types of ACLs

  1. Standard ACL

    • Filters only by source IP address
    • Example: Allow traffic from 192.168.1.0/24
  2. Extended ACL

    • Filters by source/destination IP, ports, and protocol
    • More precise control
    • Example: Allow HTTP traffic from 192.168.1.0/24 to 10.0.0.0/24
  3. Named ACL

    • Same as standard/extended but uses a name instead of a number

βš™οΈ Where ACLs Are Applied

  • Inbound: Before the router processes the packet
  • Outbound: After processing, before forwarding

βœ… Example (Cisco-style)

Terminal window
access-list 100 permit tcp 192.168.1.0 0.0.0.255 any eq 80

This allows HTTP (TCP port 80) traffic from 192.168.1.0/24 to any destination.

1. Standard ACL

ACL - 01

ACL - 02

ACL - 02

2. Extended ACL

Extended ACL - 01

Extended ACL - 02