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!

1
  • Switches switch, and routers route.
    – Ron Maupin
    Jun 16, 2018 at 15:49

3 Answers 3

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. A switch has no inkling of what IP or ICMP are.

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 (on a layer-3 device, usually a host or a router). 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.

3
  • Thanks! so a basic switch does not have an ARP table, the ARP table resides only at end hosts
    – coldwin
    Jun 16, 2018 at 8:34
  • Close - a router also needs an ARP table.
    – Zac67
    Jun 16, 2018 at 19:24
  • ... and a managed switch usually has an IP interface for management using ARP.
    – Zac67
    Dec 26, 2020 at 15:27
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.

0

When ping packet is intiàted from souce devices . Let's assume packet reached layer3 devices from layer3 devices traffic is forwarded on layer2 switch further ping traffic is forwarded to end host connected with layer2 switch .

Layer3 device ---> layer2 switch ----->end host ..

In layer3 devices

Ping packet reaches to layer3 devices checks for route entry . If it is directly connected network then further check for ARP table . ARP table match ip address to mac-address

ARP table

Ip address --mac-address

After checking ARP table tràffic is forwarded on layer2 devices . In layer2 devices it's checks for mac -address table .

Mac address table

Mac address to switch ports

With reference to mac -address present on destination mac address on packet traffic is forwarded on specific Switchport connect to host after check mac -address table...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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