Switches have multiple ports and can connect multiple segments or devices. The switch forwards frames to the appropriate port. They function similarly to a hub, except instead of sending packets to all ports, switches send packets only to the destination computer’s port.
A hub and a repeater send signals out all other ports. These devices do not examine the frame or the packet contents.
A switch or a bridge use the MAC address in a frame for forwarding decisions. A router uses the IP address in a packet for forwarding decisions.
Bridges and switches learn addresses by copying the MAC address of the source device and placing it into the MAC address table. The port number which the frame entered is also recorded in the table and associated with the source MAC address.
The switch or the bridge cannot record the destination MAC address because it does not know the port that is used to reach the destination device. Bridges and switches operate at Layer 2 and do not use IP addresses (which exist at Layer 3).
Because the switch does not know the port that is used to reach the destination device, it will send the frame out all ports except for the port on which the frame was received. After the switch learns the port that is used to reach the destination device, it will send the frame out only that port.
A hub does not create multiple segments on the network. A segment is a portion of the network that has a different media, collision domains, or broadcast domains. A hub simply connects devices using the same media type. All devices are members of the same collision and broadcast domains.
On a switch, each switch port is in a separate collision domain. With a router or a firewall, each connected network is a different broadcast domain.