Definition
Internet Protocol Version 4
Internet Protocol Version 4 (IPv4) is a version of the Internet Protocol that identifies interfaces and routes packets using a -bit address.
An IPv4 address is usually written as four decimal octets, such as
192.168.10.34. In CIDR notation,192.168.10.34/24means that the first bits form the network prefix and the remaining bits form the host part.
Address Structure
An IPv4 address has bits, divided into four -bit octets.
For a prefix length :
A subnet mask is a -bit mask with leading ones followed by zeros. The mask separates the address into two parts:
- the network portion, where the corresponding mask bit is ;
- the host portion, where the corresponding mask bit is .
The network address is obtained by bitwise AND of the address and the subnet mask.
Subnetting
Subnetting
Subnetting divides one IPv4 address range into smaller ranges called subnets.
This reduces broadcast domains, supports more precise routing, and allows security rules such as access lists to be applied to smaller parts of a network.
To find subnet boundaries by octet arithmetic, choose the lowest octet that still contains host addresses. Its cumulative bit boundary is
The subnet block increment in this octet is
This increment gives the step between adjacent subnet boundaries in the boundary octet.
Addresses
Network Address
The network address is the first address in a subnet. It is the address where every host bit is .
Broadcast Address
The broadcast address is the last address in a subnet. It is the address where every host bit is .
For an ordinary IPv4 subnet with prefix length , the number of usable host addresses is
The subtraction removes the network address and the broadcast address. Prefixes /31 and /32 are special cases and do not follow this ordinary host-count rule.
Example
Subnet Calculation
Consider
192.168.10.34/27.The prefix length is , so there are host bits and addresses in the subnet.
Since , the boundary is , and the block increment is
The subnet boundaries in the last octet are
0,32,64, and so on. The address192.168.10.34lies in the subnet192.168.10.32/27.
- network address:
192.168.10.32- broadcast address:
192.168.10.63- usable host range:
192.168.10.33to192.168.10.62- usable hosts: