A network switch is a hardware device that channels incoming data from multiple input ports to a specific output port that will take it toward its intended destination. It is a small device that transfers data packets between multiple network devices such as computers, routers, servers or other switches.
In a local area network (LAN) using Ethernet, a network switch determines where to send each incoming message frame by looking at the physical device address (also known as the Media Access Control address or MAC address). Switches maintain tables that match each MAC address to the port which the MAC address is received.
A network switch operates on the network layer, called layer 2 of the OSI model.
Network device layers
Network devices can be separated by the layer they operate on, defined by the OSI model. The OSI model conceptualizes networks separating protocols by layers. Control is typically passed from one layer to the next. Some layers include:
- Layer 1- or the physical layer or below, which can transfer data but cannot manage the traffic coming through it. An example would be Ethernet hubs or cables.
- Layer 2- or the data link layer, which uses hardware addresses to receive and forward data. A network switch is an example of what type of device is on layer 2.
- Layer 3- or the network layer, which performs similar functions to a router and also supports multiple kinds of physical networks on different ports. Examples include routers or layer 3 switches.
Other layers include layer 4 (the transport layer), layer 5 (the session layer), layer 6 (the presentation layer) and layer 7 (the application layer).
How a network switch works
Fundamental concepts of a networking switch.
Switches, physical and virtual, comprise the vast majority of network devices in modern data networks. They provide the wired connections to desktop computers, wireless access points, industrial machinery and some internet of things (IoT) devices such as card entry systems. They interconnect the computers that host virtual machines (VMs) in data centers, as well as the dedicated physical servers, and much of the storage infrastructure. They carry vast amounts of traffic in telecommunications provider networks.
A network switch can be deployed in the following ways:
- Edge, or access switches: These switches manage traffic either coming into or exiting the network. Devices like computers and access points connect to edge switches.
- Aggregation, or distribution switches: These switches are placed within an optional middle layer. Edge switches connect into these and they can send traffic from switch to switch or send it up to core switches.
- Core switches: These network switches comprise the backbone of the network, connecting either aggregation or edge switches, connecting user or device edge networks to data center networks and, typically, connecting enterprise LANs to the routers that connect them to the internet.
If a frame is forwarded to a MAC address unknown to the switch infrastructure, it is flooded to all ports in the switching domain. Broadcast and multicast frames are also flooded. This is known as BUM flooding — broadcast, unknown unicast, and multicast flooding. This capability makes a switch a Layer 2 or data-link layer device in the Open Systems Interconnection (OSI) communications model.