0

Imagine we have 3 subnets attached to one router:

Host A: 192.168.1.1 Netmask: 255.255.255.0
Host B: 192.168.2.2 Netmask: 255.255.255.0
Host C: 192.168.2.3 Netmask: 255.255.0.0

If Host A sends an IP packet to the ip 192.168.2.3, how does the router knows to which network the ip belongs to? 192.168.2.3 could be a host of the network 192.168.0.0/16 or an host of 192.168.2.0/24. What happens if both networks have an host with equal ip addresses? e.g.: Host C: 192.168.2.3/16 and Host C: 192.168.2.3/24.

Sebi2020
  • 103
  • 2

1 Answers1

1

What happens if both networks have an host with equal ip addresses?

Longest Prefix Match

https://en.wikipedia.org/wiki/Longest_prefix_match

Greg Askew
  • 35,880
  • 5
  • 54
  • 82
  • And in the first scenario? How does the router know to which network 192.168.2.3 belongs to? – Sebi2020 Apr 21 '20 at 14:50
  • @Sebi2020: same. There should be entries in the routing table for destination networks. The most specific/longest prefix match is selected. – Greg Askew Apr 21 '20 at 14:53