Skip to content
Official PYQ · 2004

GATE CS 2004 Q55 — Fragmentation and IP Addressing, IPv4, CIDR

Explain with AI

The routing table of a router  is shown below:
DestinationSubnet MaskInterface128.75.43.0255.255.255.0Eth0128.75.43.0255.255.255.128Eth1192.12.17.5255.255.255.255Eth3DefaultEth2\begin{array}{|l|l|l|} \hline \textbf{Destination} & \textbf{Subnet Mask} & \textbf{Interface} \\ \hline \text{128.75.43.0} & \text{255.255.255.0} & \text{Eth$0$} \\ \hline\text{128.75.43.0} & \text{255.255.255.128} & \text{Eth$1$} \\ \hline\text{192.12.17.5} & \text{255.255.255.255} & \text{Eth$3$}\\ \hline \text{Default} & \text{} & \text{Eth$2$}\\ \hline\end{array}
On which interface will the router forward packets addressed to destinations 128.75.43.16128.75.43.16 and 192.12.17.10192.12.17.10 respectively?

Choose one option
View worked solution

Answer: A

To determine the forwarding interface for each destination IP address, we perform a bitwise AND operation between the destination IP and the subnet mask of each entry in the routing table. If multiple entries match, the router selects the interface corresponding to the Longest Prefix Match (the one with the longest subnet mask / most 1s).

1. For Destination IP: 128.75.43.16128.75.43.16

  • Row 1 (Eth0):
    Subnet Mask: 255.255.255.0255.255.255.0 (/24)
    Bitwise AND: 128.75.43.16 AND 255.255.255.0=128.75.43.0128.75.43.16 \text{ AND } 255.255.255.0 = 128.75.43.0
    Result: Match (Prefix length = 24)
  • Row 2 (Eth1):
    Subnet Mask: 255.255.255.128255.255.255.128 (/25)
    Bitwise AND: 128.75.43.16 AND 255.255.255.128128.75.43.16 \text{ AND } 255.255.255.128
    Since the last octet 1616 in binary is 00010000200010000_2 and 128128 is 10000000210000000_2, their bitwise AND is 00.
    Thus, the result is 128.75.43.0128.75.43.0.
    Result: Match (Prefix length = 25)
  • Row 3 (Eth3):
    Subnet Mask: 255.255.255.255255.255.255.255 (/32)
    Bitwise AND: 128.75.43.16 AND 255.255.255.255=128.75.43.16≠192.12.17.5128.75.43.16 \text{ AND } 255.255.255.255 = 128.75.43.16 \neq 192.12.17.5
    Result: No Match

Since both Row 1 and Row 2 match, we apply the Longest Prefix Match rule. Row 2 has a longer subnet mask (/25 vs /24). Therefore, the packet is forwarded to Eth1.

2. For Destination IP: 192.12.17.10192.12.17.10

  • Row 1 (Eth0): 192.12.17.10 AND 255.255.255.0=192.12.17.0≠128.75.43.0192.12.17.10 \text{ AND } 255.255.255.0 = 192.12.17.0 \neq 128.75.43.0 (No Match)
  • Row 2 (Eth1): 192.12.17.10 AND 255.255.255.128=192.12.17.0≠128.75.43.0192.12.17.10 \text{ AND } 255.255.255.128 = 192.12.17.0 \neq 128.75.43.0 (No Match)
  • Row 3 (Eth3): 192.12.17.10 AND 255.255.255.255=192.12.17.10≠192.12.17.5192.12.17.10 \text{ AND } 255.255.255.255 = 192.12.17.10 \neq 192.12.17.5 (No Match)
  • Default (Eth2): Matches when no other specific route matches.

Therefore, the packet is forwarded to Eth2.

Thus, the interfaces are Eth1 and Eth2 respectively.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Fragmentation and IP Addressing, IPv4, CIDR questions