IP Subnet Masking

Revised October 8, 2005

What could be simpler?

Questions? Comments?
E-mail: AL "at" CatSpace "dot" com


If you're not up to speed on binary math, you're going to have a tough time with these problems. I recommend the "Binary-Decimal-Hexadecimal" review exercises.

Your solutions may not look exactly like mine. For some subnetting problems, there may be multiple correct solutions (especially when future growth is considered). The important thing is that you understand and can apply the principles involved. See RFC 950 (Subnet Masking) for additional information.


EXERCISES:

1. Your workstation's IP address is 201.252.203.107, and you are using 255.255.255.248 for a subnet mask. What is the IP address of your subnet? What is the broadcast address of your subnet? What is the range of legal host addresses on your subnet?

2. If your workstation's IP address is 200.210.220.230, with a 255.255.255.0 subnet mask, which subnet is your host on? What is the broadcast address of your subnet? How many hosts can you have on your subnet?

3. You have just been given the IP network address 195.76.8.0, and you need four subnets, each supporting a minimum of forty PC's. What is the class of your network? What subnet mask(s) will accomplish the goal? What are your four subnets? What is the broadcast address for each of your subnets? What is the range of legal host addresses for each of your subnets?

4. A router's TokenRing2 interface has an IP address of 219.220.150.33/28. When the router builds its routing table, what will be the directly-connected subnet corresponding to this interface? What is the broadcast address for this subnet? How many clients can be present on that subnet? How many subnets are available on this network?

5. A server's IP host address is 173.240.250.60/16. What is the IP address of its subnet? What is the broadcast address of its subnet?

6. Your company's IP network address is 220.193.19.0, and you currently have 187 Ethernet hosts on the network. You have just received word that the company will be adding an additional 90 employees, each requiring a workstation with an IP host address, over the next six months. Will you need to subnet? If so, what mask will you use, and what are the subnet addresses?

7. Your IP host address is 206.23.56.4/28. Based on this address and mask, how many legal IP host addresses are available on your subnet? On your entire network?

8. Comrade Network Engineer, the Chernobyl nuclear-electric generating station has five nuclear reactors (that have not, as of yet, melted down). In each reactor, seventeen independently addressable Control Rod Drive Mechanisms move seventeen zirconium-clad hafnium control rods (one rod per CRDM), to control the average reactor coolant temperature. Given that Chernobyl Power & Light has an assigned IP network address of 199.28.7.0, if each reactor needs its own subnet, and each CRDM requires its own IP host address, what subnet mask(s) will meet CP&L's requirements? Based on your recommendation for a subnet mask, what is the SCRAM (emergency shutdown) IP broadcast address for each reactor, comrade?

9. A router has four interfaces, E0, To0, To1 and S0. Interface E0 has an IP address of 207.29.4.61/27. Can we assign interface To0 an IP address of 207.29.4.195/27? If so, can we give interface To1 the IP address 207.29.4.196/27? Can we assign interface S0 the IP address 207.29.4.121/26? In all cases, if not, why not?

10. Given any class C network, and a subnet mask of 255.255.255.254, how many usable subnets are available? How many usable host addresses are available on each subnet?

11. You have been assigned IP network address 183.56.0.0, and you need 645 subnets, each supporting fourteen DEC (Compaq) Alpha workstations. What subnet mask(s) will satisfy the requirements?

12. Given the IP network address 148.25.0.0, what subnet mask(s) will provide for a minimum of 100 subnets, each supporting at least 200 PC's? Using the subnet mask of your choice, what are the subnet addresses, the ranges of host addresses for each subnet, and the broadcast addresses of your subnets?

13. Given network address 148.202.0.0/17, how many usable subnets are available? How many usable host addresses are available on each subnet?

14. A company with an IP network address of 173.95.0.0 has just retained your services in the area of network design. They have seven divisions running token ring, and each division is located in a different geographical area. The seven areas are mesh-connected by 56 kbps WAN links. Two of the divisions have twenty to thirty hosts each, and the remaining divisions have between forty and fifty hosts each. If each division requires its own subnet, what subnet mask(s) will satisfy the requirements? Based on your choice of subnet mask, what is the maximum number of hosts that a division can have, and how many divisions are possible on the network?

15. ACME Widgets, Incorporated, whose Ethernet network's IP address was 162.53.0.0, has just merged with the AJAX-Dipthong Company, which had a Token Ring network using an IP address of 216.1.7.0 prior to the merger. The new corporation will be known as ACME-Dipthong. As the newly-minted CIO of A-D, you'd like to consolidate your address space. Since your combined enterprise has a total of 400 Ethernet and 100 Token Ring devices, each needing an IP address, which network address should the new ACME-Dipthong use? Do you need to subnet your network? If so, what subnet mask will you use?

