High yield ●●●

🌐 IP Addressing & Network Layer

Why it matters: The biggest CN topic: subnet and CIDR calculations, longest-prefix forwarding and IP fragmentation arrive nearly every year.

Subtopics

Each subtopic has its own page: idea, why, how, example, play, check. Mark each one understood when it clicks. 0 of 5 done.

Formulas

Hosts in a /n block
2^(32 − n) − 2 usable
Network address
IP AND mask
Broadcast address
network OR (NOT mask)
Prefix for h hosts
smallest 32 − b with 2^b − 2 ≥ h
Fragment payload
floor((MTU − hdr) / 8) × 8
Fragment offset
bytes before this fragment / 8
Classful network counts
A: 2^7, B: 2^14, C: 2^21
ARP request
dest MAC = FF:FF:FF:FF:FF:FF (broadcast)

What GATE asks from this

Question types seen repeatedly in past papers. More stars means more frequent.

★★★
Subnet membership / network address / usable hosts
AND the addresses with the mask; compare network addresses.
★★★
Number of fragments, last-fragment size, offset value
Round the payload down to a multiple of 8; repeat across two links.
★★★
Forwarding table: longest-prefix match and aggregation
Find all matching prefixes and pick the longest; merge blocks for aggregation.
★★★
Valid CIDR block / allocation
Check alignment, size = power of two, no overlap.
★★★
ARP, NAT, header fields modified by routers
Which MAC is the destination; which fields change (TTL, checksum, source IP/port with NAT).

Ratings are approximate, based on recurring patterns in past GATE CSE papers.

Previous year questions

26 real questions from the official GATE CSE papers (2012 to 2025), newest first, each with the official answer key and a worked solution. Questions are the property of the GATE organising institutes; this copy is for your personal study.

26 questions · 0 correct of 0 attempted · marks 0 / 41

Year:
GATE 2025 CS2 · Q16MCQ1 mark
Consider the following statements: (i) Address Resolution Protocol (ARP) provides a mapping from an IP address to the corresponding hardware (link-layer) address. (ii) A single TCP segment from a sender S to a receiver R cannot carry both data from S to R and acknowledgement for a segment from R to S. Which ONE of the following is CORRECT?
GATE 2025 CS2 · Q18MCQ1 mark
A 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?
GATE 2025 CS2 · Q23MCQ1 mark
Consider a network that uses Ethernet and IPv4. Assume that IPv4 headers do not use any options field. Each Ethernet frame can carry a maximum of 1500 bytes in its data field. A UDP segment is transmitted. The payload (data) in the UDP segment is 7488 bytes. Which ONE of the following choices has the CORRECT total number of fragments transmitted and the size of the last fragment including IPv4 header?
GATE 2025 CS1 · Q40MCQ2 marks
A packet with the destination IP address 145.36.109.70 arrives at a router whose routing table is shown. Which interface will the packet be forwarded to? Routing table (subnet address, subnet mask, interface): 145.36.0.0 /16 → E1; 145.36.128.0 /17 → E2; 145.36.64.0 /18 → E3; 145.36.255.0 /24 → E4; Default → E5.
GATE 2025 CS1 · Q57NAT2 marks
Suppose a message of size 15000 bytes is transmitted from a source to a destination using IPv4 protocol via two routers as shown in the figure (Source → Router-1 with MTU = 5000 bytes → Router-2 with MTU = 3000 bytes → Destination). Each router has a defined maximum transmission unit (MTU) as shown in the figure, including IP header. The number of fragments that will be delivered to the destination is ______. (Answer in integer)
GATE 2024 CS2 · Q23MSQ1 mark
Node X has a TCP connection open to node Y. The packets from X to Y go through an intermediate IP router R. Ethernet switch S is the first switch on the network path between X and R. Consider a packet sent from X to Y over this connection. Which of the following statements is/are TRUE about the destination IP and MAC addresses on this packet at the time it leaves X?

One or more options may be correct. Select all that apply, then submit.

GATE 2024 CS2 · Q28MSQ1 mark
Which of the following statements about IPv4 fragmentation is/are TRUE?

One or more options may be correct. Select all that apply, then submit.

GATE 2024 CS1 · Q31MSQ1 mark
Which of the following fields is/are modified in the IP header of a packet going out of a network address translation (NAT) device from an internal network to an external network?

One or more options may be correct. Select all that apply, then submit.

GATE 2024 CS2 · Q32MSQ1 mark
Which of the following fields of an IP header is/are always modified by any router before it forwards the IP packet?

One or more options may be correct. Select all that apply, then submit.

