IP Subnets
 |
| |
The
solution to our design problem is to divide whatever class of IP address we are
assigned into a number of smaller networks with fewer hosts per network. This is
accomplished by “borrowing” bits from the host portion of our IP address and
using them in the network portion. How do we and, more importantly, how does a
router know how many bits to use for the network and how many to use for the
host? The answer is by using a subnet mask. |
| |
 |
| |
A
subnet mask is a 32-bit binary number that identifies which bits in the address
are used for the host and which bits are used for the network. A one in the mask
identifies the corresponding bit in the IP address as a network bit, and a zero
in the mask identifies the corresponding bit in the IP address as a host bit. A
router accomplishes this operation by performing a bitwise AND operation with
the IP address and the subnet mask. |
| |
 |
| |
0 AND 1 5
0 |
| |
| |
1 AND 0 5
0 1 AND 1 5
1 |
| |
 |
| |
As
an example, consider the IP address/subnet mask pair |
| |
 |
| |
156.26.30.60/255.255.240.0 |
| |
 |
| |
which has the binary representations |
| |
 |
| |
Address |
| |
 |
| |
10111100 |
| |
|
 |
| |
00011010 |
| |
|
 |
| |
00011110 |
| |
|
 |
| |
00111100 |
| |
|
 |
| |
Performing the AND operation yields |
| |
 |
| |
Converting the result to dotted decimal notation yields the network
portion of the IP address |
| |
 |
| |
156.26.16.0 |
| |
 |
| |
One
subnet mask restriction is that the 1 bits in the mask must be contiguous.
Because of this, an alternative representation for the mask is just to indicate
how many 1 bits are in the mask. For example, the IP address/ subnet mask pair
in the previous example can be written as 156.26.30.60/20. The subnet masks for
non-subnetted networks are shown in Figure 2-3. |
| |
 |
| |
Subnet masks never have fewer ones than the masks listed in Figure
2-3. A Class C address, for example, cannot have a subnet mask of 255.255.0.0.
Request for Comment (RFC) 950 first defined the subnetting of IP
addresses and does not allow the use of the all-zeros and all-ones subnet, so we
will initially look at subnetting examples that obey these restrictions. In
later examples, we will see how we can remove these restrictions with the use of
an appropriate routing protocol, such as OSPF. The number of subnet bits cannot
be one because of the restriction in RFC 950 (see Tables 2-4, 2-5, and 2-6). A 1-bit subnet mask would have a value of either zero (all zeros)
or one (all ones) and this is not allowed. |
| |
 |
| |
Number of Subnet bits |
| |
 |
| Subnet Mask |
| |
|
 |
| Number of Subnetworks |
| |
|
 |
| Number of Hosts/Subnet |
| |
|
 |
| Total Number of Hosts |
| |
|
 |
| |
2 |
| |
 |
| 255.192.0.0 |
| |
|
 |
| 0000002 |
| |
|
 |
| 4194302 |
| |
|
 |
| 08388604 |
| |
|
 |
| |
3 |
| |
 |
| 255.224.0.0 |
| |
|
 |
| 0000006 |
| |
|
 |
| 2097150 |
| |
|
 |
| 12582900 |
| |
|
 |
| |
4 |
| |
 |
| 255.240.0.0 |
| |
|
 |
| 0000014 |
| |
|
 |
| 1048574 |
| |
|
 |
| 14680036 |
| |
|
 |
| |
5 |
| |
 |
| 255.248.0.0 |
| |
|
 |
| 0000030 |
| |
|
 |
| 0524286 |
| |
|
 |
| 15728580 |
| |
|
 |
| |
6 |
| |
 |
| 255.252.0.0 |
| |
|
 |
| 0000062 |
| |
|
 |
| 0262142 |
| |
|
 |
| 16252804 |
| |
|
 |
| |
7 |
| |
 |
| 255.254.0.0 |
| |
|
 |
| 0000126 |
| |
|
 |
| 0131070 |
| |
|
 |
| 16514820 |
| |
|
 |
| |
8 |
| |
 |
| 255.255.0.0 |
| |
|
 |
| 0000254 |
| |
|
 |
| 0065534 |
| |
|
 |
| 16645636 |
| |
|
 |
| |
9 |
| |
 |
| 255.255.128.0 |
| |
|
 |
| 0000510 |
| |
|
 |
| 0032766 |
| |
|
 |
| 16710660 |
| |
|
 |
| |
10 |
| |
 |
| 255.255.192.0 |
| |
|
 |
| 0001022 |
| |
|
 |
| 0016382 |
| |
|
 |
| 16742404 |
| |
|
 |
| |
11 |
| |
 |
| 255.255.224.0 |
| |
|
 |
| 0002046 |
| |
|
 |
| 0008190 |
| |
|
 |
| 16756740 |
| |
|
 |
| |
12 |
| |
 |
| 255.255.240.0 |
| |
|
 |
| 0004094 |
| |
|
 |
| 0004094 |
| |
|
 |
| 16760836 |
| |
|
 |
| |
13 |
| |
 |
| 255.255.248.0 |
| |
|
 |
| 0008190 |
| |
|
 |
| 0002046 |
| |
|
 |
| 16756740 |
| |
|
 |
| |
14 |
| |
 |
| 255.255.252.0 |
| |
|
 |
| 0016382 |
| |
|
 |
| 0001022 |
| |
|
 |
| 16742404 |
| |
|
 |
| |
15 |
| |
 |
| 255.255.254.0 |
| |
|
 |
| 0032766 |
| |
|
 |
| 0000510 |
| |
|
 |
| 16710660 |
| |
|
 |
| |
16 |
| |
 |
| 255.255.255.0 |
| |
|
 |
| 0065534 |
| |
|
 |
| 0000254 |
| |
|
 |
| 16645636 |
| |
|
 |
| |
17 |
| |
 |
| 255.255.255.128 |
| |
|
 |
| 0131070 |
| |
|
 |
| 0000126 |
| |
|
 |
| 16514820 |
| |
|
 |
| |
18 |
| |
 |
| 255.255.255.192 |
| |
|
 |
| 0262142 |
| |
|
 |
| 0000062 |
| |
|
 |
| 16252804 |
| |
|
 |
| |
19 |
| |
 |
| 255.255.255.224 |
| |
|
 |
| 0524286 |
| |
|
 |
| 0000030 |
| |
|
 |
| 15728580 |
| |
|
 |
| |
20 |
| |
 |
| 255.255.255.240 |
| |
|
 |
| 1048574 |
| |
|
 |
| 0000014 |
| |
|
 |
| 14680036 |
| |
|
 |
| |
21 |
| |
 |
| 255.255.255.248 |
| |
|
 |
| 2097150 |
| |
|
 |
| 0000006 |
| |
|
 |
| 12582900 |
| |
|
 |
| |
22 |
| |
167 times read
|
Related news
|
| No matching news for this article |
|
Did you enjoy this article?
(total 0 votes)
|
Comments (0 posted)
|
|
More Top News
CCSP-Cisco Certified Security Professional
Most Popular
Most Commented
Featured Author
|
|