What is a network switch, and how does it work?

Switches connect network segments, providing full-duplex communication, valuable network performance data and efficient use of network bandwidth.

Network Networking Ethernet
Martyn Williams/IDGNS

Modern networks are critical for any enterprise. Networks deliver business applications, multimedia messages and key data to end users around the world. A fundamental element that networks have in common is the network switch, which helps connect devices for the purpose of sharing resources within a local area network (LAN).

What is a network switch?

A network switch is a physical device that operates at the Data Link layer of the Open Systems Interconnection (OSI) model -- Layer 2. It takes in packets sent by devices that are connected to its physical ports, and forwards them to the devices the packets are intended to reach. Switches can also operate at the Network Layer (Layer 3) where routing occurs.

Switches are a common component of networks based on Ethernet, Fibre Channel, Asynchronous Transfer Mode (ATM), and InfiniBand, among others. However, most switches today use Ethernet.

How does a network switch work?

Once a device is connected to a switch, the switch notes its media access control (MAC) address, a code that’s baked into the device’s network-interface card (NIC).The NIC attaches to an Ethernet cable that connects to the switch. The switch uses the MAC address to identify which device’s outgoing packets are being sent, and where to deliver incoming packets.

The MAC address identifies the physical device and doesn’t change, while the network layer (Layer 3) IP address, can be assigned dynamically to a device and change over time. (Think of a MAC address as the VIN number on a car, and the IP address as the license plate.)

When a packet enters the switch, the switch reads its header, then matches the destination address or addresses and sends the packet out through the appropriate ports that lead to the destination devices.

To reduce the chance for collisions between network traffic going to and from a switch and a connected device at the same time, most switches offer full-duplex functionality in which packets coming from and going to a device have access to the full bandwidth of the switch connection. (Picture two people talking on smartphones as opposed to a walkie-talkie).

While it’s true that switches operate at Layer 2, they can also operate at Layer 3, which is necessary for them to support virtual LANs (VLANs), logical network segments that can span subnets. In order for traffic to get from one subnet to another it must pass between switches, and this is facilitated by routing capabilities built into the switches.

What is the difference between a switch and a hub?

A hub can also connect several devices together for the purpose of sharing resources, and the collection of devices attached to a hub is known as a LAN segment.

A hub differs from a switch in that packets sent from one of the connected devices are broadcast to all of the devices that are connected to the hub. With a switch, packets are directed only to the port that leads to the addressed device.

Switches typically connect LAN segments, so hubs attach to them. Switches filter out traffic destined for devices on the same LAN segment. Because of this capability, switches make more efficient use of their own processing resources, as well as network bandwidth.

What is the difference between a switch and a router?

Switches are sometimes confused with routers, which also offer forwarding and routing of network traffic, hence their name. But they do this with a different purpose and location.

Routers operate at Layer 3 -- the network layer -- and are used to connect networks to other networks.

An easy way to think about the difference between switches and routers is to think about LANs and WANs. Devices connect locally through switches, and networks are connected to other networks through routers. This is the path a packet might take to reach the internet: device > hub > switch > router > internet.

Of course, there are cases where switching functionality is built into a router hardware, and the router performs as the switch as well.

Think of your home wireless router. It routes to a broadband connection through its WAN port, but it usually also has additional Ethernet ports that you can use to connect an Ethernet cable for a computer, television, printer or even a gaming console. While other devices on the network, such as other notebooks and phones, connect through the Wi-Fi router, it still offers switching functions through the LAN. So the router, in effect, is also a switch. And you can even connect a separate switch to the router to provide both internet and LAN access for additional devices.

What are the different types of switches?

Switches vary in size, depending on how many devices you need to connect in a specific area, as well as the type of network speed/bandwidth required. In a small office or home office, a four- or eight-port switch usually suffices, but for larger deployments you generally see switches up to 128 ports. The form factor of a smaller switch is an appliance that you can fit on a desktop, but switches are also rack-mountable for placement in a wiring closet, data center or server farm. Sizes of rack-mountable switches range from 1U to 4U, but larger ones are also available.

