Subnet Mask Calculation:
A subnet mask is a 32-bit number that masks an IP address and divides it into network and host portions. It's used to determine which part of an IP address belongs to the network and which part belongs to the host.
The subnet mask is calculated from the CIDR prefix length:
Where:
Explanation: The subnet mask is created by setting the first \( n \) bits to 1 and the remaining bits to 0. This binary value is then converted to dotted decimal notation.
Details: Subnet masks are essential for routing IP packets between different networks, optimizing network performance, and improving security by logically segmenting networks.
Tips: Enter a valid IP address and CIDR prefix length (0-32). The calculator will determine the subnet mask, wildcard mask, network address, broadcast address, and number of available hosts.
Q1: What's the difference between subnet mask and CIDR notation?
A: CIDR notation is a compact representation of the subnet mask (e.g., /24 = 255.255.255.0). Both serve the same purpose of indicating the network portion of an IP address.
Q2: What is a wildcard mask?
A: A wildcard mask is the inverse of the subnet mask and is used in access control lists and routing protocols to match ranges of IP addresses.
Q3: Why do we subtract 2 from the number of hosts?
A: In most cases, we subtract 2 because the network address and broadcast address cannot be assigned to hosts. Exceptions are /31 and /32 networks.
Q4: What is a network address?
A: The network address is the first address in a subnet and identifies the subnet itself. It's obtained by performing a bitwise AND between the IP address and subnet mask.
Q5: What is a broadcast address?
A: The broadcast address is the last address in a subnet and is used to send data to all hosts in the subnet. It's obtained by performing a bitwise OR between the network address and wildcard mask.