LAN devices are categorized based on the layer of the OSI model in which they operate
- Layer 2 switches
- Layer 3 switches
RepeatersRepeaters are layer 1 devices with no awareness of what traverses them. Their main use is to receive traffic, amplify it and send it out of all ports. Basic rule of Ethernet repeaters is 5-4-3 rule. Maximum path between any two hosts should be no more than five segments, with no more than four repeaters between them, and with no more than three of the segments populated with other hosts. Repeating generates latency when propagating traffic. When designing Ethernet networks, repeaters must be taken into account when determining 512-bit time for collision detection.
HubsHubs are basically repeaters with more ports, which were introduced to be installed in wiring closets for aggregation. Follow other rules for repeaters as above.
BridgesBridges connect two segments of a network, and are different from repeaters because they are intelligent and operate at layer 2. Bridges control collision domains and learn MAC addresses of hosts on segment and on which interface their traffic comes into the bridge. In this way they lower total traffic on segments, because they learn on which segments hosts reside and will transmit only out of that interface to that segment. If a bridge has not learned a MAC it will flood the incoming frame out of all ports except that on which it was received, and when the answer comes in the bridge will learn the MAC/interface. They will also not forward frames to other segments that are destined for hosts on the same segment.
Bridges are store-and-forward devices, which store an entire frame, perform a CRC check to verify its integrity and then forward it on if it passes. Bridges are designed to flood all unknown and broadcast traffic.
Because of this bridges use Spanning Tree topology (STP) to implement a loop-free network so that broadcast traffic will not flood around the network eating resources and saturating links. STP elects a root bridge from all bridges participating in spanning tree, and then uses that root bridge's location in the topology of the network to determine which redundant links should be shut down. Root bridge election is based on priority, with the lowest priority being elected as root; If all bridges have equal priority, the lowest MAC address value is used to elect the root bridge. After the root bridge is elected, each other bridge will determine their best path0. to reach the root and shut down any other links. These links are available should the primary path fail, they are just shut down. If the link to root is detected to have failed, the bridge will go through a convergence period where it will try to reach the root on other paths, learn MAC addresses if possible and then activate the new best path, shutting down any other links if any remain. Physical changes to the network force spanning tree to reconverge.
Layer 2 SwitchesSwitches use special application-specific integrated circuits (ASICs) to reduce latency that regular bridges have, and are evolution of bridges. Some switches run in cut-through mode, meaning it only reads the destination MAC address and then forwards it without checking CRC. This speeds switching time but increases likelihood of forwarding bad frames. Most modern switches use store-and-forward method. Each port on a switch is a separate collision domain, meaning it has no need for CSMA/CD on the line and so it can operate at full duplex. Each switch is one broadcast domain, meaning any ports in a vlan will receive broadcasts sent from that vlan. Switches also learn MAC addresses and use STP to avoid loops in the network.
RoutersRouters are layer 3 devices that make forwarding decisions based on network addresses (IP adress). When an Ethernet frame enters a router interface, the layer 2 header is removed and the router inspects the layer 3 address, then adds the layer 2 address of its outgoing interface and forwards the packet. Routers do not forward layer 2 broadcasts over other interfaces. A router defines layer 3 broadcast domains based on the IP address and subnet of its interfaces. Routers are aware of the network protocol and so can forward routed protocols such as IP and IPX. Each interface of a router is its own collision/broadcast domain.
Routers can share network route information using a routing protocol in order to expand its list of known networks and the best routes to reach them. The following are some well-known protocols: