1

What happens if, say PC A(192.168.2.2) tries to send a packet to PC B(10.0.2.3) connected through LAN(only 2 computers are connected in this case PC A and PC B) as there is no router or a switch involved to forward the packet. Let me make my question more understandable.

1)Ive used static IP so that its possible for me to use IP adress of my choice.

2)Now if PC A is trying to send a packet to PC B, it first looks at the IP address. In this case, IP of PC B is 10.0.2.3 and judging from the IP it looks like its intended for another network.

3)The next step would be to send it to the default gateway, but in this case we only have used 2 PCs and are only connected through a LAN cable and there is neither a router nor a switch.

It can send an ARP request only if its sure that they are in the same network, right? So how does PC A send a packet to PC B without knowing its MAC address?

  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can provide and accept your own answer. – Ron Maupin Feb 19 '18 at 19:57
3

Packet forwarding decisions will always depend on the defined routes. There's only 3 outcome:

  1. Route defined, network reached: Forward (ARP request sent to find destination MAC address).
  2. Route not defined, default gateway: Forward (ARP request sent to find default gateway MAC address).
  3. Route not defined, no default gateway: Drop.

Without a router (gateway), you'll need to route the traffic yourself. Here's 2 solutions:

  • Add a route on each device that points to the other

  • (or) Add a default gateway on each device that points to the other

3

It doesn't work. I'm assuming 192.168.2.2 uses a subnet mask of /24 or /16. With no route to 10.0.2.3 and no default gateway, A has no way to send the packet.

You're correct in that ARP requests are only made for local destinations, they can't cross a router.

If you can set up both PCs with a mask of /0 (= all IPs are local) it'll work both ways. PC A will view B's IP address as local, ARP the IP and send the frame over Ethernet to B's MAC address - whether or not there's a switch in between (I'm boldly assuming you're using an Ethernet connection).

When setting a mask of /0 is a problem you can also set up a default route (0.0.0.0/0) to the local IP.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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