GATE 2024 CS2 · Q38MCQ2 marks
Which one of the following CIDR prefixes exactly represents the range of IP addresses 10.12.2.0 to 10.12.3.255?
GATE 2024 CS1 · Q58NAT2 marks
Consider the entries shown below in the forwarding table of an IP router. Each entry consists of an IP prefix and the corresponding next hop router for packets whose destination IP address matches the prefix. The notation "/N" in a prefix indicates a subnet mask with the most significant N bits set to 1. Prefix → next hop: 10.1.1.0/24 → R1; 10.1.1.128/25 → R2; 10.1.1.64/26 → R3; 10.1.1.192/26 → R4. This router forwards 20 packets each to 5 hosts. The IP addresses of the hosts are 10.1.1.16, 10.1.1.72, 10.1.1.132, 10.1.1.191, and 10.1.1.205. The number of packets forwarded via the next hop router R2 is ______.
GATE 2024 CS1 · Q65NAT2 marks
Consider sending an IP datagram of size 1420 bytes (including 20 bytes of IP header) from a sender to a receiver over a path of two links with a router between them. The first link (sender to router) has an MTU (Maximum Transmission Unit) size of 542 bytes, while the second link (router to receiver) has an MTU size of 360 bytes. The number of fragments that would be delivered at the receiver is ______.
GATE 2023 · Q65NAT2 marks
The forwarding table of a router is shown below. Subnet 200.150.0.0, mask 255.255.0.0, interface 1; subnet 200.150.64.0, mask 255.255.224.0, interface 2; subnet 200.150.68.0, mask 255.255.255.0, interface 3; subnet 200.150.68.64, mask 255.255.255.224, interface 4; default, interface 0. A packet addressed to a destination address 200.150.68.118 arrives at the router. It will be forwarded to the interface with ID ______.
GATE 2022 · Q55MSQ2 marks
Consider the routing table of an organization's router: 12.20.164.0 / 255.255.252.0 → R1; 12.20.170.0 / 255.255.254.0 → R2; 12.20.168.0 / 255.255.254.0 → Interface 0; 12.20.166.0 / 255.255.254.0 → Interface 1; default → R3. Which of the following prefixes in CIDR notation can be collectively used to correctly aggregate all of the subnets in the routing table?

One or more options may be correct. Select all that apply, then submit.

GATE 2021 Set 1 · Q8MCQ1 mark
Consider the following two statements. S1: Destination MAC address of an ARP reply is a broadcast address. S2: Destination MAC address of an ARP request is a broadcast address. Which one of the following choices is correct?
GATE 2021 Set 1 · Q45MSQ2 marks
Consider two hosts P and Q connected through a router R. The maximum transfer unit (MTU) value of the link between P and R is 1500 bytes, and between R and Q is 820 bytes. A TCP segment of size 1400 bytes was transferred from P to Q through R, with IP identification value as 0x1234. Assume that the IP header size is 20 bytes. Further, the packet is allowed to be fragmented, i.e., Don't Fragment (DF) flag in the IP header is not set by P. Which of the following statements is/are correct?

One or more options may be correct. Select all that apply, then submit.

GATE 2020 · Q15MCQ1 mark
Consider the following statements about the functionality of an IP based router. I. A router does not modify the IP packets during forwarding. II. It is not necessary for a router to implement any routing protocol. III. A router should reassemble IP fragments if the MTU of the outgoing link is larger than the size of the incoming IP packet. Which of the above statements is/are TRUE?
GATE 2020 · Q38MCQ2 marks
An organization requires a range of IP addresses to assign one to each of its 1500 computers. The organization has approached an Internet Service Provider (ISP) for this task. The ISP uses CIDR and serves the requests from the available IP address space 202.61.0.0/17. The ISP wants to assign an address space to the organization which will minimize the number of routing entries in the ISP's router using route aggregation. Which of the following address spaces are potential candidates from which the ISP can allot any one to the organization? I. 202.61.84.0/21 II. 202.61.104.0/21 III. 202.61.64.0/21 IV. 202.61.144.0/21
GATE 2019 Set 2 · Q28MCQ2 marks
Consider 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?
GATE 2019 Set 2 · Q29MCQ2 marks
Suppose that in an IP-over-Ethernet network, a machine X wishes to find the MAC address of another machine Y in its subnet. Which one of the following techniques can be used for this?
GATE 2018 · Q54NAT2 marks
Consider an IP packet with a length of 4,500 bytes that includes a 20-byte IPv4 header and a 40-byte TCP header. The packet is forwarded to an IPv4 router that supports a Maximum Transmission Unit (MTU) of 600 bytes. Assume that the length of the IP header in all the outgoing fragments of this packet is 20 bytes. Assume that the fragmentation offset value stored in the first fragment is 0. The fragmentation offset value stored in the third fragment is ______.
GATE 2016 Set 1 · Q24MCQ1 mark
Which one of the following protocols is NOT used to resolve one form of address to another one?
GATE 2016 Set 1 · Q53NAT2 marks
An IP datagram of size 1000 bytes arrives at a router. The router has to forward this packet on a link whose MTU (maximum transmission unit) is 100 bytes. Assume that the size of the IP header is 20 bytes. The number of fragments that the IP datagram will be divided into for transmission is ______.
GATE 2013 Code A · Q37MCQ2 marks
In 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 are
GATE 2012 Code A · Q23MCQ1 mark
In the IPv4 addressing format, the number of networks allowed under Class C addresses is
GATE 2012 Code A · Q34MCQ2 marks
An Internet Service Provider (ISP) has the following chunk of CIDR-based IP addresses available with it: 245.248.128.0/20. 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 allocation of addresses to A and B?

Common traps

Payload per fragment must be a multiple of 8; the last fragment may be any size.
The offset is in 8-byte units, so offset 300 means byte 2400.
A router does not reassemble fragments; only the destination does.
A /30 block has 4 addresses but only 2 usable hosts.
ARP request is broadcast; the reply is not.