Sie sind auf Seite 1von 33

Subnets and Subnet Masks

How to determine Number of Subnets Number of Hosts Subnet Mask

Working With Subnet Masks Is a Simple Process When Broken Down Into Single Steps.
First determine exactly what information you need. If you know how many subnets you have, you will need to know how many hosts are available on each subnet or what subnet mask was assigned. If you know the IP address and subnet mask you may need to figure out how many subnets you will have to work with and how many hosts are on each subnet.

Some important items to know and remember about subnetting.


An IP address contains 4 octets

Each octet contains 8 binary bits


Each bit is part of the network/subnetwork address or host address

Know the default subnet mask for each class of network


The host portion of the address is the only part that can be manipulated

Identify the network and host octets of an IP address


Identify the network and host octets of a subnet mask

Until you get comfortable with subnetting develop a system to follow each time you deal with a subnetting problem.

Learn to do a few basic procedures and how to build on them to solve bigger and more complex problems.

We will start working with a class C address, the default subnet mask for class C is 255.255.255.0. The only octet we can manipulate to create subnets is the 4th octet. Start by making a simple chart to represent the 4th octet of the subnet mask.

128 27

192 64 26

224 32 25

240 16 24

248 8 23

252 4 22

254 2 21

255 1 20

The numbers in each of the above columns relate to one another. When you layout your chart make sure you get the right numbers in each column.
The numbers in the top row represent the numbers you will be assigning to the 4th octet in our subnet mask problem. The middle row of numbers represent each of the 8 binary bits in an octet.

The bottom row of numbers is the powers of 2 or a count of the number of bits used to determine how many subnets or hosts we have on our network. If you dont let them confuse you they will help you with some of the binary math you will be doing.

128 27

192 64 26

224 32 25

240 16 24

248 8 23

252 4 22

254 2 21

255 1 20

There is really nothing to memorize to duplicate the chart. Start with either end of the middle row. If you start with 128, divide each number by 2 to get the next number in line to the right.

128

64

32

16

If you prefer to start with the 1, simply multiply each number by 2, or if it is easier for you to think of it this way, double each number to determine the next number in line to the left.

128

64

32

16

128 27

192 64 26

224 32 25

240 16 24

248 8 23

252 4 22

254 2 21

255 1 20

The bottom row of the chart is the powers of 2 which represent the 8 binary bits of the octet. The numbers in superscript 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 represent the number of subnet bits or host bits. Subnet masks will sometime be referred to as a 2 bit subnet mask, an 8 bit subnet mask, a 19 bit subnet mask or just about any other number of bit subnet mask from 0 to 22. By now you should have read the guidelines for the number of host bits you are able to borrow for subnetting depending on factors such as the class of address that has been assigned.

128 27

192 64 26

224 32 25

240 16 24

248 8 23

252 4 22

254 2 21

255 1 20

In case you need a refresher on the math: Any number to the 0 power equals 1 therefore 20 = 1
Any number to the power of 1 equals that number therefore 21 = 2

22 = 2 X 2 = 4
23 = 2 X 2 X 2 = 8 24 = 2 X 2 X 2 X 2 = 16 25 = 2 X 2 X 2 X 2 X 2 = 32 26 = 2 X 2 X 2 X 2 X 2 X 2 = 64

Keep in mind the superscript number represents the number of bits used for subnetwork (subnet mask) bits or host bits. This should become more clear as you work a few practice problems.

27 = 2 X 2 X 2 X 2 X 2 X 2 X 2 = 128

128 27

192 64 26

224 32 25

240 16 24

248 8 23

252 4 22

254 2 21

255 1 20

The top row of the chart, and 128, represent the numbers you will assign as subnet mask in the appropriate octet depending on the class of address and the number of host bits borrowed for subnetworks. These numbers are easy to determine. Starting from the left, the middle row of numbers is added together to get the top numbers.
128 is the first number used for subnet mask assignment.

128 + 64 = 192

192 + 32 (or 128 + 64 + 32) = 224


240 + 8 = 248 254 + 1 = 255

224 + 16 (or 128 + 64 + 32 + 16) = 240 248 + 4 = 252 252 + 2 = 254

