Subnet Mask

32-bit number created by setting host bits to all 0s & network bits to all 1s and is used to distinguish between a network address and a host address in IP address.

IP Class Leading Bits Start Address End Address Default Subnet Mask No. of Networks No. of hosts per network Use
A 0xxx 1.0.0.0 126.0.0.0 255.0.0.0 126 16,777,214 Large organizations
B 10xx 128.0.0.0 191.255.0.0 255.255.0.0 16,384 65,534 Medium-sized organizations
C 110x 192.0.0.0 223.255.255.0 255.255.255.0 2,097,152 254 Small organizations
D 1110 224.0.0.0 239.255.255.255 Not applicable N/A N/A Multicast groups
E 1111 240.0.0.0 255.255.255.254 Not applicable N/A N/A Experimental; used for research

Default Subnet Mask

IP Class Leading Bits Network Bits Host Bits Slash Dotted Decimal
A 0 1111111 00000000 00000000 00000000 /8 255.0.0.0
B 10 111111 11111111 00000000 00000000 /16 255.255.0.0
C 110 11111 11111111 11111111 00000000 /24 255.255.255.0
D 1110 Multicast Group ID Multicast Group ID - -
E 1111 - - - -

Despite of having 0 in the leading bits how come 011111111 = 255?

The subnet mask reflects the division between the network and host portions of the address, not the specific values of the bits themselves. So even though the first bit in a Class A address is 0, the subnet mask for Class A is still 255.0.0.0 because all 8 bits of the first octet are used for the network portion.

<aside> 💡 No Subnetting is done -> 10.0.0.0/8 128.0.0.0/16 192.0.0.0/24 (By Default) Subnetting is done -> 10.0.0.0/11 128.0.0.0/12 192.0.0.0/15

</aside>

Subnetting

Subnet x.0.0.0
CIDR /1 /2 /3 /4 /5 /6 /7 /8
Hosts 2,147,483,648 1,073,741,824 536,870,912 268,435,456 134,217,728 67,108,864 33,554,432 16,777,216
Subnet 255.x.0.0 (Class A)
CIDR /9 /10 /11 /12 /13 /14 /15 /16
Hosts 8,388,608 4,194,304 2,097,152 1,048,576 524,288 262,144 131,072 65,536
Subnet 255.255.x.0 (Class B)
CIDR /17 /18 /19 /20 /21 /22 /23 /24
Hosts 32,768 16,384 8,192 4,096 2,048 1,024 512 256
Subnet 255.255.255.x (Class C)
CIDR /25 /26 /27 /28 /29 /30 /31 /32
Hosts 128 64 32 16 8 4 2 1
Subnet Mask (Replace X) 128 192 224 240 248 252 254 255

<aside> 💡 Hosts double with each increment of a CIDR.

</aside>

Always subtract 2 from host total:

CIDR to IPv4 Address Range Utility Tool | IPAddressGuide

Private IP Addresses

Network Class Start Address End Address Network Mask No. of Networks No. of hosts per network
Class A 10.0.0.0 10.255.255.255 255.0.0.0 126 16,646,144
Class B 172.16.0.0 172.31.255.255 255.255.0.0 16,383 65,024
Class C 192.168.0.0 192.168.255.255 255.255.255.0 2,097,151 254
Lookback (Localhost) 127.0.0.0 127.0.0.7 255.255.255.0 - -