IPv4 Address Structure — Understanding How IPv4 Addresses Are Organised¶
Every device connected to an IPv4 network requires an IPv4 Address to communicate. An IPv4 address is much more than four decimal numbers separated by dots—it is a carefully structured 32-bit logical address that identifies both the network and the host. Understanding the IPv4 address structure is essential before learning subnetting, Classless Inter-Domain Routing (CIDR), routing, Variable Length Subnet Masking (VLSM), and enterprise network design. Every Linux administrator, DevOps engineer, Cloud Architect, Platform Engineer, Site Reliability Engineer (SRE), and Network Engineer should master IPv4 addressing.
Learning Path¶
Course Progress
What You'll Learn¶
After completing this lesson, you'll be able to:
- Understand the structure of an IPv4 address
- Explain octets and bytes
- Identify network and host portions
- Understand subnet masks
- Explain default gateways
- Read IPv4 addresses in binary and decimal
- Understand how IPv4 addresses enable communication
Prerequisites¶
Complete:
Why Learn IPv4 Address Structure?¶
Every network device needs an IPv4 address.
Examples:
- Laptop
- Mobile Phone
- Linux Server
- Router
- Firewall
- Kubernetes Node
- Virtual Machine
Without understanding IPv4 structure, it is impossible to learn:
- Subnetting
- CIDR
- Routing
- VLSM
- Supernetting
What is an IPv4 Address?¶
An IPv4 Address is a 32-bit logical address assigned to a network interface.
Example:
It uniquely identifies a device within an IPv4 network.
IPv4 Address Format¶
An IPv4 address consists of four decimal numbers separated by periods.
Example:
Each number is called an Octet.
Structure of an IPv4 Address¶
There are:
- 4 Octets
- 32 Bits
- 4 Bytes
Why is it Called an Octet?¶
Each section contains 8 bits.
Example:
Since:
The address contains four octets.
IPv4 in Binary¶
Example:
Binary representation:
Total:
Networking devices process this binary representation internally.
IPv4 Layout¶
+--------+--------+--------+--------+
| Octet1 | Octet2 | Octet3 | Octet4 |
+--------+--------+--------+--------+
8 Bits 8 Bits 8 Bits 8 Bits
Total:
Valid IPv4 Range¶
Each octet can have a decimal value from:
Examples of valid addresses:
Examples of invalid addresses:
Why 0–255?¶
Each octet contains 8 bits.
Maximum binary value:
Decimal equivalent:
Minimum value:
Total Number of IPv4 Addresses¶
Since IPv4 uses 32 bits:
Approximately 4.3 billion unique addresses are available (before accounting for reserved ranges).
Network and Host Portions¶
Every IPv4 address consists of:
- Network Portion
- Host Portion
Example:
Representation:
The network identifies the subnet.
The host identifies the specific device.
Why Split the Address?¶
Suppose:
Every computer belongs to the same network.
Individual hosts:
The network portion remains the same while the host portion changes.
Subnet Mask¶
The Subnet Mask determines which bits belong to:
- Network
- Host
Example:
Binary:
Meaning:
CIDR Notation¶
Instead of writing:
Modern networks use:
Meaning:
CIDR notation simplifies subnet representation.
Example Address¶
This device belongs to the:
network.
Default Gateway¶
A Default Gateway is the router used to reach other networks.
Example:
If the destination is outside the local network, packets are sent to the gateway.
Broadcast Address¶
Every subnet has a broadcast address.
Example:
Broadcast:
Broadcast packets are delivered to every host in the subnet.
Network Address¶
The network address identifies the subnet itself.
Example:
This address is reserved and cannot be assigned to a host.
Host Address¶
Host addresses identify individual devices.
Examples:
Each host must have a unique address within the subnet.
IPv4 Communication Example¶
Suppose:
Laptop:
Server:
Both belong to:
Communication:
No router is required because both devices are on the same network.
Communication Across Networks¶
Suppose:
Laptop:
Website:
Communication:
The router forwards packets to another network.
Viewing IPv4 Information in Linux¶
Display IP addresses.
Display routing table.
Display hostname and IP.
Legacy command.
Production Perspective¶
Every enterprise network uses IPv4 addressing for:
- Servers
- Firewalls
- Routers
- Switch Management
- Cloud Virtual Machines
- Databases
- Kubernetes Nodes
- Storage Systems
Accurate IP planning prevents conflicts and simplifies troubleshooting.
Cloud Perspective¶
Cloud providers assign IPv4 addresses to:
- Virtual Machines
- Load Balancers
- Network Address Translation (NAT) Gateways
- Kubernetes Nodes
- Managed Databases
Private IP addresses are commonly used inside cloud Virtual Private Clouds (VPCs), while public IP addresses are assigned to Internet-facing resources.
Kubernetes Perspective¶
Kubernetes uses IPv4 addresses for:
- Nodes
- Pods
- Services
- Ingress Controllers
Cluster networking depends on proper IP allocation and routing.
Hands-on Lab¶
Task 1¶
Display IPv4 addresses.
Task 2¶
Display the routing table.
Task 3¶
Display assigned IP addresses.
Task 4¶
Write the binary representation of:
Task 5¶
Identify:
- Network Address
- Host Address
- Broadcast Address
for:
Task 6¶
Determine whether the following addresses are valid or invalid:
Task 7¶
Identify the default gateway on your Linux system.
Task 8¶
Draw a network containing:
- Router
- Switch
- Three computers
Assign IPv4 addresses and identify:
- Network
- Hosts
- Gateway
Linux Commands¶
| Command | Purpose |
|---|---|
ip addr | Display IP addresses |
hostname -I | Display assigned IPv4 addresses |
ip route | Display routing table |
ping | Test connectivity |
ip link | Display interfaces |
Common Mistakes¶
❌ Assuming every number is a separate address.
✅ The four octets together form one IPv4 address.
❌ Confusing the network address with a host address.
✅ Network addresses identify the subnet, not individual devices.
❌ Assigning the broadcast address to a host.
✅ Broadcast addresses are reserved.
❌ Ignoring the subnet mask.
✅ Always evaluate an IP address together with its subnet mask.
❌ Forgetting the default gateway.
✅ Devices need a gateway to reach other networks.
Best Practices¶
- Always document IP addressing schemes.
- Use consistent subnet sizes where practical.
- Avoid duplicate IP addresses.
- Reserve static IP addresses for infrastructure devices.
- Verify network and broadcast addresses before assigning hosts.
- Understand both decimal and binary representations.
Interview Questions¶
Beginner¶
- What is an IPv4 address?
- How many bits are in an IPv4 address?
- What is an octet?
- What is the valid range of an IPv4 octet?
Intermediate¶
- Explain the difference between the network and host portions of an IP address.
- What is the purpose of a subnet mask?
- What is the default gateway?
- Why can't the network or broadcast address be assigned to a host?
Architect Level¶
- How would you design an IPv4 addressing scheme for a large enterprise?
- Explain how subnet masks influence routing decisions.
- Why is understanding IPv4 structure essential for cloud networking and Kubernetes?
Summary¶
In this lesson, you learned:
- The structure of an IPv4 address
- Octets and bytes
- Binary representation
- Network and host portions
- Subnet masks
- CIDR notation
- Default gateways
- Network and broadcast addresses
- Linux commands for viewing IPv4 configuration
Understanding the IPv4 address structure is the foundation of subnetting, routing, and enterprise network design. Every IPv4 address combines a network identifier and a host identifier, allowing devices to communicate efficiently across local networks and the Internet.
Key Takeaways¶
- An IPv4 address consists of 32 bits (4 octets).
- Each octet contains 8 bits and ranges from 0 to 255.
- Every IPv4 address contains a network portion and a host portion.
- The subnet mask determines where the network ends and the host begins.
- Routers use IPv4 addresses to forward packets between networks.