Address Classes
There are 5 different address classes. You can determine which class any IP address is in by examining the first 4 bits of the IP address.
- Class A addresses begin with 0xxx, or 1 to 126 decimal.
- Class B addresses begin with 10xx, or 128 to 191 decimal.
- Class C addresses begin with 110x, or 192 to 223 decimal.
- Class D addresses begin with 1110, or 224 to 239 decimal.
- Class E addresses begin with 1111, or 240 to 254 decimal.
Addresses beginning with
01111111, or
127 decimal, are reserved for loopback and for internal testing on a local machine; [You can test this: you should always be able to ping
127.0.0.1, which points to yourself] Class D addresses are reserved for multicasting; Class E addresses are reserved for future use. They should not be used for host addresses.
Now we can see how the Class determines, by default, which part of the IP address belongs to the network (N, in blue) and which part belongs to the node (n, in red).
- Class A -- NNNNNNNN.nnnnnnnn.nnnnnnnn.nnnnnnnn
- Class B -- NNNNNNNN.NNNNNNNN.nnnnnnnn.nnnnnnnn
- Class C -- NNNNNNNN.NNNNNNNN.NNNNNNNN.nnnnnnnn
Private Subnets
There are three IP network addresses reserved for private networks. The addresses are
10.0.0.0, Subnet Mask 255.0.0.0,
172.16.0.0, Subnet Mask 255.240.0.0, and
192.168.0.0, Subnet Mask 255.255.0.0. These addresses are also notated
10.0.0.0/8,
172.16.0.0/12, and
192.168.0.0/16. They can be used by anyone setting up internal IP networks, such as a lab or home LAN behind a NAT or proxy server or a router. It is always safe to use these because routers on the Internet by default will never forward packets coming from these addresses.
Subnet Masking
Node addresses of all "0"s and all "1"s are reserved for specifying the local network (when a host does not know its network address) and all hosts on the network (broadcast address), respectively.
To calculate the number of subnets or nodes, use the formula (2
n-2) where n = number of bits in either field, and 2
n represents 2 raised to the nth power.
Example:
11111111.
11111111.
11100000.
00000000 255.
255.
224.
000 Subnet Mask
In this example a
3 bit subnet mask was used. There are 6 (2
3-2) subnets available with this size mask (remember that subnets with all 0's and all 1's are not allowed). Each subnet has 8190 (2
13-2) nodes. Each subnet can have nodes assigned to any address between the Subnet address and the Broadcast address.
# bits | Subnet Mask | CIDR | # Subnets | # Hosts | Nets * Hosts |
2 | 255.192.0.0 | /10 | 2 | 4194302 | 8388604 |
3 | 255.224.0.0 | /11 | 6 | 2097150 | 12582900 |
4 | 255.240.0.0 | /12 | 14 | 1048574 | 14680036 |
5 | 255.248.0.0 | /13 | 30 | 524286 | 15728580 |
6 | 255.252.0.0 | /14 | 62 | 262142 | 16252804 |
7 | 255.254.0.0 | /15 | 126 | 131070 | 16514820 |
8 | 255.255.0.0 | /16 | 254 | 65534 | 16645636 |
9 | 255.255.128.0 | /17 | 510 | 32766 | 16710660 |
10 | 255.255.192.0 | /18 | 1022 | 16382 | 16742404 |
11 | 255.255.224.0 | /19 | 2046 | 8190 | 16756740 |
12 | 255.255.240.0 | /20 | 4094 | 4094 | 16760836 |
13 | 255.255.248.0 | /21 | 8190 | 2046 | 16756740 |
14 | 255.255.252.0 | /22 | 16382 | 1022 | 16742404 |
15 | 255.255.254.0 | /23 | 32766 | 510 | 16710660 |
16 | 255.255.255.0 | /24 | 65534 | 254 | 16645636 |
17 | 255.255.255.128 | /25 | 131070 | 126 | 16514820 |
18 | 255.255.255.192 | /26 | 262142 | 62 | 16252804 |
19 | 255.255.255.224 | /27 | 524286 | 30 | 15728580 |
20 | 255.255.255.240 | /28 | 1048574 | 14 | 14680036 |
21 | 255.255.255.248 | /29 | 2097150 | 6 | 12582900 |
22 | 255.255.255.252 | /30 | 4194302 | 2 | 8388604 |