8.1.4.6 Lab - Calculating IPv4 Subnets
8.1.4.6 Lab - Calculating IPv4 Subnets
8.1.4.6 Lab - Calculating IPv4 Subnets
Objectives
Part 1: Determine IPv4 Address Subnetting
Part 2: Calculate IPv4 Address Subnetting
Background / Scenario
The ability to work with IPv4 subnets and determine network and host information based on a given IP
address and subnet mask is critical to understanding how IPv4 networks operate. The first part is designed to
reinforce how to compute network IP address information from a given IP address and subnet mask. When
given an IP address and subnet mask, you will be able to determine other information about the subnet.
Required Resources
192.168.10.10
Subnet Mask
255.255.255.0
==========
Result (Network)
192.168.10.0
Knowing this, you may only have to perform binary ANDing on an octet that does not have 255 or 0 in its
subnet mask portion.
Example:
IP Address
172.30.239.145
Subnet Mask
255.255.192.0
Analyzing this example, you can see that you only have to perform binary ANDing on the third octet. The first
two octets will result in 172.30 due to the subnet mask. The fourth octet will result in 0 due to the subnet
mask.
IP Address
172.30.239.145
Subnet Mask
255.255.192.0
==========
Result (Network)
172.30.?.0
2015 Cisco and/or its affiliates. All rights reserved. This document is Cisco Public.
Page 1 of 7
Binary
239
11101111
192
11000000
=======
Result
192
11000000
172.30.239.145
Subnet Mask
255.255.192.0
==========
Result (Network)
172.30.192.0
Continuing with this example, determining the number of hosts per network can be calculated by analyzing
the subnet mask. The subnet mask will be represented in dotted decimal format, such as 255.255.192.0, or in
network prefix format, such as /18. An IPv4 address always has 32 bits. Subtracting the number of bits used
for the network portion (as represented by the subnet mask) gives you the number of bits used for hosts.
Using our example above, the subnet mask 255.255.192.0 is equivalent to /18 in prefix notation. Subtracting
18 network bits from 32 bits results in 14 bits left for the host portion. From there, it is a simple calculation:
(number of host bits)
- 2 = Number of hosts
14
Network Address
Broadcast Address
Total Number
of Host Bits
Total Number
of Hosts
192.168.100.25/28
192.168.100.16
192.168.100.31
14
172.30.10.130/30
172.30.10.128
172.30.10.131
10.1.96.0
10.1.127.255
13
8190
198.133.219.250/24
198.133.219.0
198.133.219.255
254
128.107.14.191/22
128.107.10.0
128.107.15.255
10
1022
172.16.104.99/27
172.16.104.96
172.16.104.127
30
10.1.113.75/19
2015 Cisco and/or its affiliates. All rights reserved. This document is Cisco Public.
Page 2 of 7
172.16.77.120
255.255.0.0
255.255.240.0
Find:
16
12
4,094
172.16.64.0
172.16.64.1
172.16.79.254
172.16.79.255
2015 Cisco and/or its affiliates. All rights reserved. This document is Cisco Public.
Page 3 of 7
Description
nd
1 Octet
rd
Octet
th
3 Octet
4 Octet
Description
Network/Host
nnnnnnnn
nnnnnnnn
nnnnhhhh
hhhhhhhh
Subnet Mask
Binary
10101100
00010000
01000000
00000001
First Host
Decimal
172
16
64
First Host
Binary
10101100
00010000
01001111
11111110
Last Host
Decimal
172
16
79
254
Last Host
Binary
10101100
00010000
01001111
11111111
Broadcast
Decimal
172
16
79
255
Broadcast
Step 1: Fill out the tables below with appropriate answers given the IPv4 address, original
subnet mask, and new subnet mask.
a. Problem 1:
Given:
Host IP Address:
192.168.200.139
255.255.255.0
255.255.255.224
Find:
30
192.168.200.128
192.168.200.129
192.168.200.158
192.168.200.159
2015 Cisco and/or its affiliates. All rights reserved. This document is Cisco Public.
Page 4 of 7
10.101.99.228
255.0.0.0
255.255.128.0
Find:
c.
512
15
32766
10.101.0.0
10.101.0.1
10.101.127.254
10.101.127.255
Problem 3:
Given:
Host IP Address:
172.22.32.12
255.255.0.0
255.255.224.0
Find:
13
8190
172.22.32.0
172.22.32.1
172.22.63.254
172.22.63.255
2015 Cisco and/or its affiliates. All rights reserved. This document is Cisco Public.
Page 5 of 7
192.168.1.245
255.255.255.0
255.255.255.252
Find:
64
192.168.1.244
192.168.1.245
192.168.1.246
192.168.1.247
e. Problem 5:
Given:
Host IP Address:
128.107.0.55
255.255.0.0
255.255.255.0
Find:
256
254
128.107.0.0
128.107.0.1
128.107.0.254
128.107.0.255
2015 Cisco and/or its affiliates. All rights reserved. This document is Cisco Public.
Page 6 of 7
Problem 6:
Given:
Host IP Address:
192.135.250.180
255.255.255.0
255.255.255.248
Find:
32
192.135.250.176
192.135.250.177
192.135.250.190
192.135.250.191
Reflection
Why is the subnet mask so important when analyzing an IPv4 address?
2015 Cisco and/or its affiliates. All rights reserved. This document is Cisco Public.
Page 7 of 7