Bird
Raised Fist0
Computer Networksknowledge~10 mins

CIDR notation in Computer Networks - Step-by-Step Execution

Choose your learning style10 modes available
Concept Flow - CIDR notation
Start with IP address
↓
Add '/' and prefix length
↓
Calculate subnet mask from prefix
↓
Determine network and host parts
↓
Use for routing and IP allocation
CIDR notation shows an IP address with a suffix that tells how many bits are for the network part, helping to divide IP addresses efficiently.
Execution Sample
Computer Networks
192.168.1.0/24

# /24 means first 24 bits are network
# subnet mask: 255.255.255.0
# host bits: 8 (32-24)
# total addresses: 256 (254 usable)
This shows an IP address with a /24 prefix, meaning the first 24 bits are network bits, leaving 8 bits for hosts.
Analysis Table
StepActionValue/CalculationResult
1Start with IP address192.168.1.0192.168.1.0
2Add prefix length/24192.168.1.0/24
3Calculate subnet mask24 bits network255.255.255.0
4Determine network partFirst 24 bits fixed192.168.1.0
5Determine host part32 - 24 = 8 bits256 addresses total
6Calculate usable hosts256 - 2 (network & broadcast)254 usable IPs
7Use in routingRoute traffic to 192.168.1.0/24Network identified
8EndPrefix length defines subnet sizeExecution complete
💡 Prefix length fully defines network and host division, stopping further calculation.
State Tracker
VariableStartAfter Step 3After Step 5Final
IP Address192.168.1.0192.168.1.0192.168.1.0192.168.1.0
Prefix LengthN/A242424
Subnet MaskN/A255.255.255.0255.255.255.0255.255.255.0
Host BitsN/AN/A88
Total AddressesN/AN/A256256
Usable HostsN/AN/AN/A254
Key Insights - 3 Insights
Why does /24 mean 255.255.255.0 as subnet mask?
Because /24 means the first 24 bits are network bits, which in decimal form is 255.255.255.0 as shown in execution_table step 3.
Why subtract 2 from total addresses to get usable hosts?
Two addresses are reserved: one for the network itself and one for broadcast, so usable hosts are total minus 2, as shown in step 6.
What does the prefix length tell us about the IP address?
It tells how many bits are fixed for the network part, separating network and host bits, as seen in steps 3 and 4.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the subnet mask calculated at step 3?
A255.0.0.0
B255.255.0.0
C255.255.255.0
D255.255.255.255
💡 Hint
Check the 'Result' column in step 3 of the execution_table.
At which step do we find out how many host bits are available?
AStep 5
BStep 2
CStep 4
DStep 6
💡 Hint
Look for where 'Host Bits' or '32 - prefix' is calculated in execution_table.
If the prefix length changed from /24 to /26, how would the total addresses change?
ADecrease to 128
BDecrease to 64
CIncrease to 512
DStay the same at 256
💡 Hint
Recall total addresses = 2^(32 - prefix length). Check variable_tracker for prefix length effect.
Concept Snapshot
CIDR notation shows an IP address with a slash and number (e.g., /24).
The number is how many bits are for the network part.
Subnet mask is derived from this prefix length.
It divides IPs into network and host parts.
Used to allocate IPs efficiently and route traffic.
Full Transcript
CIDR notation is a way to write IP addresses that includes how many bits are used for the network part. For example, 192.168.1.0/24 means the first 24 bits are network bits. This corresponds to a subnet mask of 255.255.255.0. The remaining bits are for hosts, so with 8 host bits, there are 256 total addresses. Two addresses are reserved for network and broadcast, leaving 254 usable IPs. This notation helps computers know which part of the address is the network and which part is the device, making routing and IP allocation more efficient.

Practice

(1/5)
1. What does the number after the slash in a CIDR notation represent? For example, in 192.168.1.0/24.
easy
A. The total number of IP addresses in the network
B. The size of the network or how many bits are used for the network part
C. The number of hosts allowed in the network
D. The version of the IP address

Solution

  1. Step 1: Understand CIDR notation structure

    CIDR notation shows an IP address followed by a slash and a number. This number tells how many bits are used for the network part of the address.
  2. Step 2: Interpret the number after the slash

    The number after the slash (like 24 in 192.168.1.0/24) means the first 24 bits are the network portion, defining the network size.
  3. Final Answer:

    The size of the network or how many bits are used for the network part -> Option B
  4. Quick Check:

    Number after slash = network bits [OK]
