• Home
  • Tech
Safha
  • Home
  • Tech
    • All
    • Windows
    What is a Virtual IP (VIP)?

    What is a Virtual IP (VIP)?

    Private Vs Public IP Addresses

    Private Vs Public IP Addresses

    Proxy Vs Reverse Proxy

    Proxy Vs Reverse Proxy

    Content Delivery Network (CDN)

    Content Delivery Network (CDN)

    Building Modern IT Data Centers

    Building Modern IT Data Centers

    What is Virtualisation?

    What is Virtualisation?

No Result
View All Result
  • Home
  • Tech
    • All
    • Windows
    What is a Virtual IP (VIP)?

    What is a Virtual IP (VIP)?

    Private Vs Public IP Addresses

    Private Vs Public IP Addresses

    Proxy Vs Reverse Proxy

    Proxy Vs Reverse Proxy

    Content Delivery Network (CDN)

    Content Delivery Network (CDN)

    Building Modern IT Data Centers

    Building Modern IT Data Centers

    What is Virtualisation?

    What is Virtualisation?

No Result
View All Result
Safha
No Result
View All Result
  • Home
  • Tech
Home Tech

Private Vs Public IP Addresses

Chief Editor by Chief Editor
February 21, 2025
in Tech
0
Private Vs Public IP Addresses
0
SHARES
9
VIEWS
Share on FacebookShare on Twitter

What is an IP Address?

An IP address (Internet Protocol address) is a unique numerical identifier assigned to a device connected to a network that uses the Internet Protocol for communication. It serves two main purposes:

  1. Identification – Uniquely identifies a device on a network.
  2. Location – Helps in locating the device within a network or across the internet.

Types of IP Addresses

  1. IPv4 (Internet Protocol version 4) – A 32-bit address format (e.g., 192.168.1.1), supporting about 4.3 billion addresses.
  2. IPv6 (Internet Protocol version 6) – A 128-bit address format (e.g., 2001:0db8:85a3::8a2e:0370:7334), designed to handle the growing number of devices on the internet.

Public vs. Private IP Addresses

  • Public IP – Assigned by an Internet Service Provider (ISP) and used to communicate over the internet.
  • Private IP – Used within a local network (e.g., home or office) and not routable over the internet.

Static vs. Dynamic IP Addresses

  • Static IP – Manually assigned, does not change, used for servers and hosting services.
  • Dynamic IP – Assigned automatically by a DHCP server and can change over time.

Public IP Addresses:

These are necessary to accesses resources (data, web pages etc) over the internet. The organization that issues public IP addresses is the Internet Assigned Numbers Authority (IANA), which is a division of the Internet Corporation for Assigned Names and Numbers (ICANN).

Public IP addresses are unique, and a single IP cannot be allocated to multiple clients. Public IP addresses quickly ran out despite being 4 billion unique ones. To tackle this problem, engineers developed Private IP addresses.

Private IP Addresses:

These are not publicly registered on the internet. Therefore, we cannot access internet using a Private IP address. A private IP address needs to be converted into a Public IP address before we can access the internet. We can either manually assign private IPs to clients on a private network OR we can use a service like Dynamic Host Configuration Protocol (DHCP) to assign private IPs to clients on a private network. The advantage of assigning Private IPs to hosts on a private network is that we can only have one Public IP serving many hosts having individual Private IPs. This removes the need of allocating each host a dedicated Public IP.

But then how the clients with private IPs can access Internet? The solution to this problem is called Network Address Translation (NAT) through which Private IPs can be translated into Public IP at the gateway device of a private network and enabling the hosts with Private IPs to access the internet. The same gateway also translates Public IPs to Private IPs for incoming messages for the hosts in its Private Network. (More on this below)

Private IP addresses are categorized into three classes (A, B, and C), each with a specific range and number of available addresses. These addresses are reserved for internal network use and are not routable on the public internet.

Private IP Address Classes

ClassPrivate IP RangeDefault Subnet MaskNumber of Hosts
A10.0.0.0 – 10.255.255.255255.0.0.0 (/8)~16 million
B172.16.0.0 – 172.31.255.255255.255.0.0 (/12)~1 million
C192.168.0.0 – 192.168.255.255255.255.255.0 (/16)~65,000

Key Points

  • Class A: Used for large organizations (e.g., multinational companies, ISPs).
  • Class B: Suitable for medium-sized networks (e.g., universities, enterprises).
  • Class C: Common for small networks (e.g., home and small businesses).

Subnetting & How Private IPs Work with Public IPs via NAT

1. Subnetting (Subnet Mask & CIDR Notation)

Subnetting is the process of dividing a large network into smaller sub-networks (subnets) to improve efficiency and security.

