Assuming there is no ARP cache in any nodes, and switch table is empty and IP addresses of source and destination are known (using DNS). Also all nodes are considered to be in same subnet. If n1 wants to send a packet to particular node say n2, it requires MAC address of n2.
I think in this case an ARP request will be send to get the corresponding MAC address. But my friend said that n1, will broadcast the main frame, and all nodes will extract the frame till network layer to know if the packet was for them or not.
Whether first method is implemented of the second will change the way table in switch is updated. So, can someone clarify my confusion?

- 305,947
- 44
- 307
- 483

- 709
- 1
- 9
- 23
2 Answers
The way it happens is that a host needing to resolve the layer-3 address to a layer-2 address will broadcast an ARP request. The host with that layer-3 address will respond with a unicast ARP reply to the requesting host.
A switch will see the layer-2 source address of any frame entering the switch, and it will build its MAC address table with the source MAC address and the interface where the frame entered the switch. Any unicast frame with a destination address which isn't in the MAC address table will be flooded to all other switch interfaces.
In the case you discuss, the first host will broadcast an ARP request, so the ARP request will go to all the hosts on the same VLAN. At the same time, the switch will add the MAC address of the requesting host to its MAC address table.
The target host will respond with a unicast frame to the requesting host. The switch, knowing on which interface the destination host is, by looking in its MAC address table, will send the frame directly to the destination host. It will also see the source address of the second host, and it will add that MAC address and interface to its MAC address table.
Then the original host can send its frames to the destination host, using the destination MAC address, and the switch will switch the frames directly to the destination host because it has the MAC address and interface in its MAC address table.

- 6,180
- 4
- 29
- 36
-
Is it that the ARP broadcast gets to the other nodes via switch (first hop to switch and then to other nodes) or the nodes and the switch gets the broadcast (in the same hop) and, the switch just uses the information to update the table? – Ugnes Sep 18 '16 at 20:44
-
A switch uses the source address of every incoming frame to update its MAC address table. When discussing hops, that is usually reserved for layer-3 devices. Layer-2 devices are transparent, and do not change the frame, so a layer-2 delivery is really a single hop (from layer-3 host to layer-3 host), no matter how many switches a frame passes through. – Ron Maupin Sep 18 '16 at 20:47
Initially the source node will send a broadcast request for the MAC address of the desired IP Address. The switch on realizing the coming packet is a broadcast, will channelize the packet to the other remaining ports. Switch will build the table for the corresponding source node.
All the other nodes will discard the packet, except the one for which it is. This node will reply its MAC address with a unicast reply.
Now since the destination of this packet is already present in the table of the switch, it will simply forward the packet to the corresponding port.

- 3
- 7