Hint: Slash number shows network bits, not hosts or total IPs [OK]
Common Mistakes:
  • Confusing slash number with total hosts
  • Thinking slash number is IP version
  • Assuming slash number shows number of hosts
2. Which of the following is the correct CIDR notation for a network with IP address 10.0.0.0 and a subnet mask of 255.255.255.0?
easy
A. 10.0.0.0/16
B. 10.0.0.0/8
C. 10.0.0.0/24
D. 10.0.0.0/32

Solution

  1. Step 1: Convert subnet mask to CIDR prefix length

    Subnet mask 255.255.255.0 means the first 24 bits are ones (11111111.11111111.11111111.00000000), so the CIDR prefix is /24.
  2. Step 2: Match IP with correct CIDR notation

    Given IP 10.0.0.0 with subnet mask 255.255.255.0 corresponds to 10.0.0.0/24.
  3. Final Answer:

    10.0.0.0/24 -> Option C
  4. Quick Check:

    255.255.255.0 = /24 [OK]
Hint: Count 1 bits in subnet mask to find slash number [OK]
Common Mistakes:
  • Confusing /16 with 255.255.0.0 mask
  • Using /32 which means single IP
  • Mixing up subnet mask and CIDR prefix
3. Given the CIDR notation 192.168.10.0/28, how many usable IP addresses are available in this subnet?
medium
A. 14
B. 28
C. 30
D. 16

Solution

  1. Step 1: Calculate total IP addresses from CIDR prefix

    /28 means 28 bits for network, so 32 - 28 = 4 bits for hosts. Total IPs = 2^4 = 16.
  2. Step 2: Calculate usable IP addresses

    Usable IPs exclude network and broadcast addresses, so usable = 16 - 2 = 14.
  3. Final Answer:

    14 -> Option A
  4. Quick Check:

    Usable IPs = 2^(32-28) - 2 = 14 [OK]
Hint: Usable IPs = 2^(32 - slash) minus 2 [OK]
Common Mistakes:
  • Counting total IPs as usable
  • Forgetting to subtract network and broadcast addresses
  • Miscalculating bits for hosts
4. A network administrator wrote the CIDR notation as 172.16.0.0/33. What is wrong with this notation?
medium
A. CIDR prefix must be less than 16
B. IP address is invalid
C. Subnet mask is missing
D. CIDR prefix cannot be greater than 32 for IPv4

Solution

  1. Step 1: Understand CIDR prefix limits for IPv4

    IPv4 addresses are 32 bits long, so CIDR prefix must be between 0 and 32 inclusive.
  2. Step 2: Identify invalid prefix

    A prefix of 33 is invalid because it exceeds the 32-bit length of IPv4 addresses.
  3. Final Answer:

    CIDR prefix cannot be greater than 32 for IPv4 -> Option D
  4. Quick Check:

    IPv4 prefix max = 32 [OK]
Hint: CIDR prefix max 32 for IPv4, 128 for IPv6 [OK]
Common Mistakes:
  • Thinking IP address is invalid instead
  • Confusing CIDR prefix with subnet mask
  • Assuming prefix must be less than 16
5. You need to create a subnet that supports at least 1000 hosts. Which CIDR notation would be the smallest network that fits this requirement?
hard
A. 192.168.0.0/22
B. 192.168.0.0/23
C. 192.168.0.0/21
D. 192.168.0.0/24

Solution

  1. Step 1: Calculate required host bits for 1000 hosts

    Hosts = 2^(host bits) - 2. We want at least 1000 usable hosts. Try host bits: 10 bits gives 2^10 - 2 = 1022 hosts, which is enough.
  2. Step 2: Calculate CIDR prefix from host bits

    IPv4 has 32 bits total. Network bits = 32 - host bits = 32 - 10 = 22. So /22 supports 1022 hosts.
  3. Step 3: Check options for smallest network

    /22 supports 1022 hosts, /23 supports 510 hosts (too small), /21 supports 2046 hosts (larger than needed), /24 supports 254 hosts (too small). Smallest that fits is /22.
  4. Final Answer:

    192.168.0.0/22 -> Option A
  5. Quick Check:

    Hosts ≥ 1000 -> /22 (1022 hosts) [OK]
Hint: Use 2^(32 - prefix) - 2 ≥ hosts needed [OK]
Common Mistakes:
  • Choosing /23 or /24 which are too small
  • Not subtracting 2 for network and broadcast
  • Picking /21 which is larger than needed
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard