Router XX has forwarding table:
Network/Mask Next_Hop
170.211.220.0/24 deliver directly
170.211.220.0/22 184.129.184.1
170.211.208.0/22 184.129.170.1
170.211.216.0/21 184.129.178.1
170.211.216.0/23 184.129.172.1
0.0.0.0/0 184.129.178.1

Explain what router XX will do with packets with the following destination addresses. Be sure to use longest prefix routing.
a. 170.211.218.17
b. 170.211.220.108
c. 170.211.222.44
d. 170.211.218.128
e. 184.129.184.1
f. 170.211.213.54
g. 170.211.211.20
h. 170.211.217.17
i. 170.212.216.5
j. 170.211.219.32

Any help would be much appreciated! I'm having trouble figuring out where/what these will be doing/going

Dani AI

Generated

Good call by — longest-prefix (most specific) routing is the deciding rule here. The table contains overlapping prefixes (for example 170.211.220.0/24 vs 170.211.220.0/22 and 170.211.216.0/23 vs 170.211.216.0/21), so an address falling into more than one of those ranges will match the entry with the larger prefix length (/24 is more specific than /22; /23 is more specific than /21). 0.0.0.0/0 is the default used only when no other entry matches.

A reliable manual method is: convert each prefix to its mask, compute the network portion of the destination by bitwise AND, and compare that network against the routing entries; pick the match with the longest mask. A compact example of the network calculation:

dest      = 10.1.2.134
mask (/24)= 255.255.255.0
network   = dest & mask  -> 10.1.2.0
Compare this result to each route.network; the longest matching prefix wins.

A quick shortcut for IPv4 classroom problems: use block sizes in the third octet — /21 → blocks of 8, /22 → 4, /23 → 2, /24 → 1. That makes it easy to see ranges without binary math (e.g., a /21 anchored at x.y.216.0 covers x.y.216.0–x.y.223.255). Also note a router forwards packets toward a route’s next hop IP; if a destination equals a next-hop address the router still consults its table and must have a reachable path (and ARP/neighbor entry) to that next hop for forwarding to succeed.

Practical checks (CLI): verify table entries and specificity with commands like show ip route (Cisco) or ip route get <addr> (Linux). For exam-style questions, test the most-specific masks first to reduce work and avoid overlooking overlapping entries.

Recommended Answers

All 3 Replies

You can use this information to help you with figuring out which entry to use in the routing table. Since you mentioned longest prefix routing, the most specific entry with the highest subnet mask will be used.

170.211.220.0 /24 170.211.220.1 - 170.211.220.254
170.211.220.1 /22 170.211.220.1 - 170.211.223.254
170.211.208.0 /22 170.211.208.1 - 170.211.211.254
170.211.216.0 /21 170.211.216.1 - 170.211.223.254
170.211.216.0 /23 170.211.216.1 - 170.211.217.254

For the following destination addresses, the packets will go to the following interface:

a. 170.211.218.17 - 184.129.178.1
b. 170.211.220.108 - directly
c. 170.211.222.44 - 184.129.184.1
d. 170.211.218.128 - 184.129.178.1
e. 184.129.184.1 - 184.129.178.1
f. 170.211.213.54 - 184.129.178.1
g. 170.211.211.20 - 184.129.170.1
h. 170.211.217.17 - 184.129.172.1
i. 170.212.216.5 - 184.129.178.1
j. 170.211.219.32 - 184.129.178.1

Cool thanks so much for your help! Now I can do the rest of them with a breeze, thanks again :) !

Not a problem. Glad to hear this info helped.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.