100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
Python

Network Address Translation (NAT)

See how NAT rewrites private IP addresses to public ones, conserving IPv4 addresses and hiding internal network structure.

Network SecurityIntermediate10 min readJul 8, 2026
Analogies

Introduction

Network Address Translation (NAT) lets many devices on a private network share one or a few public IP addresses to reach the internet. It was originally developed to slow the exhaustion of IPv4 addresses, and as a side effect it also hides internal network topology from the outside world, which has security benefits similar to a lightweight firewall.

🏏

Cricket analogy: NAT is like an entire domestic team sharing one national jersey number when playing internationally, letting many players (private IPs) be represented by one visible identity (public IP) to conserve limited international squad slots, while also hiding the domestic bench from opposition scouting.

Explanation

Private networks typically use address ranges reserved by RFC 1918 that are never routed on the public internet: 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16. A NAT-capable router sits at the boundary between this private network and the public internet. When an internal host sends a packet outbound, the router rewrites the packet's private source IP:port to the router's public IP and a chosen port, and records this mapping in a translation table. When a reply comes back addressed to that public IP:port, the router looks up the translation table and rewrites the destination back to the original private IP:port before forwarding it inward. There are three main NAT variants. Static NAT maps one private IP permanently to one public IP, a fixed one-to-one relationship often used to make an internal server reachable at a consistent public address. Dynamic NAT maps private IPs to public IPs from a pool, on a one-to-one basis but assigned as needed, useful when you have a pool of public addresses shared among more private hosts than addresses (with the drawback that if the pool is exhausted no more new mappings can be made). PAT (Port Address Translation), also called NAT overload, is a many-to-one mapping: many private hosts share a single public IP address, distinguished from each other by using different source ports, so the translation table tracks (private IP, private port) to (public IP, unique public port) simultaneously for many connections. PAT/NAT overload is by far the most common form in home and small-office routers.

🏏

Cricket analogy: The three RFC 1918 ranges are like three levels of domestic cricket (club, district, state) never broadcast internationally; a NAT router is like the selection committee that translates a domestic player's identity into a national jersey number (public IP:port) and records the mapping, restoring it when results come back, whether it's static (a permanent number for a star all-rounder), dynamic (numbers assigned from a pool as players are picked), or PAT (many domestic players sharing one national jersey, distinguished by squad position).

Example

python
# Conceptual NAT translation table (PAT / NAT overload)
translation_table = {
    # (public_ip, public_port): (private_ip, private_port)
    ("203.0.113.5", 40001): ("192.168.1.10", 51000),
    ("203.0.113.5", 40002): ("192.168.1.11", 51000),
    ("203.0.113.5", 40003): ("192.168.1.10", 51001),
}

def translate_inbound(pub_ip, pub_port):
    return translation_table.get((pub_ip, pub_port))

print(translate_inbound("203.0.113.5", 40002))
# -> ('192.168.1.11', 51000)  router restores the original private IP:port

Analysis

The reason PAT can support many private hosts behind one public IP is that TCP/UDP connections are identified by the full 4-tuple (source IP, source port, destination IP, destination port); by rewriting the source port as well as the source IP, the router can keep thousands of simultaneous outbound connections distinct even though they all appear to originate from the same public IP. This is also why NAT is inherently outbound-connection-oriented: without a pre-existing entry in the translation table (or a static/port-forwarding rule), an unsolicited inbound packet has nothing to match against and is dropped, which is why NAT is often mistaken for a firewall even though its real purpose is address conservation.

🏏

Cricket analogy: A stadium can host thousands of simultaneous conversations distinguished by seat number even though they all sound like they're coming from the same stand; similarly PAT distinguishes thousands of connections by port number even though they share one public IP, and without a prior mapping an unsolicited shout from outside the ground goes unheard, which is why NAT gets mistaken for security.

Key Takeaways

  • NAT rewrites private IP:port to public IP:port on the way out, and reverses it on the way back, using a translation table.
  • RFC 1918 private ranges: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16.
  • Static NAT is a fixed one-to-one mapping; Dynamic NAT is a pooled one-to-one mapping; PAT/NAT overload is many-to-one via port multiplexing.
  • PAT is the most common form, allowing an entire private network to share a single public IP.

Practice what you learned

Was this page helpful?

Topics covered

#Python#ComputerNetworksStudyNotes#ComputerNetworks#NetworkAddressTranslationNAT#Network#Address#Translation#NAT#Networking#StudyNotes#SkillVeris

Frequently Asked Questions

21 categories · pick one to explore

