0

This question already has an answer here:

I've wondered how Ethernet packets sent from Laptop-A to Laptop-B on the local network segment are delivered, when multiple switches are in-between.

For hubs, that just replicates the packet on all outgoing network ports, the packet sent from Laptop-A will eventually reach Laptop-B. The same holds for ARP requests (broadcast), when multiple switches are in-between.

However, switches only send packets on a single outgoing network port, depending on the destination MAC address and its CAM table. But, Switch-A's CAM table only knows about devices connected directly to it, so it doesn't know anything about Laptop-B?

So, how does Switch-A know where to send traffic destined for the MAC address of Laptop-B?

enter image description here

marked as duplicate by user36472, Ron Maupin Mar 13 at 13:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Your premise "Switch-A's CAM table only knows about devices connected directly to it" is simply false. – JFL Mar 13 at 10:56
4

So, how does Switch-A know where to send traffic destined for the MAC address of Laptop-B?

By doing what a switch does: Unknown Unicast Flooding. It sends out the given frame with Laptop-B's Dst MAC address out of all ports (except the port the frame was received on), including the inter switch link to Switch-B.

Assuming that Switch-B already knows where Laptop-B is connected (if not: see "unknown unicast flooding" above), it will send out the frame via Laptop-B's switchport. The reply frame from Laptop-B probably won't have to be unknown-unicast-flooded, because the given MAC address of the requesting system was already learned when the frame (which was unknown-unicast-flooded by Switch-A) entered Switch-B via the inter switch link, so there's going to be a MAC address table entry for it.

It is perfectly normal for a switch to have multiple entries in the MAC address table for a single switchport [1].

So eventually, over time [2], Switch-A will have a MAC-Address table with all -A systems on their own ports, and all -B systems on the inter switch link port (and vice-versa for Switch-B)


[1] unless configured otherwise.

[2] 300 seconds commonly is the default lifetime for entries in the MAC address table. Unless configured otherwise.

  • Thank you! Why is it called "Unknown Unicast Flooding" - unicast normally means sending to a single recipient; here the packet is send on all ports. – Shuzheng Mar 13 at 11:29
  • Because that is how switches operate when the egress switchport for a given destination MAC address is not known: They flood the frame as if it were broadcast. As @Peter Green pointed out, Unknown Unicast Flooding should nod happen too often, because Hosts are generally "chatty" and send out broadcast/mutlicast frames (like DCHP, ARP, SSDP, Zeroconf) every so often, and the switches "see" the Hosts' (Source) MAC addresses, and they can keep their MAC address tables populated. If UUF is observed in large amounts over extended periods of time, the L2 topology should be reviewed. – Marc 'netztier' Luethi Mar 13 at 14:51
  • Okay, just to be sure - the CAM table may store multiple hosts for a single port, i.e. all the host it records as being reachable through that port (even thus the hosts may be several switches away in the network topology)? In other words a whole Ethernet "subnet" of hosts may be recorded for a port in the switch's CAM table? – Shuzheng Mar 13 at 15:27
  • Exactly, with even thus the hosts may be several switches away in the network topology being the key point. As long as the CAM table capacity and the configuration allow for it (some switches allow to restrict the amount of MAC addresses they accept to learn on a port) , multiple/many/all (source) MAC addresses are learned and stored in CAM, as soon as a frame sourced from them them enters through that port. – Marc 'netztier' Luethi Mar 13 at 15:33
0

But, Switch-A's CAM table only knows about devices connected directly to it, so it doesn't know anything about Laptop-B?

This is generally wrong.

Switches can and do keep track of many MAC addresses behind a single port.

As said in Marc's answer if a switch gets a unicast frame with an unknown destination it will flood it to all interfaces (except the one it was received on).

But in practice this rarely happens unless a switch is overloaded or rebooted. In practice if node A wants to communicate with node B it will start out by broadcasting* a discovery packet, this will tell every switch on the network how to send traffic to A. B will then send a reply (may be unicast, multicast or broadcast depending on the protocol) to that discovery packet which will inform at least all the switches along the path from B to A about the location of B.

* For ipv6 the packet is technically multicast but that doesn't effect the switch side of things.

  • 1
    Discovery packet? You mean GARP? I think you should be more specific. – Ron Trunk Mar 13 at 13:28
  • I was trying to keep my answer general and not be specific to any particular L3 protocol. By "discovery packet" I mean a packet that aims to discover which Ethernet address is associated with a higher level address. For example an arp request for ipv4 or a neighbour solicitation for IPv6. – Peter Green Mar 13 at 13:35
  • 1
    To help those still learning, may I suggest using explicit examples such as ARP or NS. The term "discovery packet," while conceptually true, may be confusing. – Ron Trunk Mar 13 at 13:50
  • @PeterGreen - thank you, +1. – Shuzheng Mar 13 at 18:28

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