16. Exponential Growth, Inc., has an IP network address of 145.94.0.0/28, with 47 subnets. The maximum number of hosts they have on any one subnet is eleven. They plan to double the number of hosts per subnet by the year 2010, and they are worried about running out of IP addresses. They just called you in to analyze their IP network. Can you help them?

17. If your company is using network 10.0.0.0 with a subnet mask of 255.255.192.0, how many subnets can you have? How many hosts per subnet? How many total hosts? Is this more or less than the number of total hosts you could have if you were using the default subnet mask? If you want to connect to the public Internet, what will you have to do?

18. Assume that the Army's IP network address is 11.0.0.0, that a battalion owns twenty IP-addressable items of equipment, and that each piece of equipment requires an IP host address. Each battalion has its own subnet, and there are 200,000 battalions. What subnet mask(s) will accomplish the mission? Dis-missed!

19. A manageable hub has an IP address of 217.225.73.41/28. If the hub sends an IP broadcast to its own subnet, what destination and source IP addresses will it use? If it sends a directed broadcast to the subnet containing IP host address 6.42.89.184/13, what destination IP address will it place in the packet?

20. Given the following host addresses and subnet masks, find each subnet and its range of host addresses:

  a. 209.86.254.114/28
  b. 223.16.38.101/27
  c. 192.63.83.105/26
  d. 134.72.29.55/20
  e. 176.17.123.209/30
  f. 205.195.23.95/24
  g. 25.0.0.99/29
  h. 10.15.17.22/13

21. Given the following networks, numbers of subnets, and hosts per subnet, specify all possible subnet masks in both dotted-decimal and CIDR notation:

       Network    Subnets  Hosts/Subnet
     -----------  -------  ------------
  a. 194.26.84.0       5        20
  b. 206.99.1.0        3        15
  c. 206.14.72.0       2       115
  d. 137.10.0.0      100       200
  e. 172.16.0.0      105        66
  f. 198.25.82.0      60         2
  g. 64.0.0.0       2000       300
  h. 187.53.0.0      515       290


ANSWERS:

1. In this problem, we are given a host address 201.252.203.107 and subnet mask of 255.255.255.248, and asked to find:

We'll do it in binary first (the long way, to see how it works behind the scenes), and then using some shortcuts later (faster and easier, after a little practice) ...

First, convert the host address and subnet mask from dotted-decimal to binary:

201.252.203.107 -> 11001001 11111100 11001011 01101011
255.255.255.248 -> 11111111 11111111 11111111 11111000
Next, do the bitwise-AND:
201.252.203.107 -> 11001001 11111100 11001011 01101011
255.255.255.248 -> 11111111 11111111 11111111 11111000
                   -------- -------- -------- --------
Subnet (binary) -> 11001001 11111100 11001011 01101000

Remember that to do a "bitwise-AND", you do a column-by-column Boolean (logical) "AND" operation, for which the truth table is:

M | A | S
---------
0 | 0 | 0
0 | 1 | 0
1 | 0 | 0
1 | 1 | 1
where "M" is the mask bit, "A" is the address bit, and "S" is the resulting subnet bit for each column (thus "M AND A = S"). For those of you who consider yourselves mathematicians (as opposed to logicians), you can think of the bitwise-AND as a column-by-column multiplication, in which you multiply the mask bit by the address bit to get the subnet bit for that column (and therefore "M x A = S"):
M x A = S
---------
0 x 0 = 0
0 x 1 = 0
1 x 0 = 0
1 x 1 = 1
Either approach gives the same answers. Next, convert the resulting binary subnet address to dotted-decimal (just add up the values of the columns in each byte using the "128-64-32-16-8-4-2-1" progression):
Subnet (binary) -> 11001001 11111100 11001011 01101000
Subnet (decimal)->    201      252      203      104
This tells us that our host lives on subnet 201.252.203.104/29

A reminder: "CIDR notation" (also known as "slash" or "bit-count" notation) is an efficient way of representing subnet masks. The number after the slash specifies the number of "ones" in the subnet mask. Remember that in a legal subnet mask, the "ones" are always on the left (in other words, the ones in the mask form a "contiguous" string). For example, a subnet mask of "255.0.0.0" can be represented as "/8", "255.255.0.0" as "/16", and "255.255.255.0" as "/24". By the same logic, "255.255.255.224" is "/27", "255.255.255.248" is "/29", "255.255.192.0" is "/18", etc. For more details on CIDR, please refer to What is CIDR?

To find the directed-broadcast address for this subnet, first locate the host bits in the subnet mask (the host bits are the bits that are set to "zero" in the subnet mask). In our example, this would be the right-most three bits:

Mask   (binary) -> 11111111 11111111 11111111 11111000
                                                   ^^^
Now set all of the bits in the subnet's host portion to "one":
Subnet (binary) -> 11001001 11111100 11001011 01101000 (start with this)
                   -------- -------- -------- -----xxx (x marks the spot - the last three bits)
B-cast (binary) -> 11001001 11111100 11001011 01101111 (changed the three right-most bits from zero to one)
And then convert to decimal:
B-cast (binary) -> 11001001 11111100 11001011 01101111
B-cast (decimal)->    201      252      203     111
We obtain 201.252.203.111, the directed-broadcast address for this subnet.

Finally, find the range of host addresses on this subnet. This is simply the range of addresses that lies between the subnet and directed-broadcast address. In this case, that would be 201.252.203.105 through 201.252.203.110, inclusive. In binary, the patterns would be:

Subnet (binary) -> 11001001 11111100 11001011 01101000 (201.252.203.104)
                   -------- -------- -------- -------- -----------------
Hosts (binary)  => 11001001 11111100 11001011 01101001 (201.252.203.105)
                => 11001001 11111100 11001011 01101010 (201.252.203.106)
                => 11001001 11111100 11001011 01101011 (201.252.203.107)
                => 11001001 11111100 11001011 01101100 (201.252.203.108)
                => 11001001 11111100 11001011 01101101 (201.252.203.109)
                => 11001001 11111100 11001011 01101110 (201.252.203.110)
                   -------- -------- -------- -------- -----------------