Switches also vary in the network speed they offer, ranging from Fast Ethernet (10/100 Mbps), Gigabit Ethernet (10/100/1000 Mbps), 10 Gigabit (10/100/1000/10000 Mbps) and even 40/100 Gbps speeds. The choice of speeds depends on the throughput needed for the tasks being supported.

Switches also differ in their capabilities. Here are four types.

1.  Unmanaged

Unmanaged switches are the most basic, offering fixed configuration. They are generally plug-and-play, which means they have few if any options for the user to choose from. They may have default settings for features such as quality of service, but they cannot be changed. The upside is that unmanaged switches are relatively inexpensive, but their lack of features make them unsuitable for most enterprise uses.

2.  Managed

Managed switches offer more functionality and features for IT professionals and are the type most likely seen in business or enterprise settings. Managed switches have command-line interfaces (CLI) to configure them. They support simple network management protocol (SNMP) agents that provide information that can be used to troubleshoot network problems.

They can also support virtual LANs, quality of service settings and IP routing. The security is also better, protecting all types of traffic that they handle. Because of their advanced features, managed switches cost much more than unmanaged switches.

3.  Smart or intelligent switches

Smart or intelligent switches are managed switches that have some features beyond what an unmanaged switch offers, but fewer than a managed switch. While they are more sophisticated than unmanaged switches, they are also less expensive than a fully managed switch. They generally lack support for telnet access and have web GUIs rather than CLIs. Other options, such as VLANs, may not have as many features as those supported by fully managed switches. Because they are less expensive, they may be a good fit for smaller companies with fewer financial resources and/or those with fewer feature needs.

4.   KVM switch

A specific type of switch used in data centers or other areas with large amounts of servers, a KVM switch provides a Keyboard, Video (monitor) and Mouse connection to multiple computers, allowing users to control groups of servers from a single location or console. By adding a KVM extender, KVM switches can allow for local and remote access to the machines, letting a company centralize server maintenance and management.

What are network switch management features?

The full list of features and functionalities of a network switch will vary depending on the switch manufacturer and any additional software provided, but in general a switch will let professionals:

  • Enable and disable specific ports on the switch.
  • Configure settings for duplex (half or full), as well as bandwidth.
  • Set quality of service (QoS) levels for a specific port.
  • Enable MAC filtering and other access control features.
  • Set up SNMP monitoring of devices, including the health of the link.
  • Configure port mirroring, for monitoring network traffic.

What is the value of network switches?

Switches remain important in today’s modern enterprise, as their capabilities can enable further wireless connectivity, as well as support Internet of Things devices and smart buildings that help create a more sustainable operation. The growing use of Industrial Internet of Things devices that connect sensors and machinery in factories also requires switching technologies to connect back to the enterprise network.

Modern switches now likely include Power over Ethernet (PoE) technology that can deliver up to 100W of power to support network-connected devices. This lets companies deploy devices in areas where a separate power outlet is not required, such as security cameras, outdoor lighting, wireless access points, VoIP phones and a litany of sensors (temperature, humidity, moisture, etc.) that can monitor remote areas. Data collected and transmitted from IoT devices can be collected by a switch and be applied to artificial intelligence and machine learning algorithms to help optimize smarter environments.

What are other uses for network switches?

In larger networks, switches are often used to offload traffic for analytics. This can be important to security professionals, where a switch can be placed in front of a WAN router before the traffic goes to the LAN. It can facilitate intrusion detection, performance analytics, and firewalling. In many cases, port mirroring can create a mirror image of the data flowing through the switch before it is sent to an intrusion detection system or packet sniffer.

Switches continue to be used in large data centers and cloud environments, alongside new innovations such as digital twin technologies, network cable consolidation and SD-WAN environments.

At its most basic, however, network switches quickly and efficiently deliver packets from device A to device B, whether they are located across the hallway or halfway around the world. Several other devices contribute to this delivery along the way, but the switch is an essential part of the networking architecture.

Keith Shaw is a freelance digital journalist who has written about the IT world for more than 20 years.

Join the Network World communities on Facebook and LinkedIn to comment on topics that are top of mind.

Copyright © 2022 IDG Communications, Inc.