1

Answer provides the procedure to find the network address when a packet with destination IP(198.51.100.223/21) is reached at a router.

But a network packet has the destination IP 198.51.100.223 in the IP packet but does not include /21. Router looks up the table of network prefixes with subnet mask(for ex: 198.51.96.0/21).


Given a packet with destination IP(198.51.100.223) receiving at a router, How does a router determine its network address? to route the packet accordingly...

Ron Maupin
  • 102,040
  • 26
  • 123
  • 202
overexchange
  • 113
  • 5

1 Answers1

1

IP packets only have addresses, not masks or networks. An IPv4 address is simply a 32-bit number.

Routers have routing tables that consist of networks. A router will look for a routing table entry (network) that most closely matches the destination address of the IP address on the packet. If no possible match is found, the packet is discarded. If multiple matches are found, the longest match (most matched bits of the address and network) is used.

Some routers have default routes with the 0.0.0.0/0 network. Every IPv4 network is a subnet of that network, so if there are no other (longer) matches, that route will be used, preventing any packets from being discarded.

A router will take the destination IP address, and it will compare it to the routing table entries for the mask length number of bits. If every bit of the destination address for the length of the routing table mask matches the routing table entry, then the router has a match.

Ron Maupin
  • 102,040
  • 26
  • 123
  • 202