- Get link
- X
- Other Apps
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?
| Subnet Address | Subnet Mask (CIDR) | 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 |
The correct answer is option (A) E3.
Routers use the Longest Prefix Match rule. We check the destination IP 145.36.109.70 against each entry. It matches both the /16 network (to E1) and the /18 network (to E3). Since /18 is a longer (more specific) prefix than /16, the router chooses the route to interface E3.
To determine the correct outgoing interface, a router performs a bitwise AND operation between the destination IP address and the subnet mask of each entry in its routing table. It then compares the result with the subnet address of that entry. If multiple routes match, the router uses the **Longest Prefix Match** rule.
Step 1: Convert the Destination IP to Binary
The destination IP is 145.36.109.70. Since our masks are /16, /17, /18, and /24, the second and third octets are the most important for comparison.
| 145 | 36 | 109 | 70 |
| 10010001 | 00100100 | 01101101 | 01000110 |
Step 2: Check Each Route in the Table
Route 1: 145.36.0.0 /16 to E1
- The /16 mask means we check the first 16 bits.
- Destination IP's first 16 bits:
10010001.00100100(145.36) - Subnet Address's first 16 bits:
10010001.00100100(145.36) - Result: MATCH (Prefix length: 16)
Route 2: 145.36.128.0 /17 to E2
- The /17 mask means we check the first 17 bits.
- Destination IP's first 17 bits:
10010001.00100100.0... (from01101101) - Subnet Address's first 17 bits:
10010001.00100100.1... (from10000000) - The 17th bits (marked in bold) are different.
- Result: NO MATCH
Route 3: 145.36.64.0 /18 to E3
- The /18 mask means we check the first 18 bits.
- Destination IP's first 18 bits:
10010001.00100100.01... (from01101101) - Subnet Address's first 18 bits:
10010001.00100100.01... (from01000000) - The first 18 bits are identical.
- Result: MATCH (Prefix length: 18)
Route 4: 145.36.255.0 /24 to E4
- The /24 mask means we check the first 24 bits (3 octets).
- Destination IP's first 24 bits:
145.36.109 - Subnet Address's first 24 bits:
145.36.255 - The third octets (109 and 255) are different.
- Result: NO MATCH
Step 3: Apply the Longest Prefix Match Rule
We have found two matching routes:
- To Interface E1 with a prefix length of 16.
- To Interface E3 with a prefix length of 18.
The Longest Prefix Match rule states that the router must choose the most specific route, which is the one with the longest subnet mask (highest prefix number). Since 18 > 16, the router will forward the packet to interface E3.
- Kurose, J. F., & Ross, K. W. (2016). Computer Networking: A Top-Down Approach. Pearson. (Chapter 4: The Network Layer).
- Tanenbaum, A. S., & Wetherall, D. J. (2010). Computer Networks. Prentice Hall. (Chapter 5: The Network Layer).
- Get link
- X
- Other Apps
Comments
Post a Comment
Ask you doubt here