I noticed that quite a number of students have problems with subnetting techniques in networking subjects. Hopefully through my examples, the students in LAN and AdvNet would be able to benefit from it. For LAN students, you basically just have to master subnetting using Class B and C addresses. The technique for subnet addressing is generally the same for Class A addresses, it is just that the number of hosts/subnets are greater then B and C.

I will begin using a Class C IP address.

Question : You are to design a set of IP addresses that are subdivided into 2 departments with 50 stations in each department. The network address is given as 200.100.10.0

Provide the following to your design :
1. The class of the IP address, and default network and host ids
2. The subnet mask
3. All the subnet network addresses
4. The exact range of IP addresses used in the above network

[Tip : Sometimes you are not given an IP Address. You are free to choose any address that satisfies the question. Always check that the range in the particular class of address you choose satisfies the required number of subnets and hosts. This is to avoid answering the question halfway and then realizing you have used the wrong class of address and you would need to redo the question.]

Solution :

1. Recall the range of IP addresses in each class.

Class A : 001.xxx.xxx.xxx – 127.xxx.xxx.xxx
Class B : 128.001.xxx.xxx – 191.254.xxx.xxx
Class C : 192.000.001.xxx – 223.255.254.xxx
Class D : 224.000.000.000 – 239.255.255.255

Note : Class D is generally used for multicasting and should not be used as a choice in subnetting.

IP address : 200.100.10.0 -> 11001000.01100100.00001010.00000000.

Recall for Class A : MSB is always 0. Class B = 10x, Class C = 11x, Class D = 111

Hence the class of the IP address 200.100.10.0 = Class C.

2. The default subnet mask for Class C -> 255.255.255.0

Recall that in a subnet mask, the bits in the network id are always ‘1’, and the host ‘0’. The mask tells the router which subnet it is in.

In our design, we are required to provide 2 subnets. Hence, we will need to ‘borrow’ the bits in the host id portion of the address. Remember, in IP addressing, we should never modify the network portion of the address.

Default netmask of Class C address -> 11111111.11111111.11111111.00000000.

We need 2 subnets, hence we will need to convert some of the ‘0’s in the host portion into ‘1’s. To find out how many, we could use 2 common methods.

Method 1 : (log2 2+2) = 2 [In a calculator, you would type log 4/log 2 as a change of base formula
Method 2 : 22 - 2 = 2

Now why am I adding and subtracting 2? Remember, in subnet addressing, all ‘0’s and all ‘1’s are not to be used. The – 2 comes from subtracting the cases of all 0s and all 1s. This is important, please remember this.
Why did I add 2 to Method 1 then? Recall that when you bring a positive number over the equation, it becomes negative. [10+2 = 12, is the same as 10+2-12 = 0] Also, remember if you use the log formulae, and you arrive at an answer with a remainder value, always bring it to the next whole number, regardless what the remainder value is. ie if you get 1.1 or 1.9, always bring it to 2, never back to 1, or you will fall short of the number of subnets required and hence answered the question wrongly.

Now, we have determined we need to change 2 bits to ‘1’ for the subnet mask. (netmask)

Ans : 255.255.255.192 ->11111111.11111111.11111111.11000000

Note : Try to remember, when you are asked for a subnet mask, the address always begins with 255. I used to get confused over this fact. Subnet mask and subnet addresses are 2 different thing, as you would see later.

3. Recall our original IP address is 200.100.10.0

We can only ‘play’ around with the last portion of the addresses, since this is a Class C address. (which makes this easier then subnetting a Class A address. Do you know why?)

The host portion of the IP address ->00000000

Recall we have determined that 2 bits are needed for subnet addressing. How many possible cases are there? Let’s see.

00000000, 01000000, 10000000, 11000000

There are 4 cases, but remember, all ‘0s’ and all ‘1s’ are invalid!!

00000000, 01000000, 10000000, 11000000

When you are asked for subnet addresses (you may be required to list or, or a particular address, make sure you read the question carefully), you are expected to list the address that represents the whole subnet.

Hence in this case, we have 2 subnets, Subnet #1 ->01000000 = 64
Subnet #2 -> 10000000 = 128
Hence, the subnet numbers are 200.100.10.64 and 200.100.10.128

The actual range of IP addresses for subnet #1 begins from 200.100.10.65 – 200.100.10.127. (What is the exact range for subnet 2?)

4. In answering this portion, make sure you read the question carefully on how many hosts are required in each subnet. In the question, there are 50 hosts in each subnet.

Recall in subnet # 1, the subnet number = 200.100.10.64

Hence, the first IP that we be allocated would be the next host.

>First IP address = 200.100.10.65 ->200.100.10.114

Some students may get confused here, is it .114 or .115?

Remember when you are calculating the range, it includes the first IP address. Hence, you would take 65 +49 = 115

Now, try to come up with the solution for Subnet 2 on your own before looking at the answer provided below.

Subnet # 2 : First IP address = 200.100.10.129 – 200.100.10.178

Bonus Question : What is the total number of hosts that can be individually allocated in the whole network? [Answer = 124. Did you get it right?]

By now you should have a clear picture of subnet addressing. Try the following question and double check the answers when you are done. Just reading through the answers is far less effective then a genuine attempt. At least if you get the answer wrong, you would know where you went wrong.

Question : You are to design a set of IP addresses for 6 computer labs. Each lab consists of 100 computers. In your answer, provide the following:

1. The most suitable class of IP addresses
2. The Subnet Mask
3. The subnet address for the 4th subnet
4. The exact range of IP addresses in the 4th subnet
5. The maximum number of hosts possible in the whole network

Solution :

1. Number of bits required for subnetting : 3
Number of bits required for hosts : 7 (Do you know how I arrived at these figures?)

In answering the first part of the question, recall how many bits each class of addresses has for the host id/portion. The network portion remains untouchable. In our solution, we will require 10 bits for subnet addressing. Hence the most suitable class is, Class B. Class B has a maximum of 16 bits for us to play around with. Of course Class A will satisfy our criteria too but since Class B will do, there is no need for addressing using Class A addresses.

2. We have determined that a set of class B addresses will fulfill our requirements. The default subnet mask for a Class B address is 255.255.0.0 (Recall that in the default subnet mask, the network portion is always ‘1’ and the host portion is always ‘0’)

Since we have also determined we will need 10 bits for the subnet addressing, the subnet mask = 255.255.255.192

3. In the question, we are not provided with an IP address, hence we are free to choose any class B IP address of our choice. Let us select 150.150.0.0 (why not 150.0.0.0?) as the IP address assigned to us. The range of subnet addresses range from ‘1’ to ‘6’.

Therefore, the subnet address of subnet 4 = 150.150.128.0
(10010110.10010110.10000000.0)

[ 1002 = 410 ]

4. The exact range begins from the first IP address till the IP address of the last host.

4th Subnet -> First IP = 150.150.128.1 (10000000.00000001)
Last host IP = 150.150.128.99

5. The maximum number of hosts in the whole network =/ 6x100 = 600 hosts!!

The word maximum, tells us we have to take everything into account. We have allocated 3 bits for subnetting, which will give us a maximum of 6 subnets. We have given 7 bits for host allocation, which gives us a maximum of 128 hosts. Hence the max = 128 x 6 = 768.

I would highly recommend that all students read the question carefully, since they could ask a question on the maximum number of hosts in ONE subnet, etc.

So, how well have you done? I hope that everyone would be able to follow the logical flow in answering such questions. Next, we will look at subnetting using a Class A IP address. LAN students would probably not be tested on this range of IP addresses (but don’t take my word for it!) The technique is the same as the other classes, and is a good Class of IP address to practice with.

Given an a network address of 20.0.0.0, show how you can divide 2000 hosts in each of the 37 segments required. Also describe how a limited AND a direct broadcast can be executed from segment 2 to segment 3.

Solution : First of all there are 2 basic ways to approach. You can first cater for 2000 hosts, then for the 37 segments, or vice versa. You may get a different answer from the above 2 ways but they are still correct. Try it, you may email me for the solution, or check with your lecturer/tutor. Practice makes perfect!

For the second part of the question, a limited broadcast (Adv Networking students) always has an IP Address 255.255.255.255. The router sees this address as an invalid address and will not forward/send the datagram out of the segment, hence you will be doing a broadcast within the subnet itself. A direct broadcast gets more interesting.

For 37 subnets, we will need 6 bits. Hence,

Subnet 2 : 20.8.0.0 (00010100.00001000.0.0)
Subnet 3 : 20.12.0.0 (00010100.00001100.0.0_

Recall a direct broadcast sets all host portion of the IP Address to all ‘1’s, hence
To send from subnet 2 to 3, subnet 2 must do a broadcast address of 20.15.255.255 (00010100.00001111.11111111.11111111)

Here’s a little homework for you. If you were asked, what kind of equipment is necessary to make the above connection, would it be a router, a switch, a gateway or a bridge? Think about it. Feel free to check the answer with me, or your lecturer.

Hope the above explanation helps. Please let me know if I should elaborate on a certain area. For more info try http://www.learntosubnet.com/

Good luck!!