Will packets send to the same subnet go through routers?

In the absence of a specific route defined, A will consult its routing table, deduce that the destination is on the local network, and arp for it.

If you don't want it to do this, then add a route saying where the packet should be sent. Lets say your VPN is at 10.0.1.6:

route add -host 10.0.1.4 gw 10.0.1.6

or

route add 10.0.1.4 mask 255.255.255.255 10.0.1.6

This will add a more specific route than the one created by the local network, and so will force the packet to be sent to 10.0.1.6.

Ideally, you would never have devices with the same network address on different subnets.


There are two point here to answer:

Normal situation:

One a normal network (e.g. no VPN) this is what happens:

A wants to send to B

  • A look in the routing table to see how it should transmit its data.
  • A finds an entry for hosts on the same subnet.
  • A send the package to the NIC on that subnet, addressed to B.

No router is involved. There is no 'using ARP by datalink level' (whatever that may mean). The IP stack on A will simple address the packet to B on a NIC selected from the routing table. If A already has B's MAC cached it will simply fire off its packet. If it does not have the MAC then it will first need to do an ARP discovery before it can assemble the packet.

VPN

Now a VPN changes things a bit.

If B is a VPN host it will still seem to be on the same subnet. However some extra mechanism is in place to intercept data send to hosts on the VPN. Usually this is in the form of a different NIC which will acts as a tunnel to the other side of the VPN. Other then the VPN software on both sides no routers are involved.