Each private IP class has a default subnet mask, which determines the number of available hosts:

  • Class A: 255.0.0.0 (/8) → 16,777,214 hosts
  • Class B: 255.255.0.0 (/12) → 1,048,574 hosts
  • Class C: 255.255.255.0 (/16) → 65,534 hosts

However, we can subnet further using CIDR (Classless Inter-Domain Routing). For example:

  • 192.168.1.0/24 (Subnet mask: 255.255.255.0) allows 254 usable IPs.
  • 192.168.1.0/26 (Subnet mask: 255.255.255.192) allows 62 usable IPs.

Subnetting helps in efficient IP allocation, security isolation, and network performance optimization.

2. How Private IPs Interact with Public IPs via NAT

Since private IPs are not routable on the internet, they need to be translated to a public IP to communicate outside the local network. This is done using Network Address Translation (NAT).

Types of NAT:

  1. Static NAT – One-to-one mapping of a private IP to a public IP.
  2. Dynamic NAT – Maps private IPs to a pool of public IPs dynamically.
  3. PAT (Port Address Translation, aka NAT Overload) – Maps multiple private IPs to a single public IP using different ports.

Example of NAT in Action:

  • Device with private IP 192.168.1.10 wants to access the internet.
  • The router (with public IP 203.0.113.5) translates 192.168.1.10 → 203.0.113.5 using PAT.
  • When the response comes back, the router translates it back to 192.168.1.10.

This is how a single public IP can serve an entire network of private IPs.

Benefits of Using Private IPs & NAT

✅ Security – Private IPs are not exposed to the internet, reducing attack risks.
✅ Efficient IP Usage – IPv4 has limited addresses; NAT allows many devices to share one public IP.
✅ Flexibility – Networks can be expanded without requiring new public IPs.

Here’s a simple network topology diagram that illustrates how private IPs, NAT, and the internet interact:

Scenario:

  • A home or office network with multiple devices (PC, Laptop, Mobile).
  • These devices have private IPs (e.g., 192.168.1.X).
  • A router with NAT translates private IPs to a single public IP (e.g., 203.0.113.5).
  • The router sends and receives internet traffic on behalf of all devices.

Diagram Explanation

                     Internet
                         |
                   [ISP Router]
                         |
                  Public IP: 203.0.113.5
                         |
               ---------------------
               |       NAT Router     |
               |---------------------|
               | Private IP: 192.168.1.1 |
               ---------------------
                         |
         ----------------------------------
         |             |               |
      PC1            Laptop         Mobile
  192.168.1.10    192.168.1.11   192.168.1.12

Step-by-Step Data Flow Using NAT

  1. PC1 (192.168.1.10) wants to visit www.google.com.
  2. The NAT router replaces 192.168.1.10 with Public IP (203.0.113.5) and sends the request.
  3. Google responds to 203.0.113.5, not knowing about 192.168.1.10.
  4. The router maps the response back to 192.168.1.10 using its NAT table.
  5. PC1 gets the webpage, and this process repeats for all connected devices.

This method is called PAT (Port Address Translation), which allows multiple devices to share a single public IP.


Why is This Useful?

✅ IPv4 Conservation – We don’t need a public IP for every device.
✅ Security – Internal devices remain hidden from direct internet access.
✅ Scalability – Organizations can have thousands of internal devices without requiring public IPs.

Tags: IPIPv4IPv6NetworkingTCP/IP
Previous Post

Proxy Vs Reverse Proxy

Next Post

What is a Virtual IP (VIP)?

Chief Editor

Chief Editor

Next Post
What is a Virtual IP (VIP)?

What is a Virtual IP (VIP)?

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • Trending
  • Comments
  • Latest

How to do a clean Install of Windows 11

January 28, 2025
How a website is accessed from a Web Server

How a website is accessed from a Web Server

March 9, 2025
What is Virtualisation?

What is Virtualisation?

February 15, 2025
XML file parsing with Python

XML file parsing with Python

January 29, 2025

How to do a clean Install of Windows 11

0
Unzipping multiple Zip Files in a folder using Python

Unzipping multiple Zip Files in a folder using Python

0
Installing third party modules in Python

Installing third party modules in Python

0
XML file parsing with Python

XML file parsing with Python

0
What is a Virtual IP (VIP)?

What is a Virtual IP (VIP)?

March 7, 2025
Private Vs Public IP Addresses

Private Vs Public IP Addresses

February 21, 2025
Proxy Vs Reverse Proxy

Proxy Vs Reverse Proxy

February 16, 2025
Content Delivery Network (CDN)

Content Delivery Network (CDN)

February 16, 2025
  • Home
  • Tech

© 2025 Safha - We are all about Technology and Finance Learning and Knowledge Sharing

No Result
View All Result
  • Home
  • Tech

© 2025 Safha - We are all about Technology and Finance Learning and Knowledge Sharing