IPv4 Addressing – Complete Beginner-Friendly Lesson
- What is an IP Address?
An IP (Internet Protocol) address is a unique logical address assigned to a device connected to a network.
It helps devices identify each other and communicate over a network.
Example:
192.168.1.10
Just like your home has a postal address, your computer needs an IP address to communicate with other devices.
- What is IPv4?
IPv4 stands for Internet Protocol Version 4.
- IPv4 uses a 32-bit address.
- It is divided into 4 parts called octets.
- Each octet contains 8 bits.
- Each octet is separated by a dot (.).
- Each octet can have a value from 0 to 255.
Example:
192.168.1.10
192
8 bits
1st Octet
168
8 bits
2nd Octet
1
8 bits
3rd Octet
10
8 bits
4th Octet
8 + 8 + 8 + 8 = 32 bits
Why does an octet have values from 0 to 255?
Each bit can have either 0 or 1.
8 bits can represent 256 different combinations (2⁸ = 256).
Therefore, the range is 0 to 255.
- Binary Representation of IPv4
Computers understand binary numbers (0s and 1s).
For example:
IP Address: 192.168.1.10
| Decimal | Binary |
| 192 | 11000000 |
| 168 | 10101000 |
| 1 | 00000001 |
| 10 | 00001010 |
So, the complete IPv4 address is represented using 32 binary bits.
- IPv4 Address Classes
IPv4 addresses were traditionally divided into five classes: A, B, C, D and E.
| Class | First Octet Range | Default Subnet Mask | Purpose |
| A | 1–126 | 255.0.0.0 (/8) | Large networks |
| B | 128–191 | 255.255.0.0 (/16) | Medium networks |
| C | 192–223 | 255.255.255.0 (/24) | Small networks |
| D | 224–239 | Not applicable | Multicasting |
| E | 240–255 | Not applicable | Experimental / Reserved |
Important points:
- Class A: First octet represents the network portion.
- Class B: First two octets represent the network portion.
- Class C: First three octets represent the network portion.
- Class D: Used for multicast communication.
- Class E: Reserved for experimental purposes.
Example of identifying the class
- 10.1.1.1 → Class A
- 172.16.1.1 → Class B
- 192.168.1.1 → Class C
- 230.1.1.1 → Class D
- 245.1.1.1 → Class E
Note: 127.x.x.x is reserved for loopback testing, so it is excluded from normal Class A host addressing.
- What is a Subnet Mask?
A subnet mask helps us identify which portion of an IP address belongs to the network and which portion belongs to the host (device).
In simple words:
- Network portion identifies the network.
- Host portion identifies the individual device within that network.
Example:
- IP Address: 192.168.1.10
- Subnet Mask: 255.255.255.0
Here:
- Network Address: 192.168.1.0
- Host portion: 10
The device belongs to the 192.168.1.0 network.
- Default Subnet Masks
Every traditional IPv4 address class has a default subnet mask.
| Class | Default Subnet Mask | CIDR |
| A | 255.0.0.0 | /8 |
| B | 255.255.0.0 | /16 |
| C | 255.255.255.0 | /24 |
What is CIDR notation?
CIDR stands for Classless Inter-Domain Routing.
Instead of writing the complete subnet mask, we can use a slash followed by a number.
Examples:
- 255.0.0.0 = /8
- 255.255.0.0 = /16
- 255.255.255.0 = /24
The number represents how many bits are used for the network portion.
- Public IP Address vs Private IP Address
IPv4 addresses are also classified as public and private addresses.
Private IP Address
A private IP address is used inside a local network, such as a home, school or office network.
Examples:
- 192.168.1.10
- 10.0.0.5
- 172.16.1.20
Private IP addresses cannot be directly routed over the public internet.
Public IP Address
A public IP address is used to identify a network or device on the internet. It is globally unique at a given time.
Example: 8.8.8.8 (Google Public DNS).
Private IPv4 Address Ranges
| Range | Private IP Block |
| Class A range | 10.0.0.0 – 10.255.255.255 |
| Class B range | 172.16.0.0 – 172.31.255.255 |
| Class C range | 192.168.0.0 – 192.168.255.255 |
These are the three officially reserved private IPv4 blocks.
Real-world example:
Imagine you have Wi-Fi at home.
- Your laptop: 192.168.1.10
- Your mobile: 192.168.1.11
- Your smart TV: 192.168.1.12
All these devices use private IP addresses. Your router generally uses a public IP address to communicate with the internet.
- What is NAT?
NAT stands for Network Address Translation.
It allows devices using private IP addresses to communicate with the internet by translating their private addresses into a public address.
Example:
Your laptop, mobile and TV share the router's public IP address when accessing the internet (typically using PAT, also called NAT overload).
- Static IP vs Dynamic IP
Static IP Address
An IP address that is manually configured or reserved to remain the same.
Example: A company server may use a static IP address.
Dynamic IP Address
An IP address automatically assigned to a device, usually through DHCP.
Example: When your mobile connects to Wi-Fi, the router can automatically assign it an IP address.
| Static IP | Dynamic IP |
| Remains fixed unless changed | Can change over time |
| Manually configured or reserved | Automatically assigned |
| Useful for servers | Common for user devices |
- Important Special IPv4 Addresses
| IP Address / Range | Purpose |
| 127.0.0.1 | Loopback address |
| 0.0.0.0 | Unspecified address |
| 255.255.255.255 | Limited broadcast address |
| 169.254.0.0/16 | Link-local addressing (APIPA) |
| 224.0.0.0/4 | Multicast address range |
Remember:
- 127.0.0.1 means your own computer.
- 169.254.x.x is commonly assigned when DHCP fails and no address is obtained.
- 255.255.255.255 is used for a local broadcast.
- What is DHCP?
DHCP stands for Dynamic Host Configuration Protocol.
It automatically provides IP configuration to devices, including:
- IP Address
- Subnet Mask
- Default Gateway
- DNS Server
Example:
When you connect your laptop to Wi-Fi, DHCP can automatically assign:
- IP Address: 192.168.1.10
- Subnet Mask: 255.255.255.0
- Default Gateway: 192.168.1.1
- DNS Server: 8.8.8.8
You don't need to enter these details manually.
- Quick Revision – Important Points
| Topic | Remember |
| IPv4 | 32 bits |
| Octets | 4 |
| Bits per octet | 8 |
| Decimal range | 0–255 |
| Class A mask | /8 |
| Class B mask | /16 |
| Class C mask | /24 |
| Private IP | Used in local networks |
| Public IP | Used on the internet |
| NAT | Translates private and public addresses |
| DHCP | Automatically assigns IP configuration |
| Loopback | 127.0.0.1 |
- Practice Questions
- How many bits are there in an IPv4 address?
- How many octets are present in IPv4?
- What is the range of each octet?
- What is the default subnet mask of Class A?
- Which class is used for multicast?
- Is 192.168.1.10 a public or private IP?
- What is the purpose of NAT?
- What is the use of DHCP?
- What does 127.0.0.1 represent?
- What is the CIDR notation of 255.255.255.0?
0