Practice making your chart. After you learn to use the chart you will be able to work out any problems pertaining to figuring the number of subnets you will have, the number of hosts on each subnet, and the subnet mask you need to assign with your IP address to obtain the number of subnets and hosts for your network to operate efficiently. Dont get frustrated if you dont become a subnet mask expert with your first problem. This will only happen with a lot of patience and practice.

There are no shortcuts to figuring subnet masks. The only way to figure them is by using short simple steps that are easily worked and naturally relate to one another.

Class C Address
Lets start with a simple class C address and subnetting problem. The address we will use is 192.156.74.0 We need to devide our network into 2 usable subnetworks with the maximum number of usable hosts on each network. IP Address 192.156.74.0

2 Usable Subnets 62 Usable Hosts each

2 Usable Subnets 192.156.74.64 192.156.74.128

Subnet mask 255.255.255.192

The network IP address we are going to work with is 192.156.74.0. This is going to be divided into 2 usable subnetworks with the maximum number of hosts available on each subnet. Our problem is to figure out what subnet mask will need to be assigned to meet our requirements. The default subnet mask for a class C network is 255.255.255.0. This is represented using binary as:

11111111.11111111.11111111.00000000
The first 3 octets represent the network. All 8 bits are turned on, which is represented by the 1s, and therefore add up to decimal 255 for each octet. We are going to borrow from the host octet to create subnets. When this is done some of the 0s will become 1s with the ones added together giving the decimal equivalent of the binary subnet mask.

Start by creating the octet chart.


128 27
192 64 26 224 32 25 240 16 24 248 8 23 252 4 22 254 2 21 255 1 20

To have 2 usable subnets, a minimum of 4 subnets must be created as two of the 4 that are created cannot be used. You should have read the reason for not using these 2 subnets. If you do not understand the reason for not using them, reread the material or talk to your instructor if further clarification is needed.

This step then becomes a math problem. As 4 subnets are required, the 22 found under the 4 in the middle row tells us that 2 bits must be borrowed to create 4 subnets. Always look to the superscript (22) number to tell how many bits are being used. 22 = 4

11111111.11111111.11111111.00000000 To help keep the process of borrowing bits straight, refer to the subnet mask representation above. The first 3 octets (all 1s) are the portion of the default class C subnet mask that cannot be manipulated. They are the NETWORK ADDRESS octets. To help remember which side of the HOST ADDRESS octet to borrow from just remember you are borrowing bits that will become SUBNETWORKS. In the previous step it was determined that it is necessary to borrow 2 bits (22) to create 4 subnets (2 usable). The SUBNETWORK bits that we borrow will always be next to the NETWORK ADDRESS bits. 11111111.11111111.11111111.

1 1000000

As 2 bits were borrowed for SUBNETWORK addresses this leaves 6 bits (8 2 = 6) available for host bits for the network, giving 22 = 4 subnets and 26 = 64 hosts.

128 27

192 64 26

224 32 25

240 16 24

248 8 23

252 4 22

254 2 21

255 1 20

To determine the subnet mask number to be assigned to the host octet of the default class C subnet mask (255.255.255.0), count two places from the NEWORK ADDRESS side (left) in the top row of the chart above. Doing this determines that the last octet of the subnet mask will
be 192 and the complete subnet mask will be 255.255.255.192. The 128 will not be used in a class C address as a minimum of 2 bits must be borrowed for subnets. It WILL be used in subnet masks assigned to class B and class A addresses.

128 27

192 64 26

224 32 25

240 16 24

248 8 23

252 4 22

254 2 21

255 1 20

11111111.11111111.11111111.11000000
Subnet mask - 255.255.255.192 2 Subnetworks 192.156.74.64 and 192.156.74.128

64 (62 usable) hosts on each network


The original problem was to determine the subnet mask that was required to give 2 usable subnetworks with the maximum number of hosts on each network. The address we were using was 192.156.74.0 but this process would be the same for any class C address and the results would be the identical if presented with the same requirements.

More important information that is derived from the numbers that have been determined so far is the host address range for each subnet.
As 2 bits were borrowed for subnets, that leaves 6 bits for hosts on each of the 2 usable subnetworks (28 22 = 26). The 6 bits remaining represent 64 hosts (26 = 64) on each subnetwork. A range of 0 63 will be used to represent the 64 hosts just as 0 9 would represent 10 items. The number 0 is a place holder just as any other number is. The address ranges for the 4 subnetworks will be: 0 63 64 127 Remember the first and last address ranges cannot be used because they contain either the network address or the network broadcast address.

