1

I read about the rules of how hosts communicate with each other. Let's say hostA and hostB. hostA gets its own network ID by bitwise-and its ip address and its mask, then gets hostB's network ID by bitwise-and hostB's ip address and hostA's mask. If the results are the same, then they are in the same network segment.

Assuming hostA doesn't know hostB's MAC address: if they are in the same segment, hostA sends ARP request to switch and finally gets hostB's MAC address; if they are not in the same segment, hostA uses gateway MAC address as destination MAC address and hostB's ip address as destination ip address, and send the frame to gateway. That is how it works.

I can understand when the two hosts' ip addresses are like 192.168.1.1/24 and 192.168.1.2/24. But what happened when they are like the following:

If hostA is 192.168.0.1/16 and hostB is 192.168.1.1/24, hostA gets its own network ID:

192.168.0.1 & 255.255.0.0 -> 192.168.0.0

then hostA gets hostB's network ID:

192.168.1.1 & 255.255.0.0 -> 192.168.0.0

So hostA thinks they are in the same segment. But for hostB, hostB gets its own network ID:

192.168.1.1 & 255.255.255.0 -> 192.168.1.0

then hostB gets hostA's network ID:

192.168.0.1 & 255.255.255.0 -> 192.168.0.0

So hostB thinks hostA in a different segment.

How do they communicate in this case? For example, they don't know each other's MAC address, hostA uses one way to find hostB and hostB uses another way to find hostA?

Thanks,

1 Answer 1

0

it works exactly as you described. HostA will believe that HostB is on the same network segment so will ARP for HostB's MAC Address. it wont get the router involved at all.

When HostB initiates a conversation it might see that HostA is on a different network segment and send its traffic to the Router, and the router might be able to pass it on but it doesn't matter because when HostA tries to reply it will again believe that HostB is on the same network segment and ARP for its MAC Address.

In short the IP addressing scheme wont work and one of the segments needs to be changed. Changing the Network ID of the segment HostA is on the 192.168.0.0/24 would work.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .