cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
767
Views
10
Helpful
3
Replies

How does a switch learn the MAC addresses in a common network ?

Roger.Nature
Level 1
Level 1

Hello Friends,

 

I have a question about how the switch can learn the mac address in a common network. I know that when we have a router on the network when we communicate through IP addresses it also helps to get the MAC address of a device but how does the switch now where to send frames or lets say how does the switch learns the MAC address when all the devices are just connected to a switch ? 

I hope my question makes sense and thanks a lot for your time,

 

Best regards,

3 Replies 3

acampbell
VIP Alumni
VIP Alumni

Hi,

 

When a device send a frame to a switch the switch copies the senders MAC into its mac address table, IE MAC to interface MAP.
The source & destination MAC are in the layer2 (data link) frame header
Have a look at this link its explains the frame set up
https://en.wikipedia.org/wiki/Ethernet_frame#Ethernet_packet_–_physical_layer

The switch now knows that any frames destined for your MAC are to be sent to your port.

Hope this helps you.

Regards, Alex. Please rate useful posts.

balaji.bandi
Hall of Fame
Hall of Fame

Do not like re-invent the wheel, there were good discussion around the forum already :

 

https://community.cisco.com/t5/switching/how-switch-learn-mac-address/td-p/1001634

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

Two points I didn't notice in that discussion.

First, if the same SRC MAC is seen arriving on a different ingress port, the MAC table will be updated.

Second, MAC table entries will be erased, unless the SRC MAC is seen again, after some time period. If the timer for switch's MAC retention is different from a sending host's ARP MAC retention, it's possible a unicast flow can become a unicast flood.