GATE CSE IPv4, CIDR and NAT PYQs
IPv4 testing in GATE CS focuses heavily on numerical datagram mechanics (fragmentation offset, payload size, header scaling factors), CIDR subnetting (subnet al… Read the guide
- Questions
- 14
- Asked
- since 2012
- Total marks
- 21
- Marks / paper
- 0.8
14 GATE CSE IPv4, CIDR and NAT PYQs with solutions, from Computer Networks. Browse all GATE CSE PYQs.
Questions
Every official paper that asked this topic, newest first.
- GATE CSE 2025 Set 2 · Q18A machine receives an IPv4 datagram. The protocol field of the IPv4 header has the protocol number of a protocol X. Which ONE of the following is NOT a possible candidate for X?MCQ1 markEasySolve
- GATE CSE 2024 Set 2 · Q32Which of the following fields of an IP header is/are always modified by any router before it forwards the IP packet?MSQ1 markEasySolve
- GATE CSE 2022 · Q22Consider an enterprise network with two Ethernet segments, a web server and a firewall, connected via three routers as shown below. What is the number of subnets inside the enterprise network?MCQ1 markEasyDiagramSolve
- GATE CSE 2019 · Q28Consider three machines M, N, and P with IP addresses 100.10.5.2, 100.10.5.5, and 100.10.5.6 respectively. The subnet mask is set to 255.255.255.252 for all the three machines. Which one of the following is true?MCQ2 marksEasySolve
- GATE CSE 2017 Set 2 · Q20The maximum number of IPv4 router addresses that can be listed in the record route (RR) option field of an IPv4 header is _________.NAT1 markMediumSolve
- GATE CSE 2015 Set 1 · Q22Which one of the following fields of an IP header is NOT modified by a typical IP router?MCQ1 markEasySolve
- GATE CSE 2015 Set 3 · Q38In the network 200.10.11.144/27, the fourth octet (in decimal) of the last IP address of the network which can be assigned to a host is _________.NAT2 marksEasySolve
- GATE CSE 2014 Set 3 · Q25Host A (on TCP/IP v4 network A) sends an IP datagram D to host B (also on TCP/IP v4 network B). Assume that no error occurred during the transmission of D. When D reaches B, which of the following IP header field(s) may be different from that of the original datagram D? (i) TTL (ii) Checksum (iii) Fragment OffsetMCQ1 markMediumSolve
- GATE CSE 2014 Set 3 · Q26An IP router implementing Classless Inter-domain Routing (CIDR) receives a packet with address 131.23.151.76. The router’s routing table has the following entries: Refer to the table below. The identifier of the output interface on which this packet will be forwarded is _____.NAT2 marksMediumDiagramSolve
- GATE CSE 2014 Set 3 · Q27Every host in an IPv4 network has a 1-second resolution real-time clock with battery backup. Each host needs to generate up to 1000 unique identifiers per second. Assume that each host has a globally unique IPv4 address. Design a 50-bit globally unique ID for this purpose. After what period (in seconds) will the…NAT2 marksMediumSolve
- GATE CSE 2014 Set 3 · Q28An IP router with a Maximum Transmission Unit (MTU) of 1500 bytes has received an IP packet of size 4404 bytes with an IP header of length 20 bytes. The values of the relevant fields in the header of the third IP fragment generated by the router for this packet areMCQ2 marksMediumSolve
- GATE CSE 2013 · Q37In an IPv4 datagram, the M bit is 0, the value of HLEN is 10, the value of total length is 400 and the fragment offset value is 300. The position of the datagram, the sequence numbers of the first and the last bytes of the payload, respectively areMCQ2 marksMediumSolve
- GATE CSE 2012 · Q23In the IPv4 addressing format, the number of networks allowed under Class C addresses isMCQ1 markEasySolve
- GATE CSE 2012 · Q34An Internet Service Provider (ISP) has the following chunk of CIDR-based IP addresses available with it: . The ISP wants to give half of this chunk of addresses to Organization A, and a quarter to Organization B, while retaining the remaining with itself. Which of the following is a valid…MCQ2 marksMediumSolve
What GATE tests in IPv4, CIDR and NAT
Concepts, patterns, formulas and traps distilled from past papers.
IPv4 testing in GATE CS focuses heavily on numerical datagram mechanics (fragmentation offset, payload size, header scaling factors), CIDR subnetting (subnet allocation, host ranges, bitwise masking, and longest prefix match forwarding), and IP header architecture (field modifications during transit, option field capacity, and encapsulated protocol numbers). Questions are evenly split between 1-mark conceptual/header checks and 2-mark multi-step arithmetic or routing table lookups.
Core concepts
- IPv4 Header Format (HLEN scaling factor of 4, Total Length, TTL, Protocol, Header Checksum, Identification, Flags, Fragment Offset scaling factor of 8)
- Datagram Fragmentation, MTU constraints, MF bit behavior, and Fragment Offset tracking
- CIDR Prefix Notation, Subnet Masking, and Network/Broadcast Address identification
- Variable Length Subnet Division and non-overlapping CIDR block partitioning
- Longest Prefix Matching forwarding logic in CIDR routing tables
- Router-induced header modifications at each forwarding hop vs static fields
- IP Options sizing limits (Record Route 40-byte options space, 3-byte header overhead)
- Layer 3 direct protocol encapsulation (ICMP=1, IGMP=2, OSPF=89) vs Layer 4 transport protocols (TCP=6, UDP=17 for RIP)
- Broadcast domain / subnet counting across point-to-point router links and LAN interfaces
Recurring question patterns
Datagram Fragmentation and Offset Calculation
CommonMCQ2 marks2014, 2013Given datagram size, header length, and link MTU, compute the number of fragments, payload bytes per fragment (strictly rounded to multiples of 8), fragment offset values, Total Length, and the More Fragments (MF) flag for a designated fragment.
CIDR Block Splitting and Subnet Allocation
CommonMCQ2 marks2019, 2012Divide a given CIDR block into smaller variable-length subnets (e.g., half as , quarter as ) and identify non-overlapping, valid subnet allocations, or determine whether given host IPs belong to the same subnet.
CIDR Longest Prefix Match Routing
OccasionalNAT2 marks2014Given a destination IPv4 address in dotted-decimal format and a CIDR routing table with prefix entries of varying lengths, find the output interface or next-hop by determining the longest matching binary prefix.
Subnet Boundary and Assignable Host IP Computation
OccasionalNAT2 marks2015Given an IP address with a CIDR prefix (e.g., ), perform bitwise masking to find the subnet ID, broadcast address, and the decimal value of a specific octet of the first or last usable host address.
IPv4 Header Fields and Router Transit Behavior
Commonmixed1 marks2025, 2024, 2015, 2014Identify which IPv4 header fields must change, may change, or remain unchanged during intermediate router forwarding (e.g., TTL decrement, Checksum recomputation, Fragment Offset) or identify encapsulated protocols directly in the Protocol field.
Header Options and Protocol Capacity Sizing
OccasionalNAT1.5 marks2017, 2014Calculate capacity constraints based on IPv4 header bounds (e.g., 60-byte max header size, 40-byte options space minus overhead) or allocate bit fields for composite identifiers combining IP addresses, timestamps, and sequence counters.
Network Topology Subnet Counting
OccasionalMCQ1 marks2022Given a network diagram with routers, Ethernet segments, firewalls, and servers, determine the total number of broadcast domains / subnets separated by router interfaces.
Formulas GATE uses
IPv4 Header Length in Bytes
Converting the 4-bit HLEN / IHL field value into physical byte length (min 20 bytes, max 60 bytes).
Fragment Offset Byte Position
Determining the relative starting payload byte index of an IPv4 fragment.
Maximum Fragment Data Payload
Partitioning an oversized IP datagram into fragments conforming to link MTU constraints.
Last Byte Index of Fragment Payload
Computing the sequence range of data bytes carried by a specific datagram fragment.
Subnet Block Size and Usable Host Count
Finding address ranges and host capacities for a prefix length .
Record Route Option Capacity
Calculating maximum IP address slots in the IPv4 Record Route option field.
Examiner traps in IPv4, CIDR and NAT
- Forgetting that HLEN is in 4-byte words while Fragment Offset is in 8-byte units.
- Failing to make intermediate fragment payload sizes exact multiples of 8 bytes before adding the header.
- Confusing the 0-indexed byte sequence arithmetic (adding payload size directly without subtracting 1 for the inclusive end byte).
- Selecting overlapping CIDR subnets when partitioning a parent block among multiple organizations.
- Overlooking that every point-to-point link between two routers constitutes a distinct subnet.
- Assuming RIP is directly encapsulated in IPv4 (it runs on top of UDP port 520, so the IP Protocol field is 17).
- Assuming Source IP address is modified by a standard forwarding router (it remains unchanged unless NAT is explicitly performed).
- Forgetting to subtract the 3-byte option overhead (Type, Length, Pointer) when calculating usable slots in the IPv4 Record Route option.
How questions are asked
- Compute fragment offset and byte sequence range from datagram header values
- Calculate the header field parameters (MF, Length, Offset) of the k-th fragment under a given link MTU
- Perform longest prefix match on a binary/dotted-decimal routing table
- Divide a CIDR prefix into disjoint non-overlapping subnets of specified sizes
- Identify which IP header fields must or may change across router hops (MSQ/MCQ)
- Count subnets/broadcast domains in a graphical or textual network topology
- Bit-budgeting and wrap-around time calculation for composite IP-based identifiers
- Calculate the decimal value of the last assignable host IP in a given CIDR block
Paper trends
Header field behavior questions transitioned from standard 1-mark MCQs to multi-correct MSQs requiring distinction between mandatory router changes (TTL, Checksum) versus conditional changes (Offset, Length, NAT-based Source IP).
2024, 2015, 2014
Addressing questions shifted from legacy classful network counting to CIDR-centric arithmetic (subnet splitting, usable host bounds, longest prefix matches).
2019, 2015, 2014, 2012
Recent 1-mark conceptual items assess precise protocol stack layering relationships through the IPv4 Protocol field (identifying direct IP encapsulation vs transport-layer encapsulation).
2025
Difficulty notes
Easy items (1 mark) test direct definitions: scaling factors of HLEN/Offset, recognizing fields always changed by routers (TTL, Checksum), identifying direct vs indirect IP encapsulation, or counting networks in simple subnets. Medium items (2 marks) require multi-stage arithmetic: fragmenting large datagrams with MTU overhead, determining the n-th fragment fields, Longest Prefix Match binary conversions of ambiguous octets, allocating non-overlapping subnets from a CIDR pool, or calculating counter wrap-around periods.