1

Let's say there are two pc's and they are connected via. Router.

Here is the image that explain everything. enter image description here

The pc1 has IP address - 1.1.1.4 and pc2 has IP address - 1.1.1.8. The router IP address is 2.2.2.7. When pc11 wants to communicate to pc2, then do they need to speak to router? In my opinion, when the destination and src ip address is in the same subnet - there will be an arp request to get the destination machine address. So, the router will not come into the picture. Do you agree with it? So, basically the ip address will be broadcasted to know the mac address. If the arp succeeds, then the destination is found and the communication can happen. On the other hand, if the destination ip address is in the other subnet then the router will come into the picture and will route the packet to the destination ip address. Then again the arp will be done to reach out the destination machine. Is my understanding correct?

7
  • 2
    By Jove! You've got it! One small point: The router's IP address would normally be on the same subnet so the PC's can reach it.
    – Ron Trunk
    Aug 25, 2014 at 11:43
  • @Ron, the router's IP address must be on the same subnet as the PC's trying to reach it. ;-) "Normally" sounds optional. Aug 26, 2014 at 9:40
  • Updated my question to give more details. Aug 26, 2014 at 11:20
  • Figure 1 doesn't make sense. The router has a separate IP address for each L3 interface. Those IP addresses MUST be in the same subnets as the devices attached to them (OK, GNE?:-)). If your router is really a L3 switch, the two devices could be in the same subnet, but then the switch would have a virtual interface also on that subnet.
    – Ron Trunk
    Aug 26, 2014 at 12:05
  • @Ron - In case the router has a different IP, then how will they communicate. I know that it is not the ideal case. Aug 26, 2014 at 12:17

1 Answer 1

2

You are mostly correct in your assumptions.

If the destination is within the same subnet (determined by network mask) then the source will send a layer 2 ARP request for the destination MAC address. If the destination is outside of the subnet, the source will send a layer 2 ARP request for the gateway's MAC address. Only when the destination address is outside of the subnet is the router involved.

When you speak of the router on a different subnet, this won't work for what you are describing. The routers job is to forward packets that are destined for places outside of the subnet, it cannot operate without access to your local network segment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.