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 and But what happened when they are like the following:

If hostA is and hostB is, hostA gets its own network ID: & ->

then hostA gets hostB's network ID: & ->

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

then hostB gets hostA's network ID: & ->

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?


1 Answer 1


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 would work.

You must log in to answer this question.

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