How does a switch learn MAC Addresses

A switch has some intelligence and operates on layer 2 of the OSI model. In this lesson, I’ll demonstrate how a switch learns MAC addresses. Let me show you an example of three computers connected to a switch:

three computers connected to switch

There’s a switch in the middle and we have 3 computers. All computers have a MAC address but I’ve simplified them. Our switch has a MAC address table and it will learn where all the MAC addresses are in the network. Let’s send something from H1 to H2:

A switch has some intelligence and operates on layer 2 of the OSI model. In this lesson, I'll demonstrate how a switch learns MAC addresses. Let me show you an example of three computers connected to a switch: There’s a switch in the middle and we have 3 computers. All computers have a MAC address b



switch incoming frame

H1 is going to send some data meant for H2, thus it will create an Ethernet frame which has a source MAC address (AAA) and a destination MAC address (BBB). Our switch has a MAC address table and here’s what will happen:

switch learns mac address

We're Sorry, Full Content Access is for Members Only...

If you like to keep on reading, Become a Member Now! Here is why:

  • Learn any CCNA, CCNP and CCIE R&S Topic. Explained As Simple As Possible.
  • Try for Just $1. The Best Dollar You've Ever Spent on Your Cisco Career!
  • Full Access to our 654 Lessons. More Lessons Added Every Week!
  • Content created by Rene Molenaar (CCIE #41726)

538 Sign Ups in the last 30 days

satisfaction-guaranteed
100% Satisfaction Guaranteed!
You may cancel your monthly membership at any time.
No Questions Asked!

Tags: ,


Forum Replies

  1. Hello Rene,
    As you described a switch as pretty “dumb” box, I would like to ask, if the sentence in brackets “(except the one it came from)” could be added to the second thing, in your explanation.

    Then Your explanation could look like this:

    The switch is a pretty “dumb” box…it only cares about a couple of things:

    – When it receives an Ethernet frame, and it didn’t see the source MAC address before, it is stored in the mac address table.
    – If the destination MAC address is known, it forwards it out of the correct interface (except the one it came from).
    – If th

    ... Continue reading in our forum

  2. Rene,

    You stated in a earlier post the following:
    The switch is a pretty “dumb” box…it only cares about a couple of things:

    When it receives an ethernet frame and it didn’t see the source MAC address before, it is stored in the mac address table.
    If the destination MAC address is known, it forwards it out of the correct interface.
    If the destination MAC address is unknown, it is flooded on all ports (except the one where it came from).
    If the destination MAC address is a broadcast, it is flooded on all ports (except the one it came from).

    Here is an explanation

    ... Continue reading in our forum

  3. Hello Mohammad

    Yes, all switches have a MAC address. How this MAC address is implemented depends on the vendor. Some switches have the same MAC address on all ports. Cisco switches have a different MAC address on each port and one main MAC address that refers to the switch itself. These MAC addresses are only used for traffic that is destined to or generated from the switch itself. For traffic from one PC to another for example, these MAC addresses don’t play any role.

    Some specific uses for the MAC addresses of switches include:

    * terminating traffic to a

    ... Continue reading in our forum

  4. Hi Rosna,

    Any device that has an IP address needs ARP. After all, if it wants to send an IP packet with a destination IP address, it has to figure out what the layer two MAC address is.

    On a layer two switch, you still might want to configure an IP address. Here are some reasons:

    - To manage it remotely through telnet or SSH.
    - So it can send syslog messages to an external server.
    - So you can use SNMP to monitor the switch.

    It is possible that a switch is the initiator of the ARP process. For example, perhaps you just rebooted it and it wants to send syslog in

    ... Continue reading in our forum

60 more replies! Ask a question or join the discussion by visiting our Community Forum