Understanding IPv4 Address Structure

Currently, there are still plenty of networks using IPv4 addressing, even as the organizations which use them are making the transition to IPv6. So it is still very important for network administrators to know everything they can about IPv4 addressing. This module covers the fundamental aspects of IPv4 addressing in detail. It includes how to segment a network into subnets and how to create a variable-length subnet mask (VLSM) as part of an overall IPv4 addressing scheme. Subnetting is like cutting a pie into smaller and smaller pieces. Subnetting may seem overwhelming at first, but we show you some tricks to help you along the way. This module includes several videos, activities to help you practice subnetting, Packet Tracers and a lab. Once you get the hang of it, you’ll be on your way to network administration!

Understanding the fundamentals of IPv4 address structure is crucial in networking. In this guide, we’ll delve into various components such as Network and Host Portions, Subnet Mask, Prefix Length, Network Determination using Logical AND operation, and the distinctions between IPv4 Unicast, Broadcast, and Multicast addresses.

Network and Host Portions

In IPv4 addressing, the segmentation of addresses into network and host parts is fundamental. An IPv4 address like 192.168.1.0 is divided into 192.168.1 (the network portion) and 0 (the host portion).

The bits within the network portion of the address must be identical for all devices that reside in the same network. The bits within the host portion of the address must be unique to identify a specific host within a network. If two hosts have the same bit-pattern in the specified network portion of the 32-bit stream, those two hosts will reside in the same network.

But how do hosts know which portion of the 32-bits identifies the network and which identifies the host? That is the role of the subnet mask.

Subnet Mask

The subnet mask, represented like 255.255.255.0, plays a pivotal role in delineating the network and host components within an IP address. The subnet mask uses binary 1s followed by 0s to separate these sections.

# Python example illustrating a subnet mask
subnet_mask = "255.255.255.0"

The Prefix Length

Expressing network addresses and host addresses with the dotted decimal subnet mask address can become cumbersome. Fortunately, there is an alternative method of identifying a subnet mask, a method called the prefix length.

The prefix length defines the number of bits allocated for the network part in an IP address. For instance, in 192.168.1.0/24, the /24 indicates that the initial 24 bits denote the network segment.

Comparing the Subnet Mask and Prefix Length

Subnet Mask32-bit AddressPrefix Length
255.0.0.011111111.00000000.00000000.00000000/8
255.255.0.011111111.11111111.00000000.00000000/16
255.255.255.011111111.11111111.11111111.00000000/24
255.255.255.12811111111.11111111.11111111.10000000/25
255.255.255.19211111111.11111111.11111111.11000000/26
255.255.255.22411111111.11111111.11111111.11100000/27
255.255.255.24011111111.11111111.11111111.11110000/28
255.255.255.24811111111.11111111.11111111.11111000/29
255.255.255.25211111111.11111111.11111111.11111100/30
A network address is also referred to as a prefix or network prefix. Therefore, the prefix length is the number of 1 bits in the subnet mask.

When representing an IPv4 address using a prefix length, the IPv4 address is written followed by the prefix length with no spaces. For example, 192.168.10.10 255.255.255.0 would be written as 192.168.10.10/24. Using various types of prefix lengths will be discussed later. For now, the focus will be on the /24 (i.e. 255.255.255.0) prefix

Harnessing Logical AND

The network address is derived by performing a logical AND operation between an IP address and its corresponding subnet mask.

# Python code demonstrating logical AND operation
ip_address = "192.168.1.10"
subnet_mask = "255.255.255.0"
network_address = ip_address & subnet_mask

A logical AND is one of three Boolean operations used in Boolean or digital logic. The other two are OR and NOT. The AND operation is used in determining the network address.

Logical AND is the comparison of two bits that produce the results shown below. Note how only a 1 AND 1 produces a 1. Any other combination results in a 0.

  • 1 AND 1 = 1
  • 0 AND 1 = 0
  • 1 AND 0 = 0
  • 0 AND 0 = 0

Note: In digital logic, 1 represents True and 0 represents False. When using an AND operation, both input values must be True (1) for the result to be True (1).

To identify the network address of an IPv4 host, the IPv4 address is logically ANDed, bit by bit, with the subnet mask. ANDing between the address and the subnet mask yields the network address.

  • IPv4 host address (192.168.10.10) – The IPv4 address of the host in dotted decimal and binary formats.
  • Subnet mask (255.255.255.0) – The subnet mask of the host in dotted decimal and binary formats.
  • Network address (192.168.10.0) – The logical AND operation between the IPv4 address and subnet mask results in an IPv4 network address shown in dotted decimal and binary formats.

Network, Host, and Broadcast Addresses

  • Network Address: A network address uniquely identifies a specific network within the internet. Any device that belongs to this network must have the same network address. The network address is determined by performing an AND operation between the device’s IPv4 address and the subnet mask. The network address is represented by the all-zeroes in the host portion of the address. This ensures that all devices within the network share a common identifier.
  • Host Address: A host address, also known as a local address, is the address assigned to a specific device within a network. It is used for communication between devices on the same network. The host address is derived from the network address and the subnet mask.
  • Broadcast Address: A broadcast address is an address that is used when it is required to reach all devices on the IPv4 network. As shown in the table, the network broadcast address has all 1 bits in the host portion, as determined by the subnet mask. In this example, the network address is 192.168.10.255/24. A broadcast address cannot be assigned to a device.
Network PortionHost PortionHost Bits
Subnet mask 255.255.255.0 or /24255 255 255
11111111 11111111 11111111
0
00000000
Network address 192.168.10.0 or /24192 168 10
11000000 10101000 00001010
0
00000000
All 0s
First address 192.168.10.1 or /24192 168 10
11000000 10101000 00001010
1
00000001
All 0s and a 1
Last address 192.168.10.254 or /24192 168 10
11000000 10101000 00001010
254
11111110
All 1s and a 0
Broadcast address 192.168.10.255 or /24192 168 10
11000000 10101000 00001010
255
11111111
All 1s

IPv4 Unicast, Broadcast, and Multicast

  • Unicast: Enables communication between a single sender and receiver. A unicast packet has a destination IP address that is a unicast address which goes to a single recipient. A source IP address can only be a unicast address, because the packet can only originate from a single source. This is regardless of whether the destination IP address is a unicast, broadcast or multicast.
  • Broadcast: Sends data to all devices within a specific network segment. A broadcast packet has a destination IP address with all ones (1s) in the host portion, or 32 one (1) bits. IPv4 uses broadcast packets. However, there are no broadcast packets with IPv6. A broadcast packet must be processed by all devices in the same broadcast domain. A broadcast domain identifies all hosts on the same network segment. A broadcast may be directed or limited. A directed broadcast is sent to all hosts on a specific network. For example, a host on the 172.16.4.0/24 network sends a packet to 172.16.4.255. A limited broadcast is sent to 255.255.255.255. By default, routers do not forward broadcasts.
  • Multicast: Distributes data to a group of devices interested in receiving the information. A multicast packet is a packet with a destination IP address that is a multicast address. IPv4 has reserved the 224.0.0.0 to 239.255.255.255 addresses as a multicast range. Hosts that receive particular multicast packets are called multicast clients. The multicast clients use services requested by a client program to subscribe to the multicast group. Each multicast group is represented by a single IPv4 multicast destination address. When an IPv4 host subscribes to a multicast group, the host processes packets addressed to this multicast address, and packets addressed to its uniquely allocated unicast address. Routing protocols such as OSPF use multicast transmissions. For example, routers enabled with OSPF communicate with each other using the reserved OSPF multicast address 224.0.0.5. Only devices enabled with OSPF will process these packets with 224.0.0.5 as the destination IPv4 address. All other devices will ignore these packets.

In conclusion, gaining proficiency in IPv4 address structures empowers networking enthusiasts to navigate and optimize network configurations effectively. A deep understanding of network/host portions, subnet masks, logical AND operations, and address types (unicast, broadcast, multicast) is invaluable in managing intricate networking scenarios.

By assimilating these concepts, one can troubleshoot networking issues efficiently and architect robust and scalable network infrastructures.

Leave a Comment

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

Scroll to Top