Class |
Possible networks |
Default mask |
Hosts |
Possible networks |
A |
1.0.0.0-126.0.0.0 |
255.0.0.0 |
224 – 2 = 16777214 |
125 (10. private/127. loopback) |
B |
128.X.0.0-191.x.0.0 |
255.255.0.0 |
216 – 2 = 65534 |
16K (172.16. private) |
C |
192.x.x.0-223.x.x.0 |
255.255.255.0 |
28 – 2 = 254 |
2 millions (192.168.x private) |
D |
224.x.x.0-239.x.x.0 |
255.255.255.240 |
– |
– |
E |
240.x.x.0-255.x.x.0 |
255.255.255.240 |
– |
– |
Class |
Network vs Host |
High order bits |
CIDR notation |
First octet in decimal |
|||
A |
N |
H |
H |
H |
0 |
/8 |
1-126 |
B |
N |
N |
H |
H |
10 |
/16 |
128-191 |
C |
N |
N |
N |
H |
110 |
/24 |
192-223 |
D |
for multicast groups |
1110 |
/28 |
224-239 |
|||
E |
for research |
1111 |
/28 |
240-255 |
IP address class |
RFC 1918 Internal Address Range |
Class A |
10.0.0.0 to 10.255.255.255 |
Class B |
172.16.0.0 to 172.31.255.255 |
Class C |
192.168.0.0 to 192.168.255.255 |
Subnetting
Decimal notation of first octet |
No. of Subnets |
Class A hosts per subnet |
Class B hosts per subnet |
Class C hosts per subnet |
.192 |
2 |
4,194,302 |
16,382 |
62 |
.224 |
6 |
2,097,150 |
8,190 |
30 |
.240 |
14 |
1,048,574 |
4,096 |
14 |
.248 |
30 |
524,286 |
2,046 |
6 |
.252 |
62 |
262,142 |
1,022 |
2 |
.254 |
126 |
131,070 |
510 |
– |
.255 |
254 |
65,534 |
254 |
– |
When we subnet, we borrow bits from the host part to create sub-networks.
Example: We have a class C class of addresses, and we want to divide it in at least 4 subnets.
First rule of subnetting: we must borrow at least two bits, but as well at least two bits must remain.
255.255.255.0 -> 11111111.11111111.11111111.|00000000
| = imaginary line that divides network portion from host portion of the address
Since we wanted 4 subnets, we need at least 3 bits (1 + 2 + 4 = 8). The new subnet will look like the following:
11111111.11111111.11111111.111|00000 -> 255.255.255.224 (128+64+32=224) or /27
Second rule of subnetting: number of usable subnets is 2 at the power of borrowed bits, minus 2.
23 = 8 – 2 = 6 number of usable subnets
Third rule of subnetting: number of usable hosts in every subnet is 2 at the power of remaining bits, minus 2.
25 = 32 – 2 = 30 number of usable hosts for every subnet.
Finding the subnets – fourth rule of subnetting: decimal value of the last bit borrowed = increment of the network address in the subnets table.
We can now fill the subnets table.
Subnet number |
Network address |
Hosts range |
Broadcast address |
Usable? |
0 |
.0 |
.1 – .30 |
.31 |
N |
1 |
.32 |
.33 – .62 |
.63 |
Y |
2 |
.64 |
.65 – .94 |
.95 |
Y |
3 |
.96 |
.97 – .126 |
.127 |
Y |
4 |
.128 |
.127 – .158 |
.159 |
Y |
5 |
.160 |
.161 – .190 |
.191 |
Y |
6 |
.192 |
.193 – .222 |
.223 |
Y |
7 |
.224 |
.225 – .254 |
.255 |
N |
First and last subnets are not usable.
Cheat sheet – to create class B and C subnets quickly
Bit values |
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
Masks |
128 |
192 |
224 |
240 |
248 |
252 |
254 |
255 |
CIDR class B |
/17 |
/18 |
/19 |
/20 |
/21 |
/22 |
/23 |
/24 |
CIDR class C |
/25 |
/26 |
/27 |
/28 |
/29 |
/30 |
/31 |
/32 |
IP’s subnet zero |
2 |
4 |
8 |
16 |
32 |
64 |
128 |
256 |
IP’s subnet non-zero |
0 |
2 |
6 |
14 |
30 |
62 |
126 |
254 |
CIDR class B |
/25 |
/26 |
/27 |
/28 |
/29 |
/30 |
/31 |
/32 |
IP’s subnet zero |
512 |
1024 |
2048 |
4096 |
8192 |
16384 |
32768 |
65536 |
IP’s subnet non-zero |
510 |
1022 |
2046 |
4094 |
8190 |
16382 |
32766 |
65534 |
To reproduce before the exam!!!
Network calculation cheat sheet
Increments |
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
|
CIDR |
/17 |
/18 |
/19 |
/20 |
/21 |
/22 |
/23 |
/24 |
/25 |
/26 |
/27 |
/28 |
/29 |
/30 |
/31 |
/32 |
|
Masks |
128 |
192 |
224 |
240 |
248 |
252 |
254 |
255 |
128 |
192 |
224 |
240 |
248 |
252 |
254 |
255 |
|
B subnets |
2 |
4 |
8 |
16 |
32 |
64 |
128 |
256 |
512 |
1024 |
2048 |
4096 |
8192 |
16384 |
32768 |
65536 |
|
C subnets |
– |
– |
– |
– |
– |
– |
– |
– |
2 |
4 |
8 |
16 |
32 |
64 |
128 |
256 |
|
Hosts |
32768 |
16384 |
8192 |
4096 |
2048 |
1024 |
512 |
256 |
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
Remove 2 from subnets and hosts when zero based is not allowed (always not allowed, unless explicitly stated otherwise).
Classes
A |
0 |
1 – 126 |
B |
10 |
128 – 191 |
C |
110 |
192 – 223 |
D |
1110 |
224 – 239 |
E |
11110 |
240 – 255 |
Private addresses
10.x.x.x
172.16-31.x.x
192.168.x.x
HEX conversion table
Also useful to calculate /28 and /27 subnets
1 |
16 |
1 |
0001 |
2 |
32 |
2 |
0010 |
3 |
48 |
3 |
0011 |
4 |
64 |
4 |
0100 |
5 |
80 |
5 |
0101 |
6 |
96 |
6 |
0110 |
7 |
112 |
7 |
0111 |
8 |
128 |
8 |
1000 |
9 |
144 |
9 |
1001 |
A |
160 |
10 |
1010 |
B |
176 |
11 |
1011 |
C |
192 |
12 |
1100 |
D |
208 |
13 |
1101 |
E |
224 |
14 |
1110 |
F |
240 |
15 |
1111 |