Where can I get free study notes for programming and tech subjects?
SkillVeris offers completely free study notes covering programming and tech subjects, with no signup fees or paywalls. The notes are structured by course and topic, written for quick understanding, and enriched with the Learn Through Hobbies analogy method, so you can revise concepts through cricket, music, gaming, cooking and more.
Are SkillVeris study notes good for exam revision?
Yes, the study notes are designed for efficient revision: each topic answers its heading immediately, keeps explanations concise, and links to related glossary terms and cheat sheets. Students preparing for university exams or certification tests use them as quick revision notes because they distil concepts without the padding of full textbooks.
What subjects do the free study notes cover?
The study notes span the platform's main domains, including AI and machine learning, Python and programming, web development, DevOps, cloud, security and databases. Coverage mirrors the 37 live courses, so notes exist for the topics you are actually studying, and new note sets are added as courses launch.
How are SkillVeris study notes different from regular textbooks?
The notes are answer-first, concise and free, whereas textbooks are long and often expensive. Each section explains one concept directly, then reinforces it through selectable hobby analogies like cricket or cooking. Notes also cross-link to the glossary, blog and cheat sheets, letting you jump to related material instantly instead of flipping pages.
Can I use the developer study material without creating an account?
The study notes are free to access, and SkillVeris does not charge anything for its developer study material at any point. Browsing notes is straightforward from the Study Notes section, and if you want progress tracking, certificates and AI Mentor conversations tied to your learning, a free account unlocks those extras.
Do the study notes explain concepts with analogies?
Yes, this is a signature SkillVeris feature. Study notes use the Learn Through Hobbies method, explaining technical concepts through analogies from twelve domains including cricket, music, gaming, photography, travel, movies, fitness, chess, cooking, finance, business and sports. You can switch the analogy domain instantly to whichever hobby makes the concept click.
Are the revision notes suitable for last-minute exam preparation?
Yes, revision notes on SkillVeris work well for last-minute preparation because every section states the answer in its first sentences, so skimming is genuinely effective. Pair them with the relevant cheat sheet for formulas and syntax, and use the glossary for any unfamiliar term you meet while cramming.
Is there free study material for AI and machine learning?
Yes, SkillVeris provides free study notes across its AI and ML catalogue, covering Python for AI, deep learning frameworks like PyTorch and TensorFlow, Hugging Face Transformers, Large Language Models, RAG, AI agents and MLOps. All of it is free, making it a strong resource for Indian students and global learners alike.
Can beginners understand the study notes, or are they for experts?
Beginners can absolutely use them. The notes are written in plain language, define terms as they appear, and lean on hobby analogies to make abstract ideas concrete. Difficulty scales with the underlying course level, so beginner-course notes stay gentle while advanced-course notes go deeper, and the glossary supports you throughout.
How do study notes connect with SkillVeris courses?
Study notes are organised by course and topic, so they map directly to the structured courses and their 24–40-lesson curriculum. Many learners study a lesson first, then use the matching notes for revision before module assessments and the final exam, where 80 percent is required to pass and earn the certificate.
Are there study notes for Python specifically?
Yes, Python is well covered through notes tied to the Python-focused courses, including Python for AI and ML. Topics span fundamentals through applied machine learning usage. You can reinforce the notes with Python practice in Code Lab, which runs code in your browser with no installation required.
Do the study notes include code examples?
Yes, study notes include code examples wherever a concept is best shown in code, alongside explanations, key points and analogies. Reading a snippet in the notes and then reproducing it yourself in Code Lab is an effective loop, since Code Lab lets you run code in the browser across six languages.
How often is new study material added to SkillVeris?
Study material grows alongside the course catalogue. Whenever new courses join the platform's 37 live courses, matching study notes, glossary entries and cheat sheets are added so the resources stay in sync. Existing notes are also refined over time, so it is worth revisiting topics you studied earlier.
Can I use SkillVeris notes to prepare for technical interviews?
Yes, the notes make excellent interview revision because they compress each concept into direct, answer-first explanations, which mirrors how you should answer interview questions. Combine them with the SkillVeris interview questions feature, which includes readiness scoring, to test whether your revision has actually made you interview-ready.
Are the study notes mobile-friendly for studying on the go?
Yes, the study notes are built to load fast and read comfortably on mobile devices, so you can revise during a commute or between classes. Sections are short and answer-first, which suits small screens, and analogy switching works on mobile too, letting you study anywhere without carrying books.
What is the difference between study notes and cheat sheets?
Study notes explain concepts in depth with context, examples and analogies, making them ideal for learning and revision. Cheat sheets are compact quick-reference summaries of syntax, commands and key facts, ideal once you already understand a topic. Most learners study the notes first, then keep the cheat sheet handy while coding.
Do study notes help if I am stuck on a course lesson?
Yes, reading the matching study notes often clarifies a lesson because the same concept is explained from a different angle, frequently with a different analogy. If you are still stuck, ask the AI Mentor, which answers 24/7 at Quick, Detailed or Deep-dive depth until the idea genuinely makes sense.
Is there free study material for DevOps and cloud topics?
Yes, SkillVeris carries free study notes for DevOps and cloud topics as part of its coverage across 37 live courses. The material suits learners following the DevOps Engineer or Cloud Engineer paths, and it links to related glossary terms and cheat sheets so you can revise the whole toolchain in one place.
Can school or college students in India use these notes for projects?
Yes, students across India and worldwide use SkillVeris notes for coursework, projects and exam preparation, and everything is free, which matters for student budgets. The notes explain concepts clearly enough to cite in project reports, and Code Lab lets you prototype the project code directly in your browser.
How should I combine study notes with other SkillVeris resources?
A proven loop: learn from a course lesson, revise with the matching study notes, look up unfamiliar terms in the glossary, keep the cheat sheet open while practising in Code Lab, and quiz yourself with interview questions. The AI Mentor fills any remaining gaps 24/7, at whatever depth you need.

What Learners Say

Real journeys from the SkillVeris community — swipe for more.

SkillVeris taught me Python through Cricket. Now I’m building real projects and feeling confident!
Arjun S. · B.Tech Student
The best platform for hobby-based learning. Concepts finally stick.
Priya R. · Data Analyst
I went from zero coding to a portfolio of projects — all by learning through my love for gaming. Landed my first internship!
Kabir M. · CS Undergraduate
Trending Topics50 popular tags — tap to explore
Trending CoursesAll 37 free courses — tap to browse