Internet Fundamentals - Subnetting Prac 1
Part 1 - IP Addresses and Subnet Masks
An IPv4 address is a 32-bit number that consists of a portion to identify the network and then the individual
host. A router uses a subnet mask to determine the network portion of an address. Like an IPv4 address,
a subnet mask is a 32-bit number, but when in binary notation, it consists of a sequence of ones, followed
by a sequence of zeroes, with no mixing. Subnet masks may be written in dotted decimal notation or in the
more compact CIDR or slash notation, where in slash notation the number is how many ones are in the
binary form of the mask. For example, 11111111.11111111.11111111.11000000 is 255.255.255.192 or
/26.
first octet default subnet mask number of usable host addresses
Class A 0 to 127 255.0.0.0 /8 16,777,214
Class B 128 to 191 255.255.0.0 /16 16,382
Class C 192 to 223 255.255.255.0 /24 254
Given a subnet mask and an IP address, the router will AND the bits together to work out the network
address.
dotted decimal binary
IP address 200.172.138.222 11001000.10101100.10001010.11011110
Subnet mask 255.255.255.0 (/24) Network. Network. Network. Host .
11111111.11111111.11111111.00000000
Subnet address 200.172.138.0 11001000.10101100.10001010.00000000
What if the subnet mask is 255.255.255.224 (/27) instead?
IP address 200.172.138.222 11001000.10101100.10001010.11011110
Network. Network. Network. Host .
Subnet mask 255.255.255.224 (/27) 11111111.11111111.11111111.11100000
Subnet address 200.172.138.192 11001000.10101100.10001010.11000000
Task 1
Complete the following tables.
A)
IP address 200.172.138.101 11001000.10101100.10001010._ _ _ _ _ _ _ _
Subnet mask 255.255.255.224 (/27) 11111111.11111111.11111111.11100000
Subnet address 200.172.138. . . 11001000.10101100.10001010. _ _ _ _ _ _ _ _
B)
IP address 200.172.138.62 11001000.10101100.10001010. _ _ _ _ _ _ _ _
Subnet mask 255.255.255.240 (/28) 11111111.11111111.11111111. _ _ _ _ _ _ _ _
Subnet address 200.172.138. . . 11001000.10101100.10001010. _ _ _ _ _ _ _ _
C)
IP address 200.172.138.233 11001000.10101100.10001010. _ _ _ _ _ _ _ _
Subnet mask 255.255.255.248 (/29) 11111111.11111111.11111111. _ _ _ _ _ _ _ _
Subnet address 200.172.138. . . 11001000.10101100.10001010. _ _ _ _ _ _ _ _
D)
IP address 200.172.138.233 11001000.10101100.10001010. _ _ _ _ _ _ _ _
Subnet mask 255.255.255.252 (/30) 11111111.11111111.11111111. _ _ _ _ _ _ _ _
Subnet address 200.172.138. . . 11001000.10101100.10001010. _ _ _ _ _ _ _ _
E)
IP address 155.155.155.179 _ _ _ _ _ _ _ _._ _ _ _ _ _ _ _._ _ _ _ _ _ _ _._ _ _ _ _ _ _ _
Subnet mask 255.255.128.0 (/17) _ _ _ _ _ _ _ _._ _ _ _ _ _ _ _._ _ _ _ _ _ _ _._ _ _ _ _ _ _ _
Subnet address 155.155. . .. . .. _ _ _ _ _ _ _ _._ _ _ _ _ _ _ _._ _ _ _ _ _ _ _._ _ _ _ _ _ _ _
F)
IP address 155.155.155.179 _ _ _ _ _ _ _ _._ _ _ _ _ _ _ _._ _ _ _ _ _ _ _._ _ _ _ _ _ _ _
Subnet mask 255.255.192.0 (/18) _ _ _ _ _ _ _ _._ _ _ _ _ _ _ _._ _ _ _ _ _ _ _._ _ _ _ _ _ _ _
Subnet address 155.155. . .. . .. _ _ _ _ _ _ _ _._ _ _ _ _ _ _ _._ _ _ _ _ _ _ _._ _ _ _ _ _ _ _
Next Page
G)
IP address 155.155.155.179 _ _ _ _ _ _ _ _._ _ _ _ _ _ _ _._ _ _ _ _ _ _ _._ _ _ _ _ _ _ _
Subnet mask 255.255.224.0 (/19) _ _ _ _ _ _ _ _._ _ _ _ _ _ _ _._ _ _ _ _ _ _ _._ _ _ _ _ _ _ _
Subnet address 155.155. . .. . .. _ _ _ _ _ _ _ _._ _ _ _ _ _ _ _._ _ _ _ _ _ _ _._ _ _ _ _ _ _ _
Part 2 - Subnetting a Class C block
Given a class A, B, or C network we can reassign (or “borrow”) host bits as subnet bits. Suppose we have
N network bits, and borrow S bits to create subnets, this leaves H = 32 – N – S bits for hosts. (N + S + H
must always equal 32.)
For example, if we have a class C network 200.200.200.0/24. N = 24. If we borrow 3 bits for subnets, S = 3
and H = 5.
Given numbers S and H, we can determine the size of the subnets we’ve created, and how many there are.
Two addresses are usually reserved in a subnet, the subnet address, where all the host bits are 0, and the
broadcast address, where all the host bits are 1.
Value Formula Example
Size (total addresses) 2H 25 = 32
Total usable addresses 2H – 2 25 – 2 = 30
Number of subnets 2S 23 = 8
Suppose we have a building with four departments, and want to therefore create four subnets. We have the
200.200.200.0/24 block to split up. We need to choose S so that we get four: 2S = 4, so S = 2. We know
that N = 24, because we started with a /24 network. Therefore H = 32 – 24 – 2 = 6, and hence each subnet
consists of 26 = 64 addresses, of which 62 are usable. We’ve borrowed 2 bits from hosts, so the subnet
mask for our subnets is /26 (24 + 2) or 255.255.255.192 (note that 256 – 64 = 192).
Subnet Subnet address Broadcast address
Bits # 200.200.200.SSHHHHHH 200.200.200.x 200.200.200.SSHHHHHH 200.200.200.x
00 #0 200.200.200.00000000 200.200.200.0 200.200.200.00111111 200.200.200.63
01 #1 200.200.200.01000000 200.200.200.64 200.200.200.01111111 200.200.200.127
10 #2 200.200.200.10000000 200.200.200.128 200.200.200.10111111 200.200.200.191
11 #3 200.200.200.11000000 200.200.200.192 200.200.200.11111111 200.200.200.255
Is there an easier way than looking at the binary to work out the subnet and broadcast addresses? Yes, just
use the subnet sizes. Subnet 0 starts at 200.200.200.0 and the subnet size is 64, so the next subnet begins
at 200.200.200.64. The broadcast always precedes the subnet address of the next subnet, so subnet 0 has
a broadcast address of 200.200.200.63. The usable addresses are all those between the subnet address
and broadcast address, so these are 200.200.200.1 to 200.200.200.63.
Subnet Subnet address Usable host addresses Broadcast address
#0 200.200.200.0 200.200.200.1-.62 200.200.200.63
#1 200.200.200.64 200.200.200.65-.126 200.200.200.127
#2 200.200.200.128 200.200.200.129-.190 200.200.200.191
#3 200.200.200.192 200.200.200.193-.254 200.200.200.255
Task 2
Suppose we need to create 16 subnets from the class C block 198.4.23.0/24. Determine the following
values:
S ...
H ...
Size of subnets ...
Subnet mask - slash notation /....
Subnet mask - octets 255.255.255. . .
Now complete the following table:
Subnet Subnet address Usable host addresses Broadcast address
#0 198.4.23.0 198.4.23. . 198.4.23. .
#1 198.4.23. . 198.4.23. . 198.4.23. .
#2 198.4.23. . 198.4.23. . 198.4.23. .
#3 198.4.23. . 198.4.23. . 198.4.23. .
#4 198.4.23. . 198.4.23. . 198.4.23. .
#5 198.4.23. . 198.4.23. . 198.4.23. .
#6 198.4.23. . 198.4.23. . 198.4.23. .
#7 198.4.23. . 198.4.23. . 198.4.23. .
#8 198.4.23. . 198.4.23. . 198.4.23. .
#9 198.4.23. . 198.4.23. . 198.4.23. .
#10 198.4.23. . 198.4.23. . 198.4.23. .
#11 198.4.23. . 198.4.23. . 198.4.23. .
#12 198.4.23. . 198.4.23. . 198.4.23. .
#13 198.4.23. . 198.4.23. . 198.4.23. .
#14 198.4.23. . 198.4.23. . 198.4.23. .
#15 198.4.23. . 198.4.23. . 198.4.23.255
Part 3 - Subnetting a Class B block
Suppose we’re an organisation with a class B block available, let’s say 155.155.0.0/16. We have branches
in multiple cities, and want to split this address space into subnets to allocate to separate branches. We
want each branch to have enough addresses for 2000 hosts. How should we subnet in this case?
A subnet size can only be a power of 2, so we need to find the next largest power of two: 211 = 2048. This
means we need to leave 11 host bits (H = 11). We start with a class B block, so N = 16, and we know N + S
+ H = 32, so a little bit of algebra gives us S = 5, so we’re borrowing 5 bits for subnetting. In slash notation,
our subnet mask will be /21 (16 + 5), which in octet notation is 11111111.11111111.11111000.00000000 =
255.255.248.0.
This creates 32 (25) subnets as follows:
Subnet Subnet address
Bits # 155.155.SSSSSHHH.HHHHHHHH 155.155.x.y
00000 #0 155.155.00000000.00000000 155.155.0.0
00001 #1 155.155.00001000.00000000 155.155.8.0
00010 #2 155.155.00010000.00000000 155.155.16.0
... ... ... ...
11111 #31 155.155.11111000.00000000 155.155.248.0
When working out subnetting for subnets of size more than 256, it can be simpler to think in terms of the
number of class C blocks. Notice that 2048 = 8 × 256, so each of our subnets is equivalent 8 class C
blocks. The subnet mask is 255.255.248.0, and 248 = 256 – 8. Each of our subnets begins at an address
where the third octet is a multiple of 8.
Task 3
Consider the scenario above, but suppose we need to accommodate 3000 hosts per subnet.
A. What subnet size do we need? What are S and H in this case?
B. How many subnets of this size can we create in the class B block?
C. What is the subnet mask?
D. Complete the table below to show the details for the first three of the subnets:
Subnet Subnet address
Bits # 155.155._ _ _ _ _ _ _ _._ _ _ _ _ _ _ _ 155.155.x.y
#0 155.155.00000000.00000000 155.155.0.0
#1 155.155._ _ _ _ _ _ _ _.00000000 155.155. .. .
#2 155.155._ _ _ _ _ _ _ _.00000000 155.155. .. .