network switch

What is a network switch?

A network switch connects devices in a network to each other, enabling them to talk by exchanging data packets. Switches can be hardware devices that manage physical networks or software-based virtual devices.

Switches form the vast majority of network devices in modern data networks. They provide the wired connections to desktop computers, wireless access points (APs), printers, industrial machinery and some internet of things devices, such as card entry systems. They connect the computers that host virtual machines (VMs) in data centers, as well as physical servers and much of the storage infrastructure. Switches carry vast amounts of traffic in telecommunications provider networks.

A network switch operates on Layer 2 of the Open Systems Interconnection (OSI) model -- the data-link layer. In a local area network (LAN) using Ethernet, a network switch determines where to send each incoming message frame by looking at the media access control (MAC) address. Switches maintain tables that match each MAC address to the port receiving the MAC address.

How a network switch works

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 APs connect to edge switches.
  • Aggregation, or distribution, switches. These switches are placed within an optional middle layer in a network topology. Edge switches connect into these and send traffic from switch to switch or send it up to core switches.
  • Core switches. These network switches form the backbone of the network. Core switches connect aggregation or edge switches, users or device edge networks to data center networks and enterprise LANs to routers.

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 device in the OSI communications model.

Diagram showing how a network switch works
Learn how a network switch works.

Many data centers adopt a leaf-spine architecture, which eliminates the aggregation layer. In this design, servers and storage connect to leaf switches (edge switches). Every leaf switch connects into two or more spine (core) switches. This reduces the number of hops data takes to get from source to destination, therefore reducing latency.

Some data centers establish a fabric or mesh network design that makes every device appear to be on a single, large switch. This approach reduces latency to its minimum. High-demanding applications that use high-performance computing (HPC) often use this approach.

For small business and home networking, network switches provide the benefit of additional Ethernet ports -- for connecting to gigabit Ethernet.

Not all networks use switches, however. A network might be organized in a token ring or connected via a bus, hub or repeater. In these networks, every connected device sees all traffic and reads the traffic addressed to it. A network can also be established by directly connecting computers to one another, without a separate layer of network devices. This approach is mostly for HPC, which requires sub-5-microsecond latencies and is quite complex to design, wire and manage.

Types of networking switches

There are several types of switches in networking:

  • Virtual switches are software-only switches instantiated inside VM hosting environments.
  • Routing switches connect LANs. In addition to doing MAC-based Layer 2 switching, they perform routing functions at OSI Layer 3 (the network layer), directing traffic based on the Internet Protocol (IP) address in each packet.
  • Managed switches let a user adjust each port on the switch. This enables monitoring and configuration changes.
  • Unmanaged switches enable Ethernet devices to pass data automatically using autonegotiation, which determines parameters such as data rate. The configuration is fixed and cannot be edited.
  • Smart switches can be configured to enable more control over data transmissions, but they have more limitations compared to managed switches. Smart switches are also known as partially managed switches.

Network device layers

Network devices can be separated by the OSI layer on which they operate. The OSI model conceptualizes networks separating protocols by layers. Control is typically passed from one layer to the next. Some OSI layers are the following:

  • Layer 1 -- the physical layer. Can transfer data but cannot manage the traffic coming through it. Examples are Ethernet hubs or cables.
  • Layer 2 -- the data link layer. 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 -- the network layer. Performs similar functions to a router and supports multiple kinds of physical networks on different ports. Examples include routers and 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).

Diagram showing the seven OSI model layers
Compare the different layers of the OSI model.

Network switches vs. hubs and routers

Network switches can be easily confused with both hubs and routers. However, they have different functions and operate on separate layers. While a network switch is a Layer 2 device on the OSI model, a hub is a Layer 1 physical device, and a router is primarily a Layer 3 device.

Diagram that compares a hub versus a switch
Compare a hub versus a network switch.

A switch connects network devices together and transfers data packets between those devices.

A hub is relatively simple compared to a network switch. The goal of a hub is to connect all the nodes in a network. Because a hub can't manage data going in and out of it as a network switch can, there are a lot of communication collisions.

A router moves information data between two or more computer networks. It looks at packets' IP addresses to determine the destination and route.

This was last updated in December 2022

Continue Reading About network switch

Dig Deeper on Network Infrastructure

Unified Communications
Mobile Computing
Data Center