chapter

    Ipv4 Addressing, Subnetting, Nat and Fragmentation Short Notes for Gate Cs

    Ipv4 Addressing, Subnetting, Nat and Fragmentation short notes for GATE CS: 3 study cards covering concepts, formulas, shortcuts and exam traps, plus solved p

    Ipv4 Addressing Subnetting Nat and Fragmentation short notes

    Summary: IPv4 Fragmentation Quick Reference

    Quick Reference

    Original Data
    Total Length IP Header (usually 20 bytes).
    Max Data per Fragment
    MTU IP Header.
    Adjusted Max Data ()
    Largest multiple of 8 Max Data per Fragment.
    Number of Fragments
    \lceil \text{Original Data} / D_{max} \rceil
    Fragment Offset
    (Starting byte of data in original datagram) .
    MF Flag
    1 for all fragments except the last one (which is 0).
    DF Flag
    1 means do not fragment; drop and send ICMP error if too large.
    Multi-router Rule
    Each fragment is evaluated independently against the new MTU. All sub-fragments share the original Identification number.

    Summary: Header Modifications and NAT

    Quick Reference Summary

    Header Modifications at a Router

    • TTL: Always decremented by 1. (Packet dropped if it reaches 0).
    • Header Checksum: Always recalculated if any header field changes.
    • Source/Dest IP: Unchanged by standard routers. Modified by NAT routers.
    • Protocol: Never changed in transit.

    The Protocol Field

    1 → ICMP 6 → TCP 17 → UDP

    Network Address Translation (NAT)

    • Purpose: Conserves public IPv4 addresses by allowing many private hosts to share one public IP.
    • Private Ranges: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16.
    • NAPT / PAT: Translates both IP and Port numbers. Uses a translation table to map internal (IP, Port) to external (IP, Port).
    • Side Effect: NAT modifies the IP (and Port), which means the TCP/UDP checksum must also be recalculated by the NAT router, as the pseudo-header has changed.

    Summary: CIDR and Subnetting Cheat Sheet

    Final Revision Checklist

    Total Addresses
    Usable Hosts
    Prefix Length
    Valid Start IP Multiple of
    Valid Mask Contiguous 1s then 0s
    Routing Tie-breaker Longest Prefix

    Try a question

    Answer it here to see how it works. Nothing is recorded until you sign in.

    Question 1
    Level 1: Warm-up

    An engineer states that a /28 CIDR block provides a minimum of 16 usable IP addresses for host interfaces. What is the actual number of usable IP addresses in a /28 block, and does this contradict the engineer's statement?

    Question 2
    Level 1: Warm-up

    An organization requires a single CIDR block that can support exactly 1024 usable host IP addresses. What is the minimum prefix length (in the form /) that satisfies this requirement?

    Question 3
    Level 1: Warm-up

    An organization requires a single CIDR block that can support at least 511 usable host IP addresses. What is the minimum prefix length k (an integer) required for this block?

    Question 4
    Level 1: Warm-up

    Consider the process of IPv4 fragmentation and reassembly. Which ONE of the following statements is TRUE?

    Question 5
    Level 1: Warm-up

    A previously fragmented IPv4 datagram arrives at a router. The router evaluates the first fragment, which has its More Fragments (MF) bit set to 1, and splits it into two new sub-fragments due to a smaller MTU. What will be the MF bit value of the second new sub-fragment?

    Question 6
    Level 1: Warm-up

    Assertion (A): The fragment offset of an IPv4 fragment is calculated by dividing the starting byte position of its data in the original datagram by 8.

    Reason (R): The fragment offset field in the IPv4 header is 13 bits long, so it measures the position in units of 8 bytes to allow a larger maximum offset value.

    Question 7
    Level 1: Warm-up

    A link has an MTU of 505 bytes, and the IP header size is 20 bytes. When fragmenting a datagram, what is the minimum number of bytes by which the maximum possible data payload per non-final fragment must be reduced to satisfy the multiple of 8 rule?

    Question 8
    Level 1: Warm-up

    Which ONE of the following statements about the systematic method for solving single-router fragmentation is TRUE?

    Question 9
    Level 1: Warm-up

    What is the minimum number of host bits required for a CIDR block to contain at least 64 total IP addresses?

    Question 10
    Level 1: Warm-up

    Consider the IP address range from 192.168.4.0 to 192.168.7.255. Which of the following statements is true regarding its CIDR representation?

    Free preview ends here

    Login to view the complete short notes

    Creating an account is free. You get the rest of this chapter, step-by-step solutions, and a study plan built around the topics you are actually weak at.

    Explore complete test series, official past papers, and chapter-wise study tools.

    Why MastersUp

    Personalised first. High quality throughout.

    Most platforms hand everyone the same content. Here the content moves with your performance, topic by topic.

    Built around you, not around a syllabus PDF

    Every answer you give moves your topic-level intelligence rate. The next question, the next revision card and tomorrow's plan all change with it.

    Revision that hits your weak spots

    We only revise topics you have actually attempted and are still below the safe bar on — never the same chapter on repeat.

    Questions calibrated to the real exam

    Each question carries a measured toughness. You are served a rung above your current level, so practice keeps stretching you.

    Notes written for recall, not for volume

    Full lesson cards for first study, curated short-note cards for the last mile — with derivations, traps and exam patterns marked.

    One place for everything

    Notes, chapter practice, previous-year questions, test series and full-length papers — all feeding one picture of your preparation.

    Honest progress

    No vanity streaks. Progress here means chapters mastered and accuracy that held up on harder questions.

    Unlock the whole course

    Full notes and short notes, the complete question bank with worked solutions, mock tests, full-length papers, and an adaptive plan that rebuilds itself as you improve.

    Ipv4 Addressing, Subnetting, Nat and Fragmentation Short Notes for GATE CS

    Ipv4 Addressing, Subnetting, Nat and Fragmentation short notes for GATE CS: 3 study cards covering concepts, formulas, shortcuts and exam traps, plus solved practice questions.

    Summary: IPv4 Fragmentation Quick Reference

    Quick Reference

    Original Data
    Total Length IP Header (usually 20 bytes).
    Max Data per Fragment
    MTU IP Header.
    Adjusted Max Data ()
    Largest multiple of 8 Max Data per Fragment.
    Number of Fragments
    \lceil \text{Original Data} / D_{max} \rceil
    Fragment Offset
    (Starting byte of data in original datagram) .
    MF Flag
    1 for all fragments except the last one (which is 0).
    DF Flag
    1 means do not fragment; drop and send ICMP error if too large.
    Multi-router Rule
    Each fragment is evaluated independently against the new MTU. All sub-fragments share the original Identification number.

    Summary: Header Modifications and NAT

    Quick Reference Summary

    Header Modifications at a Router

    • TTL: Always decremented by 1. (Packet dropped if it reaches 0).
    • Header Checksum: Always recalculated if any header field changes.
    • Source/Dest IP: Unchanged by standard routers. Modified by NAT routers.
    • Protocol: Never changed in transit.

    The Protocol Field

    1 → ICMP 6 → TCP 17 → UDP

    Network Address Translation (NAT)

    • Purpose: Conserves public IPv4 addresses by allowing many private hosts to share one public IP.
    • Private Ranges: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16.
    • NAPT / PAT: Translates both IP and Port numbers. Uses a translation table to map internal (IP, Port) to external (IP, Port).
    • Side Effect: NAT modifies the IP (and Port), which means the TCP/UDP checksum must also be recalculated by the NAT router, as the pseudo-header has changed.

    Summary: CIDR and Subnetting Cheat Sheet

    Final Revision Checklist

    Total Addresses
    Usable Hosts
    Prefix Length
    Valid Start IP Multiple of
    Valid Mask Contiguous 1s then 0s
    Routing Tie-breaker Longest Prefix

    Ipv4 Addressing, Subnetting, Nat and Fragmentation: Solved Questions with Step-by-Step Explanations (10 Problems)

    Question 1 · Computer Networks MCQ

    An engineer states that a /28 CIDR block provides a minimum of 16 usable IP addresses for host interfaces. What is the actual number of usable IP addresses in a /28 block, and does this contradict the engineer's statement?

    1. A.

      14, Yes

    2. B.

      16, No

    3. C.

      15, Yes

    4. D.

      14, No

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: This is a contradiction question, recognisable because it presents a claim about usable hosts and asks you to verify it against the standard CIDR formula, identifying any discrepancies.

    Exam route: For a /28 block, , so host bits . Total addresses = . Usable addresses = Total - 2 (Network and Broadcast) = . The engineer claimed 16 usable addresses, which is incorrect. Thus, the actual number is 14, and it contradicts the statement.

    Learning route:

    Step 1: Identify the prefix length: .

    Step 2: Calculate host bits: .

    Step 3: Calculate total addresses: .

    Step 4: Apply the minus-two rule for usable hosts: .

    Step 5: Compare with the engineer's claim (16). Since , the statement is contradicted.

    Answer: 14, Yes.

    Question 2 · Computer Networks NAT

    An organization requires a single CIDR block that can support exactly 1024 usable host IP addresses. What is the minimum prefix length (in the form /) that satisfies this requirement?

    Correct Answer:

    21.00

    Step-by-Step Solution

    Key idea: Usable hosts in a standard subnet are calculated as , where is the number of host bits.

    Exam route: Set up the inequality , solve for , then find .

    Learning route:

    Step 1: Requirement: Usable Hosts .

    Step 2: Formula: .

    Step 3: Find the smallest integer : (too small), (sufficient). So, .

    Step 4: Calculate prefix length: .

    Answer: 21.00

    Question 3 · Computer Networks NAT

    An organization requires a single CIDR block that can support at least 511 usable host IP addresses. What is the minimum prefix length k (an integer) required for this block?

    Correct Answer:

    22.00

    Step-by-Step Solution

    Key idea: The number of usable host IP addresses in a CIDR block is , where is the number of host bits. We must find the smallest that satisfies the requirement, then calculate .

    Step 1: Set up the inequality for usable hosts: .

    Step 2: Solve for : .

    Step 3: Find the smallest integer that satisfies this. Since (which is less than 513) and (which is greater than 513), the minimum is 10.

    Step 4: Calculate the prefix length .

    Answer: The minimum prefix length is 22.

    Question 4 · Computer Networks MCQ

    Consider the process of IPv4 fragmentation and reassembly. Which ONE of the following statements is TRUE?

    1. A.

      The destination host is responsible for reassembling the fragments.

    2. B.

      The Fragment Offset of each fragment is calculated by dividing its starting data byte by 4.

    3. C.

      The More Fragments (MF) bit is set to 1 for all fragments, including the last one.

    4. D.

      The Identification field is incremented by 1 for each new fragment created.

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: This is a statement truth question about the fundamental properties of IPv4 fragmentation, recognizable because it asks to identify the single true statement among four options.

    Step 1: Evaluate each statement.

    • Statement A: The destination host reassembles fragments. This is TRUE. Routers only fragment; they do not reassemble.
    • Statement B: Fragment Offset is divided by 4. This is FALSE. It is divided by 8.
    • Statement C: MF bit is 1 for all fragments including the last. This is FALSE. The last fragment has MF = 0.
    • Statement D: Identification field is incremented. This is FALSE. All fragments of the same datagram share the same Identification number.

    Answer: Option A

    Common trap: Students might confuse the roles of routers and destination hosts, or misremember the unit for the Fragment Offset.

    Question 5 · Computer Networks MCQ

    A previously fragmented IPv4 datagram arrives at a router. The router evaluates the first fragment, which has its More Fragments (MF) bit set to 1, and splits it into two new sub-fragments due to a smaller MTU. What will be the MF bit value of the second new sub-fragment?

    1. A.

      0

    2. B.

      1

    3. C.

      It depends on the size of the sub-fragment

    4. D.

      It is reset to the DF bit value

    Correct Answer:

    B

    Step-by-Step Solution

    Key idea: This is a casework question about multi-router fragmentation dynamics, recognizable because it asks for the MF bit value of a sub-fragment created from a parent fragment.

    Step 1: Understand the parent fragment's MF bit.

    • The parent fragment has MF = 1. This indicates that there are more fragments of the original datagram following this parent fragment.

    Step 2: Apply the multi-router fragmentation rule.

    • When a fragment is split, all resulting sub-fragments inherit the original datagram's Identification number.
    • The MF bit of a newly created last sub-fragment is set to 0 only if the parent fragment it came from already had its MF bit set to 0.
    • Since the parent fragment had MF = 1, all its sub-fragments, including the last one of this split, must also have MF = 1 to indicate that more fragments of the original datagram are still coming.

    Answer: 1 (Option B).

    Common trap: Students might assume the last sub-fragment of the split gets MF = 0, forgetting that the original datagram still has more fragments following the parent.

    Question 6 · Computer Networks MCQ

    Assertion (A): The fragment offset of an IPv4 fragment is calculated by dividing the starting byte position of its data in the original datagram by 8.

    Reason (R): The fragment offset field in the IPv4 header is 13 bits long, so it measures the position in units of 8 bytes to allow a larger maximum offset value.

    1. A.

      Both A and R are true, and R is the correct explanation of A.

    2. B.

      Both A and R are true, but R is NOT the correct explanation of A.

    3. C.

      A is true, but R is false.

    4. D.

      A is false, but R is true.

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: This is a construction question in assertion-reason format, recognizable because it presents two statements and asks to evaluate their truth and causal relationship.

    Step 1: Evaluate Assertion (A).

    • The fragment offset field indicates where the fragment's data belongs in the original datagram.
    • Because the field measures in 8-byte units, the actual byte offset is the field value multiplied by 8.
    • Conversely, to find the field value, you divide the starting byte position by 8.
    • Assertion (A) is TRUE.

    Step 2: Evaluate Reason (R).

    • The fragment offset field is indeed 13 bits long.
    • A 13-bit field can only represent values up to 8191.
    • By measuring in units of 8 bytes, the maximum representable byte offset becomes bytes, which is sufficient to cover the maximum IPv4 datagram length of 65535 bytes.
    • Reason (R) is TRUE.

    Step 3: Determine the relationship.

    • Reason (R) correctly explains why the division by 8 (or measurement in 8-byte units) is used: it scales the 13-bit field to cover the required range.

    Answer: Both A and R are true, and R is the correct explanation of A. (Option A)

    Question 7 · Computer Networks MCQ

    A link has an MTU of 505 bytes, and the IP header size is 20 bytes. When fragmenting a datagram, what is the minimum number of bytes by which the maximum possible data payload per non-final fragment must be reduced to satisfy the multiple of 8 rule?

    1. A.

      0 bytes

    2. B.

      3 bytes

    3. C.

      5 bytes

    4. D.

      8 bytes

    Correct Answer:

    C

    Step-by-Step Solution

    Key idea: This is a contradiction question about the multiple-of-eight rule, recognizable because it asks for the reduction required to satisfy the rule.

    Step 1: Calculate the maximum data per fragment before rounding.

    • MTU = 505 bytes
    • IP header = 20 bytes
    • Max Data = 505 - 20 = 485 bytes

    Step 2: Apply the multiple of 8 rule.

    • The data payload must be a multiple of 8.
    • The largest multiple of 8 less than or equal to 485 is 480 (since and ).

    Step 3: Calculate the reduction.

    • Reduction = Max Data - Adjusted Max Data
    • Reduction = 485 - 480 = 5 bytes

    Answer: 5 bytes (Option C)

    Common trap: Students might calculate the remainder of 505 divided by 8, or round up instead of down, leading to incorrect values like 3 or 8.

    Question 8 · Computer Networks MCQ

    Which ONE of the following statements about the systematic method for solving single-router fragmentation is TRUE?

    1. A.

      The fragment offset is calculated by dividing the starting byte by 16.

    2. B.

      The number of fragments is calculated by dividing the original data by the adjusted max data and rounding down.

    3. C.

      The adjusted max data is the largest multiple of 8 less than or equal to the max data per fragment.

    4. D.

      The original data is calculated by adding the IP header size to the total length.

    Correct Answer:

    C

    Step-by-Step Solution

    Key idea: This is a bounding question about the systematic method, recognizable because it asks to identify the single true statement among four options describing the fragmentation process.

    Step 1: Evaluate each statement against the systematic method.

    • Statement A: Fragment offset is starting byte / 16. FALSE. It is divided by 8.
    • Statement B: Number of fragments is rounded down. FALSE. It must be rounded up () to ensure all data is covered.
    • Statement C: Adjusted max data is the largest multiple of 8 max data per fragment. TRUE. This is the exact definition of the multiple of 8 rule.
    • Statement D: Original data is total length + header. FALSE. It is total length - header.

    Answer: Option C

    Common trap: Students might forget to round up the number of fragments, or confuse the addition/subtraction of the header size.

    Question 9 · Computer Networks MCQ

    What is the minimum number of host bits required for a CIDR block to contain at least 64 total IP addresses?

    1. A.

      6

    2. B.

      4

    3. C.

      5

    4. D.

      7

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: This is a construction question, recognisable because it asks for the minimum number of host bits required to satisfy a specific address count constraint.

    Exam route: We need at least 64 total IP addresses. The formula for total addresses is . So, . The minimum integer that satisfies this is 6.

    Learning route:

    Step 1: Identify the constraint: total IP addresses .

    Step 2: Recall the formula for total addresses in a CIDR block: , where is the number of host bits.

    Step 3: Solve . Since , the minimum value for is 6.

    Answer: 6.

    Question 10 · Computer Networks MCQ

    Consider the IP address range from 192.168.4.0 to 192.168.7.255. Which of the following statements is true regarding its CIDR representation?

    1. A.

      It can be exactly represented as 192.168.4.0/22.

    2. B.

      It can be exactly represented as 192.168.4.0/23.

    3. C.

      It requires two /23 blocks to be represented.

    4. D.

      It can be exactly represented as 192.168.0.0/21.

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: This is a bounding question, recognisable because it provides a specific IP range and asks for its exact CIDR representation, requiring verification of both the prefix length and the block alignment.

    Exam route: The range spans from 192.168.4.0 to 192.168.7.255. This covers 4 contiguous Class C networks (4, 5, 6, 7). addresses, which corresponds to a /22 prefix (). The starting IP is 192.168.4.0. For a /22 block, the block size in the third octet is 4. Since 4 is a multiple of 4, the alignment is valid. Thus, it is exactly 192.168.4.0/22.

    Learning route:

    Step 1: Calculate the total number of addresses in the range. From 4.0 to 7.255 is 4 full octets in the third position: addresses.

    Step 2: Determine the prefix length . .

    Step 3: Verify block alignment. A /22 block has a size of 4 in the third octet. Valid starting values for the third octet are multiples of 4: 0, 4, 8, 12...

    Step 4: The range starts at 192.168.4.0. Since 4 is a multiple of 4, the alignment is correct.

    Step 5: The exact CIDR representation is 192.168.4.0/22.

    Answer: It can be exactly represented as 192.168.4.0/22.

    More short notes in this unit