Tech moves fast! Stay ahead of the curve with Techopedia!
Join nearly 200,000 subscribers who receive actionable tech insights from Techopedia.
A switch, in the context of networking, is a high-speed device that receives incoming data packets and redirects them to their destination on a local area network (LAN).
A LAN switch operates at the data link layer (Layer 2) or the network layer of the OSI Model and, as such it can support all types of packet protocols. The layer 2 switch is also sometimes called a bridge: its function is to send frames containing data packets between nodes or segments of a network.
Essentially, switches are the traffic cops of a simple local area network. Switching establishes the trajectory for the frames as the data units, and how the data moves from one area of a network to another.
By contrast, routing takes place at layer 3, there data gets sent between networks or from one network to another.
A switch in an Ethernet-based LAN reads incoming TCP/IP data packets/frames containing destination information as they pass into one or more input ports. The destination information in the packets is used to determine which output ports will be used to send the data on to its intended destination. Again, the thing to remember is that the switch is operating at the data link layer, layer 2, sending a frame that contains a single data packet.
Switches are similar to hubs, only smarter. A hub simply connects all the nodes on the network – without switching, communication happens in a haphazard manner, with any device trying to communicate at any given time, resulting in many collisions. A switch, on the other hand, creates an electronic tunnel between source and destination ports for a split second, that no other traffic can enter. This results in communication without collisions.
Switches are similar to routers as well, but a router has the additional ability to forward packets between different networks, whereas a switch is limited to node-to-node communication on the same network. Other types of activity take place in successive layers of the OSI model: at layer 4 (the transport layer,) layer 5 (the session layer,) layer 6 (the presentation layer,) and layer 7 (the application layer) governing the level closest to the end user.
Like other aspects of networking in the OSI model, switching has evolved due to the emergence of virtualization and logical advancements in networking. For example, now, the hardware components, be they bridges or switches or routers or other gear, are partitioned in a virtual machine (VM) instead of being composed of discrete hardware units “on bare metal.”
The development of the virtual LAN or VLAN means that packets/frames may be moving between nodes as part of multiple LAN setups, where traffic is walled off logically according to its given LAN designation. Resources like CPU and RAM are parceled out by virtual system administrators.
Although virtualization has brought much more versatility to systems, problems like VM sprawl can result if systems are not well ordered. So the layer 2 switch or bridge serves its designated function to keep network activity consistent and transparent.