So this diagram shows a small switch network and each of these switches s one two and three has learnt mac addresses a b c and d and it learns which ports they're on but depending on which switch you are where you are in the network you will have a different view of the network and therefore which port you need to send to get a particular mac address so for example if you're trying to send to device d then and you're on switch s2 then it has to come out of port 3 which means go up towards switch s1 so you can see this is a table which is built up inside each of the switches so that every time it receives a frame it knows where to send it on now that's all very smart the question then is how does this work how do the switches build these tables you don't have to actually log into the switches and configure them it's quite clever it's done as a side effect of the forwarding of the frames and what happens is anytime a frame comes in it needs to look at the destination address to work out where to send it to but it also looks at the source address and learns that that source address came in on a particular port so if the frame came in and its source of mac address was x and it came in on port y then it learns that mac address x must be connected to port y and those learned mac addresses and ports are added to the mac address table which is also known as the bridge forwarding table so later on when another frame comes in on a different port maybe which has a destination mac address of x it can find it in the table and that therefore it knows it needs to send it out of port y because that's where it saw mac address x coming in from and if the mac address isn't in the mac address table then it has to be sent out on all ports so that's how things work when the switch first powers up its forwarding table is empty so whenever a frame comes in it will have to send that frame out to all destinations but eventually it will start learning the mac addresses of other devices as every time a device sends a frame it will see the source mac address it will add it to the table and therefore going forward it will know where to send the frames so what you will find that is that if you take say a pc and connect it directly to a switch port then there will only be one mac address visible through that switch port is the pc's mac address but if the switch is connected in turn to another switch or to a hub or to a wireless access point or some device that can provide access to multiple mac addresses then the switches forwarding table will show multiple mac addresses all associated with that same port and that's perfectly normal of way that the switch network works these mac address entries may expire after a certain amount of time if the mac address hasn't been seen for a while then to avoid the table becoming full it may expire that entry and these mac address tables may even be forced out if the switch runs out of space in its forwarding table so if it needs to learn a new mac address and there are no spare slots in the forwarding table it will have to kick out an old entry to be able to make space for it now if you have a managed switch you will be able to log into the switch and inspect the forwarding table and see all of the port to mac address mappings that it's learnt you
© Produced by Philip Smith and the Network Startup Resource Center, through the University of Oregon.
Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)
This is a human-readable summary of (and not a substitute for) the license. Disclaimer. You are free to: Share — copy and redistribute the material in any medium or format Adapt — remix, transform, and build upon the material The licensor cannot revoke these freedoms as long as you follow the license terms. Under the following terms: Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. NonCommercial — You may not use the material for commercial purposes. No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.