The best way of learning subnetting is to do it. Here are a selection of worked examples to help you get started.

At the end are some links to online quizes so you can do it yourself.

**29.0.0.0**. You need to create at least 20 networks and each network will support a maximum of 160 hosts. Would the following two subnet masks Work?

**255.255.0.0** and or **255.255.255.0**

Yes both would work.

Mask **255.255.0.0** has 8 bits for the subnet and 16 bits for the host

8 bits would accommodate 2^{8}=256 subnets

16 bits would accommodate 2^{16}= over 64000 hosts

Mask 255.255.255.0 has 16 bits for the subnet and 8 bits of the host.

Have possible 2^{8} -2 hosts =254 which is enough

Easiest is to sub net on a byte boundary which would mean a subnet mask of **255.255.255.0**

This would allocate **8 bits** for the **subnet** and** 8 bits** for the **host.**

We need to accommodate around 200 hosts which requires 8 bits which we have.

We need 4 subnets which require 4 bits and we have 8 bits. So we have more than enough.

Decimal 192 =11000000 binary which means that 2 bits of this octet are used for the subnet. Now add the 24 bits 255.255.255 and we have 26 bits. So we write:

222.1.1.20/26

Decimal 248 =11111000 binary which means that 5 bits of this octet are used for the subnet. Now add the 16 bits 255.255. and we have 21 bits. So we write:

135..1.1.25/21

A class C address has 8 bits of the host which will give 2^{8} -2 =254 hosts

Current mask= 255.255.255.0

Bits needs for 10 subnets =4 =2^{4} =16 possible subnets

Bits needs for 12 hosts = 4 = 2^{4} = 16-2=14 possible hosts.

So our mask in binary =**11110000**= **240** decimal

Final Mask =**255.255.255.240**

What is the subnet mask for the maximum number of hosts?

How many hosts can each subnet have?

What is the IP address of host 3 on subnet 2 ?

Current mask= 255.255.255.0

Bits needs for 30 subnets =5 =2^{5} =32 possible subnets

Bits left for hosts = 3 = 2^{3} = 8-2=6 possible hosts.

So our mask in binary =**11111000**= **248** decimal

Final Mask =**255.255.255.248**

Address of host 3 on subnet 2 is

subnet 2 =00010000 host 3 =000000011

Add the two together =00010011=19

therefore IP address of host 3 on subnet 2 =205.11.2.19

What are the two possible subnet masks?

Current mask= 255.255.255.0

Bits needs for 48 hosts = 6 = 2^{6} = 64-2=62 possible hosts.

Bits needs for 2 subnets =1 =2^{1} =2 possible subnets

Total of 7 bits needed so therefore we can use either 1 bit or 2 bits for the subnet. So we could have

1 bit subnet 7 bits hosts or 2 bits subnet 6 bit host

masks are 10000000 and 11000000 =128 decimal and 192 decimal.

Final possible masks are:

**255.255.255.128** and **255.255.255.192**

**255.255.255.192**What is the host address and subnet of the following IP address 197.1.2.67.

192 in binary =11000000 gives 4 possible subnets of (showing 2 most significant bits):

00,01,10,11

67 in binary =01000011

So Applying Mask:

**Videos**

**Related Tutorials and Resources:**

- binary numbers for beginners tutorial
- IPv4 Addresses and Classes
- Subnets and subnet Masking explained.
- IPv6 Guide

### Subnet Quizzes

Test you knowledge using these online quizzes

Hi Steve, thanks for producing this tutorial.

In question 9 – is this assuming a Class C network? E.g. if it were a Class B network with subnet mask of 255.255.255.192 then there would be 10 bits for the subnets rather than 2.

Yes it is a class C address

Four valid subnets are to be created in a class B IP address 129.22.0.0.

Calculate the required Subnet mask and fill in the table below.

The answer “therefore IP address of host 3 on subnet 2 =205.11.2.19” of question 7 is wrong and by the way the question is wrong, because if you calculate the ip address of 2nd host pf 3rd subnet then you will get the answer as 205.11.2.19…….

And if we go according to question the real ans should be 204.11.2.11……

Correct me if I’m wrong!

The answer is correct.

The first sub network address is 00001xxx =decimal 8 and the second is 00010xxx =decimal 16

rgds

steve

is there any one who can explain the 9th example? i am not getting that ans .

What answer do you get

rgds

steve

Very useful exercises 😉 but I have a question about exercise 6: Shouldn’t it be 255.255.255.248 instead of 255.255.255.240? Because if we choose the last one we will get more than the 12 hosts.

Hi

the answer is correct as 248 would only give us 8 hosts (3 bits) and we need at least 12.

Yes but since it is typed “10 subnets each with a maximum 12 hosts on each subnet.” and 8 is smaller than 12 I assume 255.255.255.248 is the correct answer.

Maximum of 12 means that you can have 12. But with 8 bits you can only have 8.

Does that make sense

rgds

steve

it is very good for beggineer but i need know more focus on the type of the class

Not sure what you mean by type of the class

Sir its a very very help full for beginners and also for experience but i need ur more help to learn total subneting as class a b and c,

Have you watch the videos

IPv4 Addresses and Address Classes Explained

https://youtu.be/nVKZs-_-7U4

———–

IPv4 Subnetting Worked Examples

https://youtu.be/eet6SumgW5A

Were are you struggling? Would it help if I sent you a quiz to test your current understanding?