To reduce the chance for collisions between network traffic going to and from a switch and a connected device at the same time, most switches offer full-duplex functionality in which packets coming from and going to a device have access to the full bandwidth of the switch connection. (Picture two people talking on smartphones as opposed to a walkie-talkie).
While it’s true that switches operate at Layer 2, they can also operate at Layer 3, which is necessary for them to support virtual LANs (VLANs), logical network segments that can span subnets. In order for traffic to get from one subnet to another it must pass between switches, and this is facilitated by routing capabilities built into the switches.
What is the difference between a switch and a hub?
A hub can also connect several devices together for the purpose of sharing resources, and the collection of devices attached to a hub is known as a LAN segment.
A hub differs from a switch in that packets sent from one of the connected devices are broadcast to all of the devices that are connected to the hub. With a switch, packets are directed only to the port that leads to the addressed device.
Switches typically connect LAN segments, so hubs attach to them. Switches filter out traffic destined for devices on the same LAN segment. Because of this capability, switches make more efficient use of their own processing resources, as well as network bandwidth.
What is the difference between a switch and a router?
Switches are sometimes confused with routers, which also offer forwarding and routing of network traffic, hence their name. But they do this with a different purpose and location.