IAE Academy

GATE 2024 CS2 Q.23: solution and answer

GATE 2024 · CS2Q.23 · 1 mark · MSQ

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?

  1. (A)

    The destination IP address is the IP address of R

  2. (B)

    The destination IP address is the IP address of Y

  3. (C)

    The destination MAC address is the MAC address of S

  4. (D)

    The destination MAC address is the MAC address of Y

See the question in the paper

Answer and solution

ANSWER

Only (B) is true: the destination IP is Y's, while the destination MAC is R's.

Official answer: BSource: Official answer key, GATE 2024 CS2 (IISc Bengaluru)

  1. The IP header carries end-to-end addresses. The packet is meant for Y, so the destination IP is the IP address of Y, and a router does not change it when forwarding. So (B) is true and (A) is false.

  2. X and Y are on different networks, because the path between them includes the router R. X sees that Y is not in its own subnet, so it hands the packet to its default gateway, which is R.

  3. An Ethernet frame is addressed to the next hop on the same link. X uses ARP to find the MAC address of R, so the destination MAC on the frame leaving X is the MAC address of R.

  4. Switch S works at layer 2 and is transparent to the frame. It forwards the frame by looking up the destination MAC address, and the frame is not addressed to S. So (C) is false.

  5. The MAC address of Y is not the destination MAC on the X to R link. It appears only on the last link, between the final router and Y. So (D) is false.

  6. Only (B) is true.

KEY IDEA

The destination IP address stays the same from source to destination. The destination MAC address is rewritten at every hop and always names the next hop on the current link, which for X is the default gateway R.

WATCH OUT FOR

Choosing (A) by thinking the IP address also points to the next hop, or choosing (D) by thinking the MAC address is end-to-end. Another mistake is choosing (C), because a switch is only a pass-through at layer 2 and never the addressee of the frame.

From the GATE 2024 CS2 paper. Every question of this paper · Download the full paper · All 20 IPv4 questions, with notes

More IPv4 questions