IP Subnetting
These are tables to help in the understanding and generation of VLSM (Variable Length Subnet Masks) networks and CIDR (Classless Inter Domain Routing) which is what the Internet currently uses to route packets on the Internet Backbone. It makes it possible to represent the millions of networks which form the Internet to be represented by less than 100,000 routes.
Although years ago we couldn't use the "Zero Subnet" now we can, current IP stacks support using this address space. Some devices may have to be configured — Cisco routers for example need the command ip subnet-zero put in and while you are at it do ip classless.
Network Address Ranges by Class
| Class | Range | Default Mask |
|---|---|---|
| Class A | 1–127 | 255.0.0.0 |
| Class B | 128–191 | 255.255.0.0 |
| Class C | 192–223 | 255.255.255.0 |
Maximum Number of Hosts by Class
| Class | Formula | Addresses |
|---|---|---|
| Class A | 2^24 | 16,777,216 |
| Class B | 2^16 | 65,536 |
| Class C | 2^8 | 256 |
Binary Calculations
| 2^0 | 1 | 00000001 |
| 2^1 | 2 | 00000010 |
| 2^2 | 4 | 00000100 |
| 2^3 | 8 | 00001000 |
| 2^4 | 16 | 00010000 |
| 2^5 | 32 | 00100000 |
| 2^6 | 64 | 01000000 |
| 2^7 | 128 | 10000000 |
Subnet Masks — Binary Representations
| Decimal | Binary | Bits |
|---|---|---|
| .192 | 11000000 | 2 bits |
| .224 | 11100000 | 3 bits |
| .240 | 11110000 | 4 bits |
| .248 | 11111000 | 5 bits |
| .252 | 11111100 | 6 bits |
| .254 | 11111110 | 7 bits |
| .255 | 11111111 | 8 bits |
CIDR (Classless Inter Domain Routing) Bits to Mask
This table helps with notation like 192.168.4.4/30
| # Bits | Subnet Mask |
|---|---|
| 8 | 255.0.0.0 |
| 16 | 255.255.0.0 |
| 17 | 255.255.128.0 |
| 18 | 255.255.192.0 |
| 19 | 255.255.224.0 |
| 20 | 255.255.240.0 |
| 21 | 255.255.248.0 |
| 22 | 255.255.252.0 |
| 23 | 255.255.254.0 |
| 24 | 255.255.255.0 |
| 25 | 255.255.255.128 |
| 26 | 255.255.255.192 |
| 27 | 255.255.255.224 |
| 28 | 255.255.255.240 |
| 29 | 255.255.255.248 |
| 30 | 255.255.255.252 |
| 31 | 255.255.255.254 |
| 32 | 255.255.255.255 |
Classful Subnetting Tables
Class B
| # Bits | Subnet Mask | # Subnets | # Hosts |
|---|---|---|---|
| 2 | 255.255.192.0 | 2 | 16,382 |
| 3 | 255.255.224.0 | 6 | 8,190 |
| 4 | 255.255.240.0 | 14 | 4,094 |
| 5 | 255.255.248.0 | 30 | 2,046 |
| 6 | 255.255.252.0 | 62 | 1,022 |
| 7 | 255.255.254.0 | 126 | 510 |
| 8 | 255.255.255.0 | 254 | 254 |
| 9 | 255.255.255.128 | 510 | 126 |
| 10 | 255.255.255.192 | 1,022 | 62 |
| 11 | 255.255.255.224 | 2,046 | 30 |
| 12 | 255.255.255.240 | 4,094 | 14 |
| 13 | 255.255.255.248 | 8,190 | 6 |
| 14 | 255.255.255.252 | 16,382 | 2 |
Class C
| # Bits | Subnet Mask | # Subnets | # Hosts |
|---|---|---|---|
| 24 | 255.255.255.0 | 1 | 254 |
| 25 | 255.255.255.128 | 2 | 126 |
| 26 | 255.255.255.192 | 4 | 62 |
| 27 | 255.255.255.224 | 8 | 30 |
| 28 | 255.255.255.240 | 16 | 14 |
| 29 | 255.255.255.248 | 32 | 6 |
| 30 | 255.255.255.252 | 64 | 2 |
| 31 | 255.255.255.254 | UNUSED | N/A |
| 32 | 255.255.255.255 | 255 | 1 |