Newbie switch question

Apologies for a pretty basic question about how switches work. My knowledge of networking is a bit like Swiss cheese - full of holes. Electronics and software development background means I can sort of grasp how things work :slight_smile:

Want to clarify how a switch works. Am I right in thinking that when the first packet is sent to a switch from an unknown device, the switch has no idea what to do with it and therefore broadcasts it on every other port. Every other device connected then receives the packet and decides whether it’s for them. However, when the return packet comes back, the switch knows where it came from and can forward it directly to the original port. And this port-to-port mapping stays in place for the duration of the session.

And this is the big difference between a switch and a hub. The hub doesn’t keep the mapping table (ARP?) and therefore forwards every packet to every port - all the time.

You are really close.

As soon as a new device sends a packet, the switch learns the MAC of that device and stores that and what port it was on in it’s hosts table. As long as the device does not move to another port it will remember where it is (it should have a timeout in there). As long as the MAC is in the switch hosts table, any traffic for the device will only be sent to that port of the switch. And correct, broadcast traffic will be sent to all ports except the originating port.

A hub is a dumb device that will send everything everywhere except the originating port.

Thanks for clarifying. Another piece of the jigsaw filled in.