5

Let's suppose I have 3 computers A, B and C connected to the same switch with only the native VLAN active. A and B belong to the same network, let's say that their IP addresses are 192.168.1.1/24 for A and 192.168.1.2/24 for B. C belongs to another network like 192.168.2.1/24. Since a switch works on the second layer of the OSI model, it won't know which computers are in the same network or not.

What prevents computer C from answering an ARP request coming from the computer A?

4

ARP is a broadcast, but it is looking for a specific address, and Computer C would not have that address, so it won't answer.

A host doesn't ARP for an IP address it knows is not on its network. Instead, it will send the traffic destined for the other network to its configured gateway, and it may need to ARP for the gateway's layer-2 address, but it won't even try for a host which is not in its own network based on its configured IP address and mask.

Computers A and B will never ARP for computer C's address since, based on their IP addresses and masks, they know that Computer C's address is not on their network. When Computers A and B want to send something to Computer C, they realize it is on another network, so they will send it to the gateway each has configured.

  • 1
    ... unless the route table indicates the other network is "on the wire" (eg. 192.168.2.0/24 via eth0) In the end, there is nothing preventing any device within a broadcast domain from answering the traffic it seeing. (that's the realm of port-security) – Ricky Beam Oct 27 '15 at 18:05
5

You are correct that on a layer 2 level all computers will receive broadcast packets, including ARP requests for IP addresses of networks other than their own. The IP stack of those computers will however discard those packets as they recognise it is outside of their own local network.

  • Under normal circumstances. If a bad apple wants to lie, it can. – Ricky Beam Oct 27 '15 at 18:06
1

The syntax of an ARP request is something like this:

Who has x.x.x.y?  Tell x.x.x.y2

But switch see is x.x.x.y and x.x.x.y2 are on the same network(It has his ARP table who match MAC with IP).

If you does a capture, you can see that on the same switch, that if from one network to another, you tried to make a ping request, this one "Who has x.x.x.y? Tell y.y.y.y2" never happens.

Switch only conmunicates equipments on the same network

1

Since switch works on the second layer of the OSI model, it won't know which computers are in the same network or not.

To be accurate, based on your description, all three of your hosts are on the same network from a L2 perspective and the switch knows this to be the case. The switch doesn't care about what IP addresses are as it is only using the L2 addressing.

L2 broadcasts and unicast floods will be received by all three computers in your example. For example, if A ARPs for B, C will also see this broadcast.

What forbiddens computer C to answer an ARP request coming from the computer A?

Nothing on the switch prevents C from answering a request from A.

However, in this example, A will never send a request to C. If A has traffic for C, A will use it's own IP address and mask to determine if C is on the local network or not. In this case it is not, so A will then look to it's routing table to determine where to forward this traffic (on most computers this will typically be the default route or gateway).

Let's extend this example a bit and say that B is misconfigured with a /22 mask (smallest network to include both 192.168.1.0/24 and 192.168.2.0/24) instead of the /24 it should have. If B had traffic for C, it would determine that C is on the local network and B would ARP for C. When C receives this ARP request, it should not respond as it would determine that B is not on the local network.

0

What prevents computer C from answering an ARP request coming from the computer A?

If computer A sends an ARP request for computer C's IP address then computer C will answer it.

Whether computer A will send such a request depends on how things are configured.

Normally computer A will look up computer C's IP address in it's routing table. Based on this table it will determine that the "next hop IP address" is the IP of it's default gateway. It will then look up the default gateways IP address in it's ARP table and if needed send an ARP request for the default gateway. In this process computer A never ARPs for computer Cs IP address.

However there are several scenarios in which computer A may make an ARP request for computer C. For example

  • The administrator of computer A manually adds a routing table entry telling it that computer C is on-link.
  • The default gateway sends an ICMP redirect on seeing the first packet from A to C and A accepts it.
  • Computer A has no default gateway configured. In this case some operating systems will ARP for all addresses.

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.