Ethernet switches operate at the OSI model’s data link layer (layer 2). They create a separate collision domain for each port and device connected to the controller.
As frames arrive, the switch looks up their MAC addresses in a table it constantly updates and maintains. This allows it to filter traffic and send only the structures intended for specific devices.
MAC Address Table
Each device on a network has a unique media access control (MAC) address. Switches use MAC addresses to determine which devices are connected to the same network segment and make accurate forwarding decisions. Regulators record a device’s MAC address and the associated switch port in a MAC Address Table table. Switches can build the MAC address table dynamically or statically, either from learned MAC addresses in Ethernet frames or from static entries that administrators manually add to the MAC Address Table.
Understanding how do ethernet switches work is necessary during implementation. When a switch receives an Ethernet frame, it associates the MAC address of the sending device with the port to which it is connected in the MAC address table. If the frame is a unicast packet, the switch sends it to the port to which the MAC address table entry maps. This avoids broadcasting the structure and reduces network traffic.
If the MAC address of the destination device is not in the MAC address table, the switch floods the frame out of all ports except the one it received the frame on. This technique is known as flooding and can be disruptive to the network.
As the MAC address table fills up, switches must remove old entries to make room for new ones. The switch does this using a timer. When the timer expires, the old entry is removed from the CAM table.
When a switch receives an Ethernet frame, it examines the destination address and determines which ports are associated with that destination. It then records this information in a database called the forwarding database. The switch knows that the frame originated from a device connected to port six because this is the port on which it received the source MAC address.
As switches learn about the location of devices, they create a topology called a spanning tree. This method avoids network loops that consume excessive bandwidth and cause data loss. Each network segment is associated with one switch that acts as a root. All other controllers communicate with the root via spanning tree protocol (STP).
A switch elects a single switch as the root by sending a broadcast packet known as a bridge identification (BID) to its neighboring switches. The other buttons then compare the BID with their own and select a control with the lowest path cost to the root for each segment. This process is based on each switch’s links’ weights. The set switch also selects the port that will forward traffic for a given element to the root. This port is known as a designated port.
The switch filters or discards inter-segment traffic using Layer-2 Media Access Control (MAC) address information in each frame’s header. This allows for a much higher degree of bandwidth efficiency. In addition, each switch also ages out entries in the forwarding database after a specified period, such as five minutes, to prevent its forwarding database from becoming stale and unreliable.
Spanning Tree Protocol
During its operation, an Ethernet switch maintains a table, more formally called a forwarding database, that identifies the ports on which it can send data to devices in the network. The database is built by mapping destination MAC addresses in received frames to the port to send data to them. The switch also identifies the controls that send broadcast or multicast frames to by king at the source MAC addresses in these frames.
The spanning tree protocol, or STP for short, creates a loop-free logical topology from an existing physical topology with loops. The STP process uses a distributed algorithm to determine the shortest path toward a destination and block redundant paths.
As the spanning tree algorithm runs, each switch port goes through a series of states determined by the spanning tree process. The port does not transmit user data during the listening and learning states. Instead, it processes BPDUs and learns source addresses from frames that it receives. Once the spanning tree process determines that a port should enter the forwarding state, it does so and begins transmitting data over this path.
STP is an essential feature that prevents Ethernet networks from forming a broadcast storm. It also ensures that all users have a consistent and reliable connection to the network. This key feature sets Ethernet switches apart from routers, which do not limit the propagation of broadcast and multicast frames to specific ports.