What makes a switch different from a hub, you ask? In order to fully understand the difference, let’s take a look at the OSI model (focusing on the first two layers).
First, hubs operate at layer 1: the physical layer. They connect multiple devices together but that’s it. The hub doesn’t know who is connected nor does it know whom to pass traffic to. Switches on the other hand operate at layer 2: the data link layer. They connect multiple devices together and keep track of where each device is located. This is done via each device’s MAC address.
Alright, so you understand that hubs are like non-intelligent switches but how does that impact a network? Great question! With hubs, traffic flows out all ports. For example, say host A is trying to access host B. Host A‘s traffic will go out all of the hub’s ports and both host B and C will receive said traffic.
With switches, you have what is called a MAC Address Table. This table lists which MAC addresses are off of each port. For example, say host X is trying to access host Y. Host X‘s traffic will go out only the port that host Y is connected to.
Example of MAC address table on switch:
VLAN MAC Address Type age Secure NTFY Ports/SWID.SSID.LID ---------+-----------------+--------+---------+------+----+------------------ * 1 0c4d.e9a1.be0e dynamic 30 F F Gi1/1 * 1 0c4d.e9a1.be0f dynamic 30 F F Gi1/2
What are the benefits of using a switch you ask?
Want proof? Here are some packet captures – see the difference for yourself!