I was wondering if there is a possibility that a switch won't get the needed MAC address to it's CAM.

For example, if the used protocol is UDP, where the sender doesn't need an answer back from the receiver?

Thank you

  • So, I don't work with networking, but for some reason when this question appeared in the sidebar, I momentarily wondered - Why in the name of god would a switch always get a MAC(intosh) address from a PC(Windows). I usually don't like to make irrelevant comments, but the thought just made me chuckle so I figured i'd share. – Ryan Feb 8 '18 at 19:23

A switch learns the source MAC from the sender. If the destination is not in the CAM table, the switch floods the frame out all ports. So if the receiver never responds, the switch will never learn the receiver's MAC and it will always flood the frame.

  • Hi, thank you for answer. So in case the frame is received by PC with the destination MAC address it always sends the answer back so switch can add this mac into CAM table ? Or how the switch knows that the frame was received ? – Lukáš Stacke Feb 5 '18 at 19:19
  • The switch doesn't know or care if it was received. It only learns MAC addresses fro the source address of frames. – Ron Trunk Feb 5 '18 at 21:11

Whether you use UDP, TCP or any other transport protocol, the underlying IP layer uses an IP address. When the sender (or the router for that matter) attempts to send the IP packet over the local segment it has to discover the MAC address first.

For this, IPv4 uses ARP, IPv6 uses NDP. Both protocols require the destination to send either an ARP response or a Neighbor Advertisement message. This will tell the switch the destination's MAC address and the port in any case.

As Ron Trunk has pointed out, even if the switch didn't know where the MAC address is located (when not using IP or another protocol requiring a response) the switch would emulate a repeater and broadcast the frame to all ports (except the source port).

  • 1
    nick-picking but the switch will flood the frame, not broadcast it. A broadcast is a type or frame, while flooding is a switch behavior. – JFL Feb 5 '18 at 21:08
  • so that means the only mac address which will goes into CAM is always only source mac. – Lukáš Stacke Feb 5 '18 at 22:00
  • @JFL Agreed - I wasn't using the noun though but the verb, and flooding vs broadcasting doesn't make too much of a difference. ;-) – Zac67 Feb 5 '18 at 22:03
  • @LukášStacke Yes - the source MAC/port combination is stored in the SAT and the destination MAC is used for forwarding. – Zac67 Feb 5 '18 at 22:05

An ethernet switch will get the source MAC address from the frame as it enters the switch. A MAC address is a data-link address on the frame. UDP is a transport protocol, encapsulated in the network protocol, which is encapsulated in the data-link protocol. The switch has no idea what protocols are encapsulated inside the data-link frame.

  • Great, thank you for answer ! but how the switch knows that the frame was really received by someone ? I suppose PC with destination mac address has to send back some reply, but is it always sent or there can occur some cases when the reply isn't sent back. – Lukáš Stacke Feb 5 '18 at 19:26
  • The switch has no idea if the frame is received. The switch simply doesn't care; it is a transparent device. Replies are the responsibility of upper-layer protocols, and not all protocols require a response. – Ron Maupin Feb 5 '18 at 19:28

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.