IPv4 Addressing Explained
Key Concepts
- IPv4 Address Structure
- Subnet Mask
- Public vs. Private IP Addresses
- Classful Addressing
- Classless Inter-Domain Routing (CIDR)
IPv4 Address Structure
An IPv4 address is a 32-bit number typically represented in dotted-decimal format, consisting of four octets separated by dots. Each octet can range from 0 to 255. For example, the IP address 192.168.1.1 is composed of four octets: 192, 168, 1, and 1.
Example: Think of an IPv4 address as a street address for a house. Just as a street address uniquely identifies a house, an IPv4 address uniquely identifies a device on a network.
Subnet Mask
A subnet mask is used to divide an IP address into network and host portions. It is a 32-bit number that masks the IP address, determining which part of the IP address identifies the network and which part identifies the host. Common subnet masks include 255.255.255.0 (for a /24 network) and 255.255.0.0 (for a /16 network).
Example: Consider a subnet mask as a boundary marker in a city. Just as a boundary marker separates different neighborhoods, a subnet mask separates different network segments within an IP address.
Public vs. Private IP Addresses
Public IP addresses are globally unique and assigned to devices by Internet Service Providers (ISPs). They are used for communication over the internet. Private IP addresses, on the other hand, are reserved for internal networks and are not routable over the internet. Common private IP address ranges include 192.168.x.x, 172.16.x.x to 172.31.x.x, and 10.x.x.x.
Example: Imagine public IP addresses as phone numbers that can be dialed from anywhere in the world, while private IP addresses are like extension numbers within an office building, only reachable within the building.
Classful Addressing
Classful addressing is an older method of IP address allocation that divides IP addresses into classes (A, B, C, D, and E). Each class has a predefined range of IP addresses and a default subnet mask. Class A addresses are suitable for large networks, Class B for medium-sized networks, and Class C for small networks.
Example: Think of classful addressing as different-sized containers for storing items. Just as a large container is suitable for storing many items, a Class A address is suitable for a large network with many devices.
Classless Inter-Domain Routing (CIDR)
CIDR is a more flexible method of IP address allocation that allows for variable-length subnet masks (VLSM). It replaces the older classful addressing system and is represented by an IP address followed by a slash and a number indicating the number of bits in the subnet mask (e.g., 192.168.1.0/24).
Example: Consider CIDR as a customizable container for storing items. Just as you can adjust the size of a container to fit the number of items, you can adjust the subnet mask in CIDR to fit the number of devices in a network.