128 191
192 - 255

This leaves only 2 usable address ranges:


64 to 127 and 128 to 191.

0.63
64.127 128.191 192.255

Subnetting rules tell us there are some addresses that cannot be used as they are either network addresses, network broadcast addresses, subnetwork addresses, or subnetwork broadcast addresses.
In the group of 4 subnets that were created previously, the first and the last cannot be used for the above reasons. That only leaves the ranges between them.

64.127 128.191

Part of the 2 ranges that are left for use cannot be used for the same reasons. The 64 and 128 would represent subnetwork addresses while the 127 and 191 would be the subnetwork broadcast address for their respective subnetwork.
The usable hosts addresses in each range would then be: 65 through 126

and
129 through 190

There is nothing hard about subnetting problems. It is important that you not look at the overall procedure and break it down into single, manageable steps that build on each other. This will keep it from being overwhelming and mind boggling.

The most important thing you can do to make figuring subnet masks, the number of hosts on each subnet and the number of subnets available is to practice. Subnetting is a perfect example of the old saying, If you dont use it, you loose it.

Try working through this practice problem with this presentation. It will be worked one step at a time with the next step not being shown until you click the mouse or press the enter key to signal you are ready for it. Use the class C address 192.63.193.0. Create 4 usable subnets.

How many bits will you need to borrow


What is the Subnet Mask you will assign to the network How many usable hosts will be on each subnet

How many actual hosts will there be on each subnet


What is the Network address and the Network Broadcast address What are the IP address ranges What are the Subnet Ids What is the Broadcasts addresses for each subnet

Start by creating the octet chart.


No cheating, try to create the chart from memory before looking.

192
128 27 64 26

224
32 25

240
16 24

248
8 23

252
4 22

254
2 21

255
1 20

You might want to write out the default subnet mask in binary form. Until you work a few problems and get used to which end to work from it might help you keep everything straight in your mind. 11111111.11111111.11111111.00000000

128 27

192 64 26

224 32 25

240 16 24

248 8 23

252 4 22

254 2 21

255 1 20

11111111.11111111.11111111.00000000 Use the chart and determine how many bits you will have to borrow to create 4 usable subnets. Subnetting rules tell us that to create 4 usable subnets, 8 is the minimum number that must be created. If only 4 were created, and 2 are not used because they are part of either the network or broadcast addresses, only 2 usable subnets would remain. Since 4 usable subnets is our requirement, we must create 8 subnets even if we only use 4 of the 6 usable subnets that will remain available for use. Because of this we must borrow 3 bits to use as subnets.

128 27

192 64 26

224 32 25

240 16 24

248 8 23

252 4 22

254 2 21

255 1 20

11111111.11111111.11111111.00000000 3 bits (23) were borrowed to create 4 usable subnets.

What subnet mask will be assigned to the network?


The 3 bits are borrowed from the left side of the chart starting with 128 and then they are added together (128 + 64 + 32). This gives us the last octet of the subnet mask; 224. The subnet mask is 255.255.255.224. You should try to figure out the answers on your own before going to the next step. Remember practice makes perfect.

128 27

192 64 26

224 32 25

240 16 24

248 8 23

252 4 22

254 2 21

255 1 20

11111111.11111111.11111111.00000000 3 bits borrowed - subnet mask 255.255.255.224

How many hosts will be on each subnet?


Be careful when answering this type of question. Make sure you give the right answer to the question that is being ask. There are two answers that can be given but only one of them will be correct. One is how many actual hosts are on each subnet, the other is how many usable hosts are on each subnet. The correct answer will depend on the perspective of the question you are given.

128 27

192 64 26

224 32 25

240 16 24

248 8 23

252 4 22

254 2 21

255 1 20

11111111.11111111.11111111.00000000 3 bits borrowed - subnet mask 255.255.255.224

How many hosts will be on each subnet?


Simple math is all that is needed to answer this question. If 3 bits were borrowed for subnets that leaves 5 bits for hosts.

Total bits (8) bits borrowed for subnets (3) = bits for hosts (5)
28 23 = 25 25 = 32

128 27

192 64 26

224 32 25

240 16 24

248 8 23

252 4 22

254 2 21

255 1 20

11111111.11111111.11111111.00000000 3 bits borrowed - subnet mask 255.255.255.224

How many hosts will be on each subnet?


There will be 32 IDs in each subnet but only 30 of them will be usable as hosts IDs. The first number in the host range will represent the subnet ID while the last number in each host range will be the broadcast address for that subnet. Remember to be careful about the perspective of the question you are answering, only one of these numbers will be the correct answer.

So far it has been determined that 3 bits are borrowed for subnets. The subnet mask is 255.255.255.224. There are 32 hosts on each subnet with 30 of them actually being used as host addresses. What is the Network address? The network address was given at the first of this exercise. 192.63.193.0 What is the Broadcast address for the network? To broadcast to every host on a network they must first be represented in the host octet of the Network address. They are represented by turning on the bits that represent them. How is this done? All bits that are turned on are represented by 1s in the octet. If all bits are turned on then all bits contain a 1. If all bits in the octet are 1s the broadcast address is 192.63.193.255. It is

So far it has been determined that 3 bits are borrowed for subnets. The subnet mask is 255.255.255.224. There are 32 hosts on each subnet with 30 of them actually being used as host addresses. The network address is 192.63.193.0 and the broadcast address is 192.63.193.255.

What are the IP address ranges for each subnet?


The IP address ranges are determined by the total number of hosts on each subnet. There are 32 hosts on each of the subnets in this exercise. The first IP address range will be 0 31. What are the rest of the IP address ranges? 0 - 31 32 - 63 64 - 95 96 - 127 128 - 159 160 - 191 192 - 223 224 - 255

So far it has been determined that 3 bits are borrowed for subnets. The subnet mask is 255.255.255.224. There are 32 hosts on each subnet with 30 of them actually being used as host addresses. The network address is 192.63.193.0 and the broadcast address is 192.63.193.255.
IP address ranges: 0-31/32-63/64-95/96-127/128-159/160-191/-192-223/224-255

What are the Subnet IDs? Subnet IDs have already been figured, all that is needed is remember what they are and to decide which can be used. Be sure you understand why an address can be used or cannot be used. The first SNID is 192.63.193.32. What are the rest?

SNIDs are the first ID in IP address ranges. The ranges with the network and broadcast addresses cannot be used as subnet IDs.
192.63.193.32 192.63.193.64 192.63.193.96

192.63.193.128

192.63.193.160

192.63.193.192

So far it has been determined that 3 bits are borrowed for subnets. The subnet mask is 255.255.255.224. There are 32 hosts on each subnet with 30 of them actually being used as host addresses. The network address is 192.63.193.0 and the broadcast address is 192.63.193.255.
IP address ranges: 0-31/32-63/64-95/96-127/128-159/160-191/-192-223/224-255

What is the Broadcast address for each subnet? The broadcast addresses have also already been figured. They are the part of the IP address range that represents all 1s. The first subnet broadcast address is 192.63.193.63. What are the rest?

192.63.193.63
192.63.193.159

192.63.193.95
192.63.193.191

192.63.193.127
192.63.193.223

By following a few simple steps, one at a time, all of the questions about network and subnet addresses on the network 192.63.193.0 have been answered. There was nothing hard about it nor were any shortcuts taken. If everything is done one step at a time all the information you need to subnet your network is simple, related steps. Network Address 192.63.193.0 Broadcast Address 192.63.193.255

Subnet mask 255.255.255.224 8 subnets 32/30 hosts on each subnet Subnet IDs and their respective Broadcast IDs 192.63.193.32 192.63.193.96 192.63.193.160 192.63.193.63 192.63.193.127 192.63.193.191 192.63.193.64 192.63.193.128 192.63.193.192 192.63.193.95 192.63.193.159 192.63.193.223

Each of the steps taken will work with any class C address. They will also work with any class B or class A address. The only difference is the number of bits in the host octets that you have available for manipulation. The numbers you work with will get bigger as you work with increasingly larger numbers of subnets and hosts but the procedures are the same for each class of addresses.

The secret to successful subnetting is to take your time, dont get frustrated and practice, practice, practice.