IPv4 Addressing
IPv4 - Addressing Modes and Structure
Section titled “IPv4 - Addressing Modes and Structure”IPv4 utilizes a 32-bit address, typically expressed in dotted-decimal notation (e.g., 192.168.1.1). It supports several addressing modes to facilitate different communication patterns:
Unicast Addressing Mode
Section titled “Unicast Addressing Mode”In unicast mode, data is sent from a single source to a single destination host. The packet’s destination address field contains the unique 32-bit IP address of the target host. This is the most common form of communication, like when your computer requests a webpage from a web server. For example, a client at 192.168.0.10 sends a packet specifically to a server at 203.0.113.45.
Broadcast Addressing Mode
Section titled “Broadcast Addressing Mode”In broadcast mode, a packet is addressed to all hosts on a specific network segment. The destination address field typically contains a special broadcast address. The most common is the limited broadcast address (255.255.255.255), which is received by all hosts on the local network segment. Another type is a directed broadcast (e.g., 192.168.1.255 for the 192.168.1.0/24 network), intended for all hosts on a specific remote network (though often blocked by routers for security). When a host receives a packet with a broadcast address it’s configured to listen for, it processes the packet. This is used by services like DHCP to discover servers.
Multicast Addressing Mode
Section titled “Multicast Addressing Mode”Multicast mode allows a single source to send data to a group of interested recipient hosts simultaneously. It’s a one-to-many approach. The destination address field contains a special multicast group address (from the 224.0.0.0 to 239.255.255.255 range). Hosts must join a multicast group to receive packets sent to that group. This is efficient for applications like streaming video to multiple subscribers or online gaming. For example, a server streams video to the multicast address 239.1.2.3, and only clients subscribed to this group receive the stream.
Every IP network reserves two special addresses: the network address (e.g., 192.168.1.0), which identifies the network itself and cannot be assigned to a host, and the broadcast address (e.g., 192.168.1.255 for a /24 network), which addresses all hosts in that network.
Hierarchical Addressing Scheme
Section titled “Hierarchical Addressing Scheme”IPv4 employs a hierarchical addressing scheme. A 32-bit IP address is logically divided into two main parts: a network portion and a host portion. The network portion identifies the specific network the device belongs to, while the host portion identifies the specific device (host) on that network.
For example, in the IP address 172.16.30.5 with a subnet mask of 255.255.0.0 (or /16), ‘172.16’ could represent the network portion, and ‘30.5’ would represent the host portion. This hierarchy can be extended with subnetting, where the host portion is further divided into a subnet portion and a host portion, allowing for more granular network organization. This structure is essential for efficient routing of packets across the internet.
Subnet Mask
Section titled “Subnet Mask”A subnet mask is a 32-bit number used to distinguish the network portion from the host portion of an IP address. Routers use the subnet mask to determine the network to which an IP address belongs. When an IP address is logically ANDed with its subnet mask, the result is the network address.
Let’s illustrate with an example. IP Address: 192.168.1.152, Subnet Mask: 255.255.255.0.
In binary:
IP Address: 11000000.10101000.00000001.10011000 (192.168.1.152)Subnet Mask: 11111111.11111111.11111111.00000000 (255.255.255.0)-------------------------------------------------------------------- AND OperationNetwork Addr: 11000000.10101000.00000001.00000000 (192.168.1.0)This calculation shows that the network address is 192.168.1.0, and the host is .152 on that network. The subnet mask effectively ‘masks out’ the host portion, revealing the network portion. The number of ‘1’s at the beginning of the subnet mask (when written in binary) determines the size of the network prefix (e.g., 255.255.255.0 has 24 leading ‘1’s, hence a /24 prefix).
Binary Representation of IP Addresses
Section titled “Binary Representation of IP Addresses”Understanding binary is fundamental to IPv4 addressing and subnetting. An IPv4 address consists of 32 bits, divided into four 8-bit segments called octets. Each octet can be converted to a decimal number (0-255).
To convert an octet from binary to decimal, we use positional notation. Each bit position in an octet has a corresponding power of 2, starting from 2^0 on the rightmost bit to 2^7 on the leftmost bit:
Bit Position: 8 7 6 5 4 3 2 1Binary Weight: 2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0Decimal Value: 128 64 32 16 8 4 2 1For example, the binary octet 11000000 is converted as follows:
(1 * 128) + (1 * 64) + (0 * 32) + (0 * 16) + (0 * 8) + (0 * 4) + (0 * 2) + (0 * 1) = 128 + 64 = 192.
Here are some common binary octet patterns and their decimal equivalents:
Binary Pattern | Decimal Value----------------|--------------00000000 | 010000000 | 12811000000 | 192 (128+64)11100000 | 224 (128+64+32)11110000 | 240 (128+64+32+16)11111000 | 248 (128+64+32+16+8)11111100 | 252 (128+64+32+16+8+4)11111110 | 254 (128+64+32+16+8+4+2)11111111 | 255 (128+64+32+16+8+4+2+1)A solid grasp of binary-to-decimal conversion is crucial for subnetting and network troubleshooting.