0

I'm trying to understand how this works.. I have 2 hosts with these IP addresses:

m1: 192.168.0.1/24

m2: 192.168.1.1/24

As you can see, they are on different network.. And in my case, they are connected to a single switch s1. My question is: why am I able to do the command

arping 192.168.1.1

from m1 to reach m2 and get a reply from m2?

As far as I know, since these hosts are on different network, they shouldn't communicate..

Another similar case I tried is to connect another switch s2 directly to s1 and connect

m3: 192.168.2.1/24

m4: 192.168.3.1/24

to this new s2. Again I can do the arping command from m1 to say m3 or m4 and get a reply..

I'm not using any router in this configuration..

Can someone explain what is going on? Thank you

1 Answer 1

2

As the command name arping implies, it does not work the IP layer/layer 3 of the network OSI model, but rather on layer 2 (Ethernet) and is responsible to lookup MAC addresses which are connected to an IP address.

So basically arping does

  • Request who-has 192.168.1.1, which is a broadcast
  • Reply 192.168.1.1 is-at 52:54:00:6f:ef:de

The ARP layer does work differently than the IP stack and the answer is a MAC address not an ICMP echo reply like with ping.
This ARP lookup mechanism does work on switch domains and cannot be routed, whereas with the IP layer can you route between different networks.

4
  • I have in my mind that m1 incapsulate an ethernet frame and sends it to the switch, which will then send to all his ports (broadcast) and then m2 will receive that frame (in the 2nd example the frame from m1 will be send to the port where the s2 is connected to and s2 will broadcast the frame to its ports, right?). When m2 receive the frame, how can he check the ip adress between the 2 levels? Doesn't it have to go to at least level 3 to check if m2 has that ip and then create a reply?
    – User1254
    Nov 17, 2018 at 18:15
  • There are no IP addresses at OSI layer 2, only MAC addresses.
    – Thomas
    Nov 17, 2018 at 18:20
  • Yes, i understand that, what i don't understand is that arping is using an IP address to know the MAC address of m2.. So how can m2 reply? Doesn't m2 has to "check" that it has that IP address and only then it can reply? Doesn't this mean that m2 has to like "raise up" to level 3 to check if it has that ip? I'm sorry, that's confusing to me..
    – User1254
    Nov 17, 2018 at 18:46
  • 1
    ARP is just a lookup mechanism and does not really interact with the IP stack. Via broadcast, all hosts on the switch-domain are asked if they have a the IP address in question and answer with their MAC address. The answer is returned on the layer 2 again.
    – Thomas
    Nov 17, 2018 at 19:03

You must log in to answer this question.

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