2

i tried to browse all available answers on this subject, but it's still not clear to me what a switch can or can't do.

I understand that when a host sends out a ping command, for instance ping 192.168.1.5, the switch will only look at the frames, since it is a very simple version of a switch that doesn't operate in layer 3. But in my case, when using this ping command i do get a response from another host, so it seems that the switch did some routing?

Also, when a host is sending a packet to another host on the same switch network, before the ARP process, how does the sending host know the recipient's MAC address in the first place, if they didn't communicate before?

Thanks for the answers!

  • Switches switch, and routers route. – Ron Maupin Jun 16 '18 at 15:49
3

A switch is a layer-2 device. It forwards (switches) frames by looking at the MAC destination address, and forwarding the frame out the port that's associated with the MAC.

IP packets are transported across Ethernet or other MAC-based networks by resolving the destination (or next hop) address to a MAC address that is then used for frame addressing. For this, IPv4 uses ARP and IPv6 uses NDP.

Routing is the term used for layer-3 forwarding in a router between different layer-2 networks.

A layer-3 switch is a switch that also provides (possibly limited) routing capabilities, usually routing between VLANs.

  • Thanks! so a basic switch does not have an ARP table, the ARP table resides only at end hosts – coldwin Jun 16 '18 at 8:34
  • Close - a router also needs an ARP table. – Zac67 Jun 16 '18 at 19:24
1

how does the sending host know the recipient's MAC address in the first place, if they didn't communicate before?

If the switch doesn't have the destination MAC address in its list of known addresses, it sends it out of all of its interfaces (except the one it arrived on.

This happens surprisingly infrequently, because operating systems usually send out "gratuitous arp" when they bring an interface up.

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.