B-cast (binary) -> 11001001 11111100 11001011 01101111 (201.252.203.111)
Note that the original host address of 201.252.203.107 does in fact lie within that range ... and it's a good thing! If not, it's a dead giveaway that we made a mistake somewhere (so consider this a "sanity-check"). Note also that the range of 105-110 is six addresses, which is just what we would expect given three host bits (three bits gives eight possible combinations, and you can't use the subnet and broadcast addresses).

Wow! What a struggle! Don't worry, though ... there are some shortcuts that get us the same results with a lot less work (and therefore less chance of making a mistake). First off, we can make the process more efficient (and less error-prone) by only doing the binary math in the "interesting" octet (the octet where the subnet mask is neither all-zeros nor all-ones). In the octets where the mask is "all-ones", the address information comes through unchanged (and in any octets where the mask is "all-zeros", the address information is set to zero). Using the previous example, only the fourth octet is "interesting", so why bother doing the binary in the first three?

Host   -> 201.252.203.107
Mask   -> 255.255.255.248
          --- --- --- ---
Subnet -> 201.252.203.??? (only the fourth octet is "interesting")

Now let's look at the fourth octet (where the action is). To find the subnet, convert the host address and subnet mask to binary, do the bitwise-AND, then convert back to decimal:

Host   -> 01101011 (107)
Mask   -> 11111000 (248)
          --------
Subnet -> 01101000 (104)
Hence, the subnet on which the host resides is 201.252.203.104/29.

To get the broadcast address, take the subnet (in binary) and set the host portion to ones ...

Subnet -> 01101000 (104)
Mask   -> 11111000 (248)
          -----xxx (The host portion is the last three bits)
B-cast -> 01101111 (111)
The broadcast address for the 201.252.203.104/29 subnet is 201.252.203.111, and the range of legal host addresses is everything in between: 201.252.203.105 through 201.252.203.110.

Now let's pull out all the stops, and do it using just shortcuts. Since the mask is 255.255.255.248 (that is, "/29"), there are three host bits. In this case, the subnets increment by eight. Why? You can get it from the mask, where the last octet is 248, and the subnets increment by 256 (a magic number) minus the mask in that octet (248). Likewise, since the mask is a "/29", there are three host bits, and the subnets increment by two to the third power (the number of host bits). Thus, the subnets are 201.252.203.0/29, 201.252.203.8/29, 201.252.203.16/29, etc (that is, they increment by eight). Another handy shortcut is that the last subnet is always the same as the mask in the octet of interest. Therefore, since the subnetting is happening in the fourth octet, and the mask in that octet is "248", the last subnet is 201.252.203.248/29.

The address is 201.252.203.107, which is between 104 and 112, and is therefore on the 201.252.203.104/29 subnet. Since the subnet itself is "104", the first legal host on that subnet is "105" (one more than the subnet). Since the next subnet is "112", the broadcast address for the 104 subnet is 111 (one less than the next subnet), and the last legal host on the 104 subnet is 110 (two less than the next subnet). In other words, the range of legal host addresses is always one more than the subnet to two less than the next subnet.

Pulling it all together, given an address of 201.252.203.107 and a mask of 255.255.255.248, we can immediately see that the increment is 8. A little calculation reveals that the subnet is 201.252.203.104, and the next subnet is 201.252.203.112. Thus, the broadcast address is 201.252.203.111, and the range is 201.252.203.105-110.


2. As in the previous problem, to find the subnet, we can do a bitwise-AND operation using the host address and the subnet mask:

200.210.220.230 -> 11001000 11010010 11011100 11100110 (host address)
255.255.255.0   -> 11111111 11111111 11111111 00000000 (subnet mask)
                   -------- -------- -------- --------
Subnet (binary) -> 11001000 11010010 11011100 00000000
Subnet (decimal)->    200     210       220       0
But ... we could have saved ourselves a lot of binary busywork by noting that the mask consists of 255's and 0's, and gone directly to the subnet by inspection:
Host   -> 200.210.220.230
Mask   -> 255.255.255.0
          --- --- --- ---
Subnet -> 200.210.220.0
Thus, the subnet is 200.210.220.0/24. Another approach is to note that the first octet of our host address is "200", so we are on a class C network. Since the default subnet mask for a class C network is 255.255.255.0 (or "/24"), which happens to be the subnet mask we are using (in other words, we aren't subnetting), we can determine by inspection that our "subnet" is 200.210.220.0/24 (the same as the network).

To find the broadcast address, set all the host bits to ones. Since all bits in the last octet are host bits, we can find the broadcast address for this subnet by setting all bits in the fourth octet to ones:

                   |------- network --------| |-host-|
Mask   (binary) -> 11111111 11111111 11111111 00000000
Subnet (binary) -> 11001000 11010010 11011100 00000000
                   -------- -------- -------- xxxxxxxx (x marks the spot!)
B-cast (binary) -> 11001000 11010010 11011100 11111111
This gives 200.210.220.255 as the result (remember that when dealing with an entire octet, setting all bits to one yields a decimal equivalent of 255). Therefore, 200.210.220.255 is the broadcast address.

The range of hosts, as always, is everything in between the subnet and broadcast address, which in this case is 200.210.220.1 through 254.


3. Network 195.76.8.0 is a class "C", and we need four subnets, with forty hosts per subnet. To determine the subnet mask, we need to find the number of subnet bits and host bits required. Let's find the number of host bits needed, per the following table:

  Number of | Legal hosts
  Host Bits | per subnet
  -----------------------
       2    |      2
       3    |      6
       4    |     14
       5    |     30
       6    |     62
       7    |    126
       8    |    254
In the case of forty hosts, we need at least six host bits (which will allow up to sixty-two hosts per subnet). Where did the table come from? Remember that the number of hosts is always given by taking two to the power of the number of host bits, and then subtracting two (because you can't use the subnet and broadcast addresses). Similarly, to find the number of subnet bits required, use this table (note that the tables are *not* the same):
   Number of  | Number of 
  Subnet Bits |  subnets
  -----------------------
        1     |     2
        2     |     4
        3     |     8
        4     |    16
        5     |    32
        6     |    64
        7     |   128
        8     |   256
In our case, since we need four subnets, we require two subnet bits. Where did this table come from? When dealing with binary, the number of combinations is always "two-to-the-n" (two-to-the-second is four, two-to-the-third is eight, etc).

By the way, some people are under the (mistaken) impression that we cannot use two of the subnets, the "all-zeros" and "all-ones", and that, for example, using two bits of subnetting yields only two subnets. While it is true when calculating the number of hosts on a subnet that you have to subtract two, this restriction does not apply to calculating the number of subnets (the subnet bits are not in the same place as the host bits). To quote RFC 1812 (Requirements for IP Version 4 Routers):

  Previous versions of this document also noted that subnet numbers
  must be neither 0 nor -1, and must be at least two bits in length.
  In a CIDR world, the subnet number is clearly an extension of the
  network prefix and cannot be interpreted without the remainder of
  the prefix. This restriction of subnet numbers is therefore
  meaningless in view of CIDR and may be safely ignored.
Note that "-1" is computer scientist lingo for "all one's". We now turn our attention to RFC 1878 (Variable Length Subnet Table For IPv4):
  " ... using calculations which exclude all-zeros and all-ones subnets ...
  This practice is obsolete! Modern software will be able to utilize all
  definable networks."
By "networks" they mean "logical networks" (that is, subnets). Note that both of these RFC's are dated 1995! The bottom line is that we lose two host addresses per subnet ("all-zeros" and "all-ones"), not two subnets per classful network. On a Cisco, by the way, you have to enable "ip subnet-zero" in order to give an interface an address on a "zero" subnet ("ip subnet-zero" from global config mode). This has been on by default since the introduction of IOS version 12 in September 1998.

If we add the number of network, subnet and host bits required, there are three possibilities:

If it totals less than 32, then you get to decide where to put the extra bit(s) ... more subnets, more hosts per subnet, or (sometimes) both. If it totals exactly 32, then you have no flexibility. If it totals more than 32, then you can't solve the problem with standard subnet masking (and you have to resort to some enhanced form of trickery). Remember: it has to add up to 32!

In our case, if we add the number of network bits (24, because we're using a class "C" network), subnet (2, calculated by us) and host bits (6, also calculated by us), we get the magic number of 32 (the number of bits in an IPv4 address). Now, since there are two subnet bits, our subnet mask is equal to the default mask for a class "C" (a "/24"), plus two more bits, as follows:

NNNNNNNN NNNNNNNN NNNNNNNN SSHHHHHH
11111111 11111111 11111111 11000000
Where: Since there are 26 ones in the mask (count 'em and see!), we can represent this in "CIDR notation" as "/26". To get the dotted-decimal equivalent, just convert each octet of the mask to decimal:
Mask (binary)  -> 11111111 11111111 11111111 11000000
Mask (decimal) ->   255      255      255       192
Hence the mask is 255.255.255.192 in dotted-decimal (which is the same as "/26").

Back to the matter at hand. In this case, since the number of network, subnet and host bits adds up to thirty-two (the magic number!), we're ready to proceed. We have six host bits in the fourth octet, and the least-significant subnet bit occurs in the 64's position of the fourth octet (remember, it's 128-64-32-16-8-4-2-1). This means that our subnets increment by 64, and therefore they are 195.76.8.0/26, 195.76.8.64/26, 195.76.8.128/26, and 195.76.8.192/26.

There are several interesting things to note about this. First, there are four subnets, exactly what we would expect with two bits of subnetting (our "/26" mask is two bits beyond the default of "/24" for a class "C" network), since two to the second power is four. Second, there are 62 hosts available on each subnet, again what we would expect based on six host bits (remember, you can't use two of the addresses). Third, the number of network bits (24), subnet bits (2) and host bits (6) adds up to 32. Fourth, since we're doing the subnetting in the fourth octet, the fourth octet of the last subnet (195.76.8.192) is equal to the fourth octet of the subnet mask (255.255.255.192). Fifth, the subnets increment by 64, which is 256 minus the value of the fourth octet of the mask (192). Sixth, a "/26" mask means that there are 6 host bits (32 minus 26 is 6), and two to the sixth power is 64 (the increment). Thus, knowing the mask allows us to easily calculate how the subnets increment, which we can exploit to solve "find the subnet" problems more easily.


4. This is a class C address. Since the subnet mask specified is "/28", we have four bits of host portion in the fourth octet, and our subnets increment by sixteen. The subnets are 219.220.150.0, 219.220.150.16, 219.220.150.32 ... 219.220.150.240/28 (remember that a "/28" mask is the same as a 255.255.255.240, and the last subnet is the same as the mask in the octet of interest). Since 33 falls in between 32 and 48, the subnet to which this host belongs is 219.220.150.32. We could also determine this (the hard way) by doing a bitwise-AND of the host address and the subnet mask (but why we would, I can't imagine). The network to which this host belongs is class C network 219.220.150.0. The broadcast address for the subnet is 219.220.150.47. Since the addresses on the subnet range from 219.220.150.32 through 219.220.150.47, and two of those are reserved (32 for the subnet, 47 for broadcast), that leaves fourteen hosts (33 to 46). Also, assuming that one of those host addresses is used by a router interface, there can actually only be a maximum of thirteen other IP-addressed devices (be they Macintoshes or whatever) on the subnet (and one of those might be a manageable hub or switch). Finally, since we are using four bits of subnetting, we can have a maximum of sixteen subnets.


5. 173.240.250.60 is on a class B network, and since it has been specified as "/16", we are using the default subnet mask of 255.255.0.0,or "/16". Thus, by inspection (or by bitwise-AND), we can determine that the subnet address is 173.240.0.0/16. To determine the IP broadcast address, set all bits of the host portion to "one", which gives 173.240.255.255.


6. The address of 220.193.19.0 tells us that we have a class C network. That means that the first three octets are fixed. Since you currently have 187 hosts, and you need to add 90 more, you are in trouble. Why? Because 187 plus 90 is 277, and a class C network can only support a maximum of 254 hosts. Looks like you need to obtain an additional class C address (or use some magic that we discuss in the advanced classes). Until then, you are stuck.


7. Using a "/28" subnet, we have four bits of host portion, and the host rule tells us we have fourteen hosts per subnet. We also have four subnet bits, which means sixteen subnets. Thus, we can have a total of 224 hosts (14 times 16) on the entire network.


8. We know that 199.28.7.0 is a class C address. Therefore, we have only the fourth octet to divide between subnet and host portions. Since we need five subnets, we require a minimum of three bits in the subnet portion. Likewise, because we need seventeen host addresses on each subnet, we need a minimum of five bits in the host portion. Fortunately for those people still living in the area near Chernobyl, that is a total of eight bits, which just happens to be the number we have available. Using three bits for the subnet portion provides a maximum of eight subnets, which would allow us to add another three reactors to the complex (a good thing?). Using five bits for the host portion provides for a maximum of thirty hosts per subnet, which allows us to add more control rods per reactor (a good thing!). The subnet mask will be 255.255.255.224, or "/27", and the broadcast addresses are 199.28.7.31, 199.28.7.63, ... 199.28.7.223 and 199.28.7.255.


9. With a class C address, "/27" means three bits of subnetting, and five bits of host, all in the fourth octet. Therefore, the subnets increment by 32. A little calculation reveals that interface E0, with a host address of 207.29.4.61, is on the 207.29.4.32 subnet. Since 207.29.4.195 is on the 207.29.4.192 subnet, we can indeed assign To0 an IP address of 207.29.4.195/27. If we do that, however, the router will not allow us to assign any of its other ports to the 207.29.4.192 subnet (which has a range of 193 to 222), so we couldn't assign interface To1 an IP address of 207.29.4.196. Besides, why would you want to do that? Fault-tolerance? If you lose one port, it's probably because the router died (Token Ring has limited built-in fault-tolerance). If you need a backup, buy a second router, and have a second route.

Since we have defined the subnet mask for the 207.29.4.0 class C network to be "/27", we can't use a mask of "/26" with that network. While the router will let you do it, routing won't work unless you're using VLSM (Variable-Length Subnet Masking, which we learn in the advanced classes), which is not supported by RIP-1 and IGRP. As far as we're concerned, assigning 207.29.4.121/26 to S0 is not allowed.


10. As an example, let's pick class C network 205.194.7.0. Using a subnet mask of 255.255.255.254 will provide us with seven subnet bits, and one host bit. By the subnet rule, this gives us 128 possible subnets, but the host rule says that one host bit gives us zero usable host addresses. Why? Because with one bit, you only have two choices: 0 and 1. Remember that a host portion of "all-zeros" denotes the subnet, and a host portion of "all-ones" is the broadcast for the subnet, so this leaves nothing usable for the hosts. But, since broadcasts are unnecessary on point-to-point links, an exception is made for them. See RFC 3021 for details on the use of "/31" masks.


11. Given the class B address of 183.56.0.0, we have sixteen bits fixed, and sixteen to work with. Since we need 645 subnets, the subnet rule tells us we need ten bits of subnetting, which would allow for 1024 subnets. We also need fourteen host addresses, and another address for the router port. This makes fifteen, and any manageable hubs or switches will also need an address, as well as any Jet-Direct-type print servers or other addressable devices. This is a total of fifteen (or more) hosts per subnet, so we need at least five bits for the host portion. With five bits of host portion, we can have up to 30 hosts (including the router) per subnet. Since ten (subnet bits) plus five (host bits) is only fifteen, and we have sixteen bits to work with, we can either allow for more subnets (twice as many, which is 2048), or for more hosts per subnet (up to 62). Which we choose to do depends on what we plan to do with our network in the future. We might want to allow for more hosts per subnet, so we would choose ten bits of subnetting, and six bits for the host portion, which allows us to have 1024 subnets, each with 62 hosts. This would require a subnet mask of 255.255.255.192, or "/26". On the other hand, we may want to have more, smaller subnetworks, so we might choose to limit the number of hosts to 30, and raise the number of subnets to 2048, using a subnet mask of 255.255.255.224, or "/27".


12. Since we have the class B network 148.25.0.0, the first two octets are fixed, leaving us sixteen bits to work with. To provide 100 subnets, the subnet rule says that we need to have seven bits for the subnet portion of the address, which will allow for 128 subnets. In order to have 200 hosts, we need to have eight bits for the host portion, which allows for 254 hosts. Since we only need a total of 15 bits (seven for the subnet, and eight for the host), we have some flexibility here. The subnet masks that work are 255.255.254.0, or "/23", and 255.255.255.0, or "/24". For the "/23" subnet mask, the subnet addresses run 148.25.0.0/23, 148.25.2.0/23, ... 148.25.254.0/23. The range of host addresses for the 148.25.6.0/23 subnet is 148.25.6.1 through 148.25.7.254, and its broadcast address is 148.25.7.255. Other subnets, host ranges and broadcast addresses using the "/23" mask are similarly numbered. For the "/24" subnet mask, the subnet addresses are 148.25.0.0/24, 148.25.1.0/24, ... 148.25.254.0/24. As usual, the last subnet is the same as the subnet mask, but this time we're dealing with the third octet. The range of host addresses for the 148.25.6.0/24 subnet is 148.25.6.1 through 148.25.6.254, and its broadcast address is 148.25.6.255. Other subnets, host ranges, and broadcast addresses using the "/24" mask are similarly numbered. Note that, despite the 255.255.255.0 subnet mask, this remains a class B network.


13. This is a class B network, so we have sixteen bits to work with. The subnet mask was specified as "/17", or 255.255.128.0, which tells us that we have 1 bit of subnetting, and two subnets (the subnets increment by 128 in the third octet). We also have fifteen bits of host portion, which allows for a maximum of 32,766 hosts per subnet.


14. Our client has a class B network, so the first two octets are fixed, leaving us sixteen bits (two octets) to work with. Since we need to provide at least seven subnets, we need at least three bits of subnetting. If we look closely at the problem, however, we notice that we have seven sites connected in a mesh (each site is connected to every other) by WAN links. Assuming that each WAN link needs a subnet address, we need an additional 21 subnets, for a total of 28. This means that we really need (at least) five bits of subnetting, and that will only allow us to get up to 32 usable subnets.

Adding divisions means more subnets, for the divisions and for the links. We had probably better look at six or seven bits of subnetting. Seven bits of subnetting would support sixteen divisions connected in a full-mesh topology (which is probably unrealistic). Using a partial mesh would allow for a greater number of divisions. If we use seven bits for the subnet, then we have nine bits for the host portion, and each subnet could support 510 hosts, which is more than enough.

Another option is to use "IP unnumbered" on WAN links, which would greatly reduce the number of subnets we need (or, conversely, greatly increase the number of subnets available for divisions). If we do this, we can't "Ping" the WAN interfaces. If we go with seven bits for the subnet portion, we have a subnet mask of 255.255.254.0, or "/23", which allows us to have 128 subnets.

On the other hand, if we reduce the number of subnets needed for the WAN links (by modifying the mesh topology, using "IP-unnumbered", or both), we might get by with four bits of subnetting, leaving twelve bits for the host portion. This allows for 4,094 hosts per subnet, and gives us a subnet mask of 255.255.240.0, or "/20". We now see that we have a range for our subnet mask of "/20" through "/23" depending our choice of WAN topology, and whether or not we use "IP-unnumbered" on any or all of the WAN links.


15. Due to the fact that you have over 254 hosts, you can't use a single class C network. This leaves you with the choice of using the existing class B network address of 162.53.0.0, or of trading the class B in on several additional class C's, which would be used along with your existing 216.1.7.0. Since you only have about 500 nodes, a class B network is a real address-waster, but you'd really need at least three class C's to meet your needs. Assuming you do the Internet-correct thing, and trade in your class B, you now have three class C's to work with. A reasonable plan might be to place the Token Ring hosts on one class C, and split the Ethernet hosts between the other two class C's. You might split the class C's into subnets, to further partition the networks, for traffic management or security purposes. What subnet masks will you use? "It depends".

Now let's assume that you are an address hog, and have decided to keep the class B network. Since Ethernet and Token Ring can't co-exist on the same network media, you are going to have to partition the network into at least two subnets (or do translational bridging, which you don't want to do!). To provide two subnets on a class B network requires a subnet mask of 255.255.128.0 (aka "/17"), which allows over 32,000 hosts per subnet. You would probably want on the order of a few hundred hosts per subnet, maximum. If, for the sake of argument, we say 254 hosts per subnet, then you need eight bits for the host portion, leaving eight bits for the subnet portion, which means 256 subnets. You've got lots of room to grow ... but you've wasted over 65,000 IP addresses. No doubt you also drive a gas-guzzler!


16. With a class B address, even a company named "Exponential Growth" should have plenty of room to grow, assuming they do their subnet masking correctly. Using a subnet mask of "/28" (255.255.255.224), they are currently set up for twelve bits of subnetting, and four bits of host address. This gives them 4,096 subnets (of which they are currently using only 47), but with a maximum of only 14 hosts per subnet (and they are already at 11 in some places). Perhaps they might be better served by adjusting their subnet mask to allow for more hosts per subnet, at the expense of fewer subnets. Assuming that their appetite for bandwidth is also exponential, we might want to limit them to 126 (switched Fast Ethernet!) hosts per subnet. This requires seven host bits, leaving nine subnet bits, which still allows for up to 512 subnets. Their "new and improved" subnet mask will be 255.255.255.128, or "/25".


17. The network 10.0.0.0 is class A, so the first octet is fixed. Therefore, the subnet mask of 255.255.192.0 specifies that we are using all of the second octet and two bits of the third octet for subnetting (a total of ten bits of subnetting). This leaves six bits in the third octet, and all bits in the fourth octet, for a total of fourteen bits in the host portion. With ten bits of subnetting, we can have a maximum of 1,024 subnets. With fourteen bits in the host portion, we can have a maximum of 16,382 hosts per subnet, and thus a total of 16,775,168 hosts on the network. If we were using the default class A subnet mask of 255.0.0.0 (or "/8"), we would have 24 bits in the host portion, for a total of 16,777,214 possible hosts. Subnetting costs us 2046 host addresses, but gains us the ability to segregate the network into multiple broadcast domains. In order to attach our network to the public Internet, we would have to either obtain a registered IP address or use Network Address Translation.


18. Since we have a class A network, the first byte is fixed. That leaves us with 24 bits for the subnet and host portions of the address. Each of the twenty pieces of equipment requires a host address, for a total of 21 host addresses (counting the router port) per subnet. In order to have 21 host addresses, we need to set aside five bits for the host portion of the address. By the host rule, this will actually allow us 30 host addresses per subnet. That leaves us with nineteen bits for the subnet portion. By the subnet rule, using nineteen bits, we can have a total of 524,288 possible subnets. Since we have only 200,000 battalions, we need only 200,000 subnets, so we have a choice to make. We can use nineteen bits of subnetting, supporting 524,288 subnets, each with 30 hosts. This results in a subnet mask of 255.255.255.224, or "/27". Alternatively, we could use 18 bits of subnetting, which allows us 262,142 subnets, each with 62 hosts. In this case, the subnet mask is 255.255.255.192, or "/26". Either subnet mask will meet the stated requirements.


19. When a host sends a broadcast to its own subnet, it uses its own address (in this case 217.255.73.41) as the source address, and 255.255.255.255 (local broadcast) as the destination address.

A host with an address of 6.42.89.184/13 is on a class A network, and a subnet mask of "/13" on a class A network specifies five bits of subnetting (all in the second octet). This leaves nineteen bits of host address, three of which will be in the second octet, with the remaining sixteen host bits in the third and fourth octets. Since we have three bits of host address in the second octet, the subnet addresses will increment by eight, in the second octet. Therefore, the subnets will be 6.0.0.0, 6.8.0.0, 6.16.0.0, ... 6.240.0.0, 6.248.0.0/13. Host 6.42.89.184 is on the 6.40.0.0/13 subnet. The directed-broadcast address for this subnet is 6.47.255.255 (don't forget to set the three host bits in the second octet to "1"). Hence, the directed broadcast will have a destination address of 6.47.255.255. Any host wanting to send a directed broadcast to this subnet will send it to 6.47.255.255, and when the router that borders this subnet receives the directed broadcast, it will send out a local broadcast to 255.255.255.255.


20. The subnets and their host address ranges are:

  a. Subnet: 209.86.254.112/28 (the increment is 16, in the fourth octet), Host Range: 209.86.254.113 to 209.86.254.126
  b. Subnet: 223.16.38.96/27 (increment of 32, fourth octet), Host Range: 223.16.38.97 to 223.16.38.126
  c. Subnet: 192.63.83.64/26 (increment 64, fourth octet), Host Range: 192.63.83.65 to 192.63.83.126
  d. Subnet: 134.72.16.0/20 (increment 16, third octet), Host Range: 134.72.16.1 to 134.72.31.254
  e. Subnet: 176.17.123.208/30 (increment 4, fourth octet), Host Range: 176.17.123.209 to 176.17.123.210
  f. Subnet: 205.195.23.0/24 (default mask, not subnetted), Host Range: 205.195.23.1 to 205.195.23.254
  g. Subnet: 25.0.0.96/29 (increment 8, fourth octet), Host Range: 25.0.0.97 to 25.0.0.102
  h. Subnet: 10.8.0.0/13 (increment 8, second octet), Host Range: 10.8.0.1 to 10.15.255.254


21. The required subnet masks are:

  a. 255.255.255.224 or /27
  b. Two possible solutions:
     255.255.255.192 or /26
     255.255.255.224 or /27
  c. 255.255.255.128 or /25
  d. Two possible solutions:
     255.255.254.0 or /23
     255.255.255.0 or /24
  e. Three possible solutions:
     255.255.254.0 or /23
     255.255.255.0 or /24
     255.255.255.128 or /25
  f. 255.255.255.252 or /30
  g. Five possible solutions:
     255.255.224.0 or /19
     255.255.240.0 or /20
     255.255.248.0 or /21
     255.255.252.0 or /22
     255.255.254.0 or /23
  h. Cannot be done.


Return to the top of this Exercise!

Return to the directory of Goodies!


Copyright © 2005 Alchemy, Inc. All rights reserved.