An IP address is a unique identifier for a device on a network. It is written in IPv4 as
four octets (8 bits each), e.g., 192.168.1.5. Each octet ranges from 0 to 255.
A subnet divides a network into smaller segments to organize and optimize traffic. The subnet is represented
with a subnet mask or /prefix (CIDR notation).
Example: 192.168.1.5/24 → /24 means the first 24 bits are the network portion, leaving 8 bits
for hosts.
Given IP/Subnet, you can calculate:
Convert the prefix length to 32-bit mask:
Perform a bitwise AND between IP and subnet mask. Example:
IP : 192.168.1.5 → 11000000.10101000.00000001.00000101 Mask : 255.255.255.0 → 11111111.11111111.11111111.00000000 Bitwise AND: ----------------------------------- Network: 192.168.1.0 → 11000000.10101000.00000001.00000000
Wildcard mask = Inverse of subnet mask. Example:
255.255.255.0 → 0.0.0.255
Set all host bits to 1. Example /24:
Network: 192.168.1.0 → Broadcast: 192.168.1.255
Back to Subnet Trainer.