CCNA Course
Lecture 12
IP Subnetting Part 1 (IPv4)
Eng/ Ahmed El-khatib
What we will Learn in this Part ?
In this section, I will provide you with an IP address, and
based on that, you will be asked to identify the following:
✓ What is the Network ID (Subnet Address)?
✓ What is the Subnet Mask / CIDR Notation?
✓ What is the Broadcast Address?
✓ What is the First Usable IP Address?
✓ What is the Last Usable IP Address?
✓ What is the Number of Usable IPs in this Subnet?
✓ What is the Hop Count (Block size) in this Subnet?
(optional, since it's similar to usable IPs)
✓ What is the Next Network Address?
How we can get it
If you're given an IP address in CIDR notation (e.g. /26), follow these steps to
calculate all subnet-related information:
✓ Convert the CIDR (Prefix Length) into a Subnet Mask
✓ Determine the Number of Host Bits (H) (H = 32 – Prefix Length)
✓ To Get the Hop count ( Block size ) :Hop Count = 2𝐻
✓ To Get the Number of Usable IPs: 2𝐻 − 2
✓ Convert the Subnet Mask into Binary Format ( Trick: Only convert the octet(s) that are less
than 255.)
✓ Convert the IP into Binary Format ( Trick: You only need to convert the octet(s) that contain
both network and host bits (i.e. not fully 255 or 0 in the subnet mask).
✓ Identify the Network Part and Host Part in the given IP ( in mask , 1s = Networks , 0s = Hosts )
✓ To Get the Network ID (Subnet Address): Replace all host bits in the IP with zeros.
✓ To Get the Broadcast Address: Replace all host bits in the IP with ones.
✓ To Get the First Valid IP Address: Replace all host bits with zeros except the first bit = 1, (
Or simply: Network ID + 1)
✓ To Get the Last Valid IP Address: Replace all host bits with ones except the last bit = 0, ( Or
simply: Broadcast Address – 1)
✓ To Get the Next Network Address: Network ID + Hop count ( Broadcast Address + 1)
Practice Problems
Problem 1
Given: 192.168.1.100/26
Find
Subnet Mask
Network ID
Broadcast Address
First Usable IP
Last Usable IP
Number of Usable IPs
Next Network
Hop Count
Solution Problem 1
1. Prefix = 26 that’s means we have 26 ones in sub netmask
2. The the Number of Host Bits (H) = 32-26 = 6 bits
3. To Get the Hop count ( Block size ) : 2𝐻 = 26 = 64
4. Number of Usable IPs: 26 − 2 = 64 − 2 = 62
5. The subnet mask :
11111111 11111111 11111111 11000000
in decimal Format
255 255 255 192
Solution Problem 1 … cont.
6. Identify the Network Part and Host Part in the given IP
192 168 1 01100100
255 255 255 11000000
Network Part Host Part
Solution Problem 1 … cont.
7. To Get the Network ID (Subnet Address): Replace all host bits in
the IP with zeros
192 168 1 01000000
in decimal Format
192 168 1 64
Solution Problem 1 … cont.
8. To Get the Broadcast Address: Replace all host bits in the IP with
ones.
192 168 1 01111111
in decimal Format
192 168 1 127
Solution Problem 1 … cont.
9. To Get the First Valid IP Address: Replace all host bits with zeros
except the first bit = 1, ( Or simply: Network ID + 1)
192 168 1 01000001
in decimal Format
192 168 1 65
Solution Problem 1 … cont.
10. To Get the Last Valid IP Address: Replace all host bits with ones
except the last bit = 0, ( Or simply: Broadcast Address – 1)
192 168 1 01111110
in decimal Format
192 168 1 126
Solution Problem 1 … cont.
11. To Get the Next Network Address: Network ID + Hop count
( Broadcast Address + 1)
192 168 1 64+64
OR
192 168 1 127+1
=
192 168 1 128
Solution Problem 1 … cont.
Solution: Problem 1
Subnet Mask: 255.255.255.192
Host bits: 6
Network ID = 192.168.1.64
Broadcast = 192.168.1.127
First Usable IP = 192.168.1.65
Last Usable IP = 192.168.1.126
Number of all Usable IPs = 62
Next Network = 192.168.1.128
Hop Count = 64
Practice Problems
Problem 2
Given: 10.0.0.25/30
Find
Subnet Mask
Network ID
Broadcast Address
First Usable IP
Last Usable IP
Number of Usable IPs
Next Network
Hop Count
Solution Problem 2
1. Prefix = 30 that’s means we have 30 ones in sub netmask
2. The the Number of Host Bits (H) = 32-30 = 2 bits
3. To Get the Hop count ( Block size ) : 2𝐻 = 22 = 4
4. Number of Usable IPs: 22 − 2 = 4 − 2 = 2
5. The subnet mask :
11111111 11111111 11111111 11111100
in decimal Format
255 255 255 252
Solution Problem 2 … cont.
6. Identify the Network Part and Host Part in the given IP
10 0 0 000110 01
255 255 255 111111 00
Network Part Host Part
Solution Problem 2 … cont.
7. To Get the Network ID (Subnet Address): Replace all host bits in
the IP with zeros
10 0 0 00011000
in decimal Format
10 0 0 24
Solution Problem 2 … cont.
8. To Get the Broadcast Address: Replace all host bits in the IP with
ones.
10 0 0 00011011
in decimal Format
10 0 0 27
Solution Problem 2 … cont.
9. To Get the First Valid IP Address: Replace all host bits with zeros
except the first bit = 1, ( Or simply: Network ID + 1)
10 0 0 00011001
in decimal Format
10 0 0 25
Solution Problem 2 … cont.
10. To Get the Last Valid IP Address: Replace all host bits with ones
except the last bit = 0, ( Or simply: Broadcast Address – 1)
10 0 0 00011010
in decimal Format
10 0 0 26
Solution Problem 2 … cont.
11. To Get the Next Network Address: Network ID + Hop count
( Broadcast Address + 1)
10 0 0 24+4
OR
10 0 0 27+1
=
10 0 0 28
Solution Problem 2 … cont.
Solution: Problem 2
Subnet Mask: 255.255.255.252
Host bits: 2
Network ID = 10.0.0.24
Broadcast = 10.0.0.27
First Usable IP = 10.0.0.25
Last Usable IP = 10.0.0.26
Number of all Usable IPs = 2
Next Network = 10.0.0.28
Hop Count = 4
Practice Problems
Problem 3
Given: 172.16.5.200/27
Find
Subnet Mask
Network ID
Broadcast Address
First Usable IP
Last Usable IP
Number of Usable IPs
Next Network
Hop Count
Solution Problem 3
1. Prefix = 27 that’s means we have 27 ones in sub netmask
2. The the Number of Host Bits (H) = 32-27 = 5 bits
3. To Get the Hop count ( Block size ) : 2𝐻 = 25 = 32
4. Number of Usable IPs: 25 − 2 = 32 − 2 = 30
5. The subnet mask :
11111111 11111111 11111111 11100000
in decimal Format
255 255 255 224
Solution Problem 3 … cont.
6. Identify the Network Part and Host Part in the given IP
172 16 5 110 01000
255 255 255 111 00000
Network Part Host Part
Solution Problem 3 … cont.
7. To Get the Network ID (Subnet Address): Replace all host bits in
the IP with zeros
172 16 5 11000000
in decimal Format
172 16 5 192
Solution Problem 3 … cont.
8. To Get the Broadcast Address: Replace all host bits in the IP with
ones.
172 16 5 11011111
in decimal Format
172 16 5 223
Solution Problem 3 … cont.
9. To Get the First Valid IP Address: Replace all host bits with zeros
except the first bit = 1, ( Or simply: Network ID + 1)
172 16 5 11000001
in decimal Format
172 16 5 193
Solution Problem 3 … cont.
10. To Get the Last Valid IP Address: Replace all host bits with ones
except the last bit = 0, ( Or simply: Broadcast Address – 1)
172 16 5 11011110
in decimal Format
172 16 5 222
Solution Problem 3 … cont.
11. To Get the Next Network Address: Network ID + Hop count
( Broadcast Address + 1)
172 16 5 192+32
OR
172 16 5 223+1
=
172 16 5 224
Solution Problem 3 … cont.
Solution: Problem 3
Subnet Mask: 255.255.255.224
Host bits: 32
Network ID = 172.16.5.192
Broadcast = 172.16.5.223
First Usable IP = 172.16.5.193
Last Usable IP = 172.16.5.222
Number of all Usable IPs = 30
Next Network = 172.16.5.224
Hop Count = 32
Practice Problems
Problem 4
Given: 192.168.10.200/17
Find
Subnet Mask
Network ID
Broadcast Address
First Usable IP
Last Usable IP
Number of Usable IPs
Next Network
Hop Count
Solution Problem 4
1. Prefix =17that’s means we have 17 ones in sub netmask
2. The the Number of Host Bits (H) = 32-17 = 15 bits
3. To Get the Hop count ( Block size ) : 215 = 32768
4. Number of Usable IPs: 215 − 2 = 32768 − 2 = 32766
5. The subnet mask :
11111111 11111111 10000000 00000000
in decimal Format
255 255 128 0
Solution Problem 4 … cont.
6. Identify the Network Part and Host Part in the given IP
192 168 0 0001010 11001000
255 255 1 0000000 00000000
Network Part Host Part
Solution Problem 4 … cont.
7. To Get the Network ID (Subnet Address): Replace all host bits in
the IP with zeros
192 168 00000000 00000000
in decimal Format
192 168 0 0
Solution Problem 4 … cont.
8. To Get the Broadcast Address: Replace all host bits in the IP with
ones.
192 168 01111111 11111111
in decimal Format
192 168 127 255
Solution Problem 4 … cont.
9. To Get the First Valid IP Address: Replace all host bits with zeros
except the first bit = 1, ( Or simply: Network ID + 1)
192 168 00000000 00000001
in decimal Format
192 168 0 1
Solution Problem 4 … cont.
10. To Get the Last Valid IP Address: Replace all host bits with ones
except the last bit = 0, ( Or simply: Broadcast Address – 1)
192 168 01111111 11111110
in decimal Format
192 168 127 254
Solution Problem 4 … cont.
11. To Get the Next Network Address: Network ID + Hop count
( Broadcast Address + 1)
192 168 127 255+1
=
192 168 128 0
Solution Problem 4 … cont.
Solution: Problem 4
Subnet Mask: 255.255.128.0
Host bits: 15
Network ID = 192.168.0.0
Broadcast = 192.168.127.255
First Usable IP = 192.168.0.1
Last Usable IP = 192.168.127.254
Number of all Usable IPs = 32,766
Next Network = 192.168.128.0
Hop Count = 32,768
Practice Problems
Problem 5
Given: 10.0.0.5/9
Find
Subnet Mask
Network ID
Broadcast Address
First Usable IP
Last Usable IP
Number of Usable IPs
Next Network
Hop Count
Solution Problem 5
1. Prefix =9 that’s means we have 9 ones in sub netmask
2. The the Number of Host Bits (H) = 32 – 9 = 23 bits
3. To Get the Hop count ( Block size ) : 223 = 8388608
4. Number of Usable IPs: 223 − 2 = 8388608 − 2 = 8388606
5. The subnet mask :
11111111 10000000 00000000 00000000
in decimal Format
255 128 0 0
Solution Problem 5 … cont.
6. Identify the Network Part and Host Part in the given IP
10 00000000 00000000 00000101
255 1 0000000 00000000 00000000
Network Part Host Part
Solution Problem 5 … cont.
7. To Get the Network ID (Subnet Address): Replace all host bits in
the IP with zeros
10 00000000 00000000 00000000
in decimal Format
10 0 0 0
Solution Problem 5 … cont.
8. To Get the Broadcast Address: Replace all host bits in the IP with
ones.
10 01111111 11111111 11111111
in decimal Format
10 127 255 255
Solution Problem 5 … cont.
9. To Get the First Valid IP Address: Replace all host bits with zeros
except the first bit = 1, ( Or simply: Network ID + 1)
10 00000000 00000000 00000001
in decimal Format
10 0 0 1
Solution Problem 4 … cont.
10. To Get the Last Valid IP Address: Replace all host bits with ones
except the last bit = 0, ( Or simply: Broadcast Address – 1)
10 01111111 11111111 11111110
in decimal Format
10 127 255 254
Solution Problem 5 … cont.
11. To Get the Next Network Address: Network ID + Hop count
( Broadcast Address + 1)
10 127 255 255+1
=
10 128 0 0
Solution Problem 5 … cont.
Solution: Problem 4
Subnet Mask: 255.128.0.0
Host bits: 23
Network ID = 10.0.0.0
Broadcast = 10.127.255.255
First Usable IP = 10.0.0.1
Last Usable IP = 10.127.255.254
Number of all Usable IPs = 8,388,606
Next Network = 10.128.0.0
Hop Count = 8,388,608
Tray To Solve
Problem 1
Given: 192.168.200.55/19
Find
Subnet Mask
Network ID
Broadcast Address
First Usable IP
Last Usable IP
Number of Usable IPs
Next Network
Hop Count
Tray To Solve… cont.
Problem 2
Given: 10.20.15.100/12
Find
Subnet Mask
Network ID
Broadcast Address
First Usable IP
Last Usable IP
Number of Usable IPs
Next Network
Hop Count
Solution Problem 1
Subnet Mask: 255.255.224.0
Host bits: 13
Network ID = 192.168.192.0
Broadcast = 192.168.223.255
First Usable IP = 192.168.192.1
Last Usable IP = 192.168.223.254
Number of all Usable IPs = 8190
Next Network = 192.168.224.0
Hop Count = 8192
Solution Problem 2.
Subnet Mask: 255.240.0.0
Host bits: 20
Network ID = 10.16.0.0
Broadcast = 10.31.255.255
First Usable IP = 10.16.0.1
Last Usable IP = 10.31.255.254
Number of all Usable IPs = 1,048,574
Next Network = 10.32.0.0
Hop Count = 1,048,576
Quiz
Given this Ips : Find
• 192.168.80.150/23
• 172.20.45.33/21 Subnet Mask
• 192.0.2.70/29 Network ID
• 198.51.100.220/25 Broadcast Address
• 172.30.100.5/18 First Usable IP
Last Usable IP
Number of Usable IPs
Next Network
Hop Count
THE END OF THE CHAPTER
Eng/ Ahmed El-khatib