Computer Networking Basics

A router's routing table has four routes: 0.0.0.0/0 (next hop router A), 10.0.0.0/8 (router B), 10.1.0.0/16 (router C) and 10.1.2.0/24 (router D). To which router is a packet for 10.1.5.9 sent?

  1. ARouter B
  2. BRouter D
  3. CRouter C
Show answer and explanation

Answer: C. Router C

Of the routes that match the destination address, a router chooses the one with the longest (most specific) prefix. This is called longest prefix match. 10.1.5.9 matches 0.0.0.0/0, 10.0.0.0/8 and 10.1.0.0/16, but it is not in the 10.1.2.0/24 range (10.1.2.0 to 10.1.2.255). The longest of the matches is /16, so the packet goes to router C. 0.0.0.0/0 is the default route that matches every destination and is used only when no other route matches.

  • A. /8 also matches, but the longer /16 route matches too, so it is not chosen.
  • B. 10.1.5.9 is not within 10.1.2.0/24 (10.1.2.0 to 10.1.2.255), so it does not match.
  • C. Correct. It is the longest matching prefix, /16.
Practice this topic Back to topic

Related calculators

Books on Computer Networking Basics Ad

As an Amazon Associate I earn from qualifying purchases.

More Computer Networking Basics questions

  1. What is the role of the TTL (Time To Live) field in the IPv4 header?
  2. Which correctly describes dynamic routing?
  3. Which correctly describes UDP?
  4. In the three-way handshake that establishes a TCP connection, what is the correct order of the packets exchanged?
  5. A client makes a new HTTPS connection (TLS 1.3 over TCP) to a web server with a round-trip time (RTT) of 100 ms. Roughly how long does it take until the response to the first request starts to arrive? Assume DNS resolution is already done, and ignore server processing time and data transfer time.