IPv4 Address Structure
Network and Host Portions
An IPv4 address is a 32-bit hierarchical address that is made up of a network portion and a host portion. When determining the network portion versus the host portion, you must look at the 32-bit stream, as shown in the figure.
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.
The Subnet Mask
As shown in the figure, assigning an IPv4 address to a host requires the following:
- IPv4 address – This is the unique IPv4 address of the host.
- Subnet mask– This is used to identify the network/host portion of the IPv4 address.
IPv4 Configuration on a Windows Computer
Note: A default gateway IPv4 address is required to reach remote networks and DNS server IPv4 addresses are required to translate domain names to IPv4 addresses.
The IPv4 subnet mask is used to differentiate the network portion from the host portion of an IPv4 address. When an IPv4 address is assigned to a device, the subnet mask is used to determine the network address of the device. The network address represents all the devices on the same network.
The next figure displays the 32-bit subnet mask in dotted decimal and binary formats.
Notice how the subnet mask is a consecutive sequence of 1 bits followed by a consecutive sequence of 0 bits.
To identify the network and host portions of an IPv4 address, the subnet mask is compared to the IPv4 address bit for bit, from left to right as shown in the figure.