Subnetting Mathematics: IP Address Structure and Binary Masking
An IPv4 address consists of 32 bits divided into four 8-bit octets. Subnetting is the mathematical process of dividing a single physical network into smaller logical sub-networks. The boundary between the network portion and the host portion of the address is defined by the subnet mask.
To find the network address, the router performs a bitwise logical AND operation between the IP address and the subnet mask: Network Address = IP ∧ Mask. For example, an IP of 192.168.1.50 with a mask of 255.255.255.0 results in a network address of 192.168.1.0. The host portion bits are set to all zeros for the network address and all ones for the broadcast address: Broadcast Address = Network Address ∨ ¬Mask.