# Subnetting Worked Examples and Exercises

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.

1- You have been allocated a class A network address of 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 28=256 subnets

16 bits would accommodate 216= over 64000 hosts

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

Have possible 28 -2 hosts =254 which is enough

2. – You have been allocated a class B network address of 135.1.0.0 and and need to create 4 subnets each with around 200 hosts what is the easiest mask to use to satisfy the criteria?

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

4. Write the IP address 135.1.1.25 mask 255.255. 248.0 in CIDR notation

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

5 – You have been allocated a class C network address of 211.1.1.0 and are using the default subnet mask of 255.255.255.0 how may hosts can you have?

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

6 .Subnet the Class C IP Address 195.1.1.0 So that you have 10 subnets each with a maximum 12 hosts on each subnet. List the Address on host 1 on subnet 0,1,2,3,10

Bits needs for 10 subnets =4 =24 =16 possible subnets

Bits needs for 12 hosts = 4 = 24  = 16-2=14 possible hosts.

So our mask in binary =11110000= 240 decimal

#### 7. Subnet the Class C IP Address 205.11.2.0 so that you have 30 subnets.

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 ?

Bits needs for 30 subnets =5 =25 =32 possible subnets

Bits left for hosts = 3 = 23  = 8-2=6 possible hosts.

So our mask in binary =11111000= 248 decimal

Address of host 3 on subnet 2 is

subnet 2 =00010000 host 3 =000000011

therefore IP address of host 3 on subnet  2 =205.11.2.19

8. Subnet the Class C IP Address 195.1.1.0 So that you have at least 2 subnets each subnet must have room for 48 hosts .

What are the two possible subnet masks?

Bits needs for 48 hosts = 6 = 26  = 64-2=62 possible hosts.

Bits needs for 2 subnets =1 =21 =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.

255.255.255.128 and 255.255.255.192

9 .Given the subnet Mask 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 Videos

Related Tutorials and Resources:

### Subnet Quizzes

Test you knowledge using these online quizzes

1. ali ahmed says:

You are given 2 networks to be implemented on the following topology:
Network 1 172.16.0.0
Network 2 192.168.0.0
You are required to subnet the above mentioned networks as per following requirements
Net1 Subnet1 100 Hosts
Net1 Subnet2 500 Hosts
Net1 Subnet3 200 Hosts
Net2 is subnetted for all router to router links. No hosts other than required to router interfaces are to be assigned. Implement EIGRP with autonomous System no. 1 in each router, assign proper IP address, subnet masks and default gateways where needed plz help me inthsi case

1. steve says:

Hi
Sorry but the question requires more time to answer than I can provide. I can only point you to the examples. You might want to go on to the cisco sites as they have more detailed examples focused on the cisco exams
Rgds
Steve

2. Kia Thompson says:

You have been allocated a class b network address of 132.121.0.0 and need to create 150 subnets each with 120 hosts , what is the new subnet mask to satisfy these criteria?
host per network: 2^n-2 ( n is the zeroes )

class B is 255.255.0.0 1111 1111. 1111 1111 . 0000 0000 . 0000 0000
I need to steal hosts bits (the zeroes) to get close or around to 150 : so that would be 2^6=64 or 2^7=128?

1. steve says:

150 subnet means you need 8 bits which is ok as you have 16. so use a class C mask
255.255.255.0
this give 254 subnet and 254 hosts

3. james says:

1. steve says:

By a logical AND between the IP address and the subnet mask

4. Shon says:

For question #7: Shouldn’t the answer be 205.11.2.9
i dont understand why 19 when you’re going up by 6 users starting from 0.

1. steve says:

Hi
205.11.2.9 would be host 1 on subnet 1
rgds
steve

5. alemayehu says:

please who can solve this problem for me?????

220.42.56.20
Design a network having 4 subnets for

1. steve says:

Looks like the question is wrong are you sure of the IP address

6. Steve says:

Hello Steve, your question are very helpful ..but can you guide me on the below ones please

1.You currently use the default mask for your IP network 192.168.1.0. You need to subnet
your network so that you get the following.
a. 30 additional networks, and 4 hosts per network.
b. 20 hosts per subnet

1. steve says:

Hi
4 hosts means you need 3 bits for the host so your mask looks like this
11111000
20 hosts means that you need 5 bits for the host so your mask looks like this
11100000
4 additional networks means you need 3 bits for the Network so your mask looks like this
11100000
I’ll let you convert them to decimal
Rgds
Steve

7. Sheldon says:

Great job steve!

8. jordan says:

what is the last valid host on the subnetwork 172.21.80.128/26?
pls help me in this
thanks a lot

1. steve says:

Hi
you have 2 bits for the host so values are
=00,01,10,11
00 and 11 are not usable so you have hosts 01 and 10
by last I assume the mean 10 so the address is 172.21.80.130

2. Sheldon says:

CIDR is /26
172.21.80.128
Binary: 10101100 00010101 01010000 10000000
Let’s seperate the subnet and hosts
10101100 00010101 01010000 10 —> 000000
Lets make all the 0’s 1’s where the seperation is to get Broadcast
10101100 00010101 01010000 10 —> 111111
Broadcast : 172.21.80.191 (191 is 10 111 111)
Last usuable host IP will therefore be 10 111110
Last usuable IP: 172.21.80.190

9. Kavita Rawat says:

Q.6 . Subnet 10 host 1 ip address must be 195.1.1.151 as per my calculation

1. steve says:

Hi
Just checked it again and 161 is correct
rgds
steve

10. Anton says:

1. Calculate IP addresses and subnet mask for 3 nodes (indexes are listed into the 3rd line) for three subnets (indexes are listed in the 2nd line). Network can contain some amount of subnets and no less than it is specified (the 1st line, S). Each subnet can contain no less than specific numbers of nodes (the 1st line, H).
Result: final nodes IP and masks with calculaations
300, 3, 140
1, 2, 3
11, 12, 13 / 1, 22, 23

The 1st line: N, S, H; N – total nodes amount, S – subnet amount, H – subnet nodesamount.
The 2nd line: A, B, C; A & B & C – subnet indexes
The 3rd line: a1, a2, a3 / b1, b2, b3; ai и bi – node indexes to calculate. ci is equal to bi

1. steve says:

Sorry find the question confusing were did it come from
Rgds
Steve

11. Sky says:

Question one should be a MINIMUM of 160 hosts, not a MAXIMUM!

1. steve says:

No Maximum is correct.But using Minimum would also work in this case.
Rgds
Steve

12. Gashaw says:

give the following subnets ,represnt them with a single network address
212.56.120,0
212.56.121.0
212.56.122.0
212.56.123.0

1. steve says:

Not sure about the question where is it from
Rgds
Steve

13. Rebecca says:

Amazing, amazing work! You have no idea how much these exercises have helped, and the explanations are all very clear as well. Thank you very much!

p.s. I love the font

14. Matt says:

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.

1. steve says:

Yes it is a class C address

2. crampton says:

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.

15. Raunak singh says:

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!

1. steve says:

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

16. charushila says:

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

1. steve says:

rgds
steve

17. Tiago says:

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.

1. steve says:

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

1. Tiago says:

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.

1. steve says:

Maximum of 12 means that you can have 12. But with 8 bits you can only have 8.
Does that make sense
rgds
steve