Network switch
lastmod 2026-08-23created 2018-07-3118 edits
A network switch is a communication device that connects network units and can handle a large number of packets, with improved transmission speed over a hub used for small-scale communication. It is often simply called a switch, and is also known as a MAC bridge, switching hub, or port switching hub.
Hubs
A hub lets the computers on a network communicate. Each computer is connected to the hub with an Ethernet cable, and information sent from one computer to another passes through the hub. Because a hub cannot identify the source or intended destination of the information it receives, it sends the information to every connected computer, including the one that sent it. A hub can send and receive information, but not at the same time. So hubs are slower than switches. Hubs are the simplest and cheapest of these devices.
Switches
A switch works the same way as a hub, but it can identify the intended destination of the information it receives, so it sends that information only to the computer that is supposed to receive it. A switch can send and receive information at the same time, so it sends information faster than a hub. If your home network has four or more computers, or if you want to use the network for activities that pass a lot of information between computers (e.g., playing network games or sharing music), you should probably use a switch instead of a hub. Switches are slightly more expensive than hubs.
A network switch operates at the data link layer (layer 2) of the OSI model. (However, there are also L3 Switch and L4 Switch devices.) It receives packets sent from devices connected to its physical ports and sends them out again, but only through the port leading to the device the packet needs to reach. Switches are based on Ethernet, Fibre Channel, Asynchronous Transfer Mode (ATM), InfiniBand, and so on, and most switches today use Ethernet.
How a network switch works
When a device is connected to a switch, the switch checks the media access control (MAC) address built into the network interface card (NIC) of the device connected to that Ethernet cable. The switch uses this MAC address to identify which device a packet was sent from and where to deliver received packets. So the MAC address is used to identify a physical device, unlike the network layer (layer 3) IP address, which is dynamically assigned to a device and can change.
When one device sends a packet to another, the packet enters the switch, and the switch reads the packet's header to decide how to handle it. It matches the destination address and sends the packet out through the appropriate port leading to the destination device.
Since there is a possibility of collisions between network traffic being sent and received simultaneously by the switch and the devices connected to it during this process, most switches provide full-duplex capability, which gives packets traveling to and from devices access to the full bandwidth of the switch connection. It's easy to understand if you picture two people talking on mobile phones rather than walkie-talkies.
Meanwhile, although most switches operate at layer 2, some switches can also operate at layer 3. These are called layer 3 switches and provide additional features such as virtual LAN (VLAN) configuration.
Switch vs hub
A hub can also connect multiple devices together for the purpose of sharing resources, and the group of devices connected to a hub is called a LAN segment. What sets a hub apart from a switch is that a packet sent from one connected device is broadcast to all devices connected to the hub.
A switch, on the other hand, forwards a packet only to the port leading to the device specified by the packet's destination address. Switches also typically connect LAN segments and the hubs connected to them. A switch filters out traffic headed for devices on the same LAN segment. Thanks to this, a switch uses its own processing resources and network bandwidth more efficiently.
Switch vs router
Switches are often confused with routers.
- A router provides network traffic forwarding and routing, which is where the name router comes from. However, the purpose and location of this work differ from a switch.
- A router operates at layer 3 (the network layer) and is used to connect a network to other networks.
To easily understand the difference between a switch and a router, think of LAN and WAN. Devices are connected locally through switches, and networks are connected to other networks through routers. It helps to think about the path a packet typically takes to reach the Internet (e.g., device > hub > switch > router > Internet).
Of course, switching functions are sometimes built into router hardware so that the router also acts as a switch. A typical example is the home wireless router. It routes the broadband connection through the WAN port, but usually also provides additional Ethernet ports used to connect Ethernet cables for computers, televisions, printers, or game consoles. Other devices on the network, such as laptops or smartphones, connect through the Wi-Fi router, but it still provides switching through the LAN. So a router is effectively a switch as well. You can also connect a separate switch to a router to give additional devices both Internet and LAN access.
Routers
A router lets computers communicate with each other and pass information between two networks (e.g., a home network and the Internet). The name router comes from its function of routing network traffic. A router can be wired (using Ethernet cables) or wireless. If you just need to connect computers, hubs, and switches so they work properly, and want all computers to access the Internet through a single modem, use a router or a modem with a built-in router. Routers also usually provide built-in security such as a firewall. Routers are more expensive than hubs and switches.
Access points
An access point, also called a base station, provides wireless access to a wired Ethernet network. An access point connects to a hub, switch, or wired router and sends out wireless signals. Through an access point, computers and devices can connect wirelessly to a wired network. An access point works the same way as a mobile phone base station. That is, users can keep accessing the network wirelessly while moving from one location to another. When you connect to the Internet wirelessly using a public wireless network at an airport, coffee shop, or hotel, you are usually connecting through an access point. If you have a router that provides wireless capability, you don't need an access point to connect computers wirelessly. Access points have no built-in technology for sharing an Internet connection. To share an Internet connection, you must connect the access point to a router or a modem with a built-in router.
Essential network terms
- Link
- The connection line between switches.
- Uplink
- The connection line going from a lower-level switch to a higher-level switch (a wider network).
- Link Up
- The state in which the LAN cable is properly connected and communication is possible.
- Link Down
- The state in which the connection is lost or a physical problem has occurred.
Switches by layer
- L2, L3, L4 Switch
- Helloworld: An alternative to L4/L7 switches, the open-source load balancer HAProxy
- L2 switches and L3 switches
- [Recommended] What are L2, L3, L4, and L7 switches 1
- Multilayer switch
L2 Switch
See Multilayer switch#2 Layer-2 switching for details.
L3 Switch
See Multilayer switch#2 Layer-3 switching for details.
L4 Switch
- Understanding the concept of L4 Switching 2
- How L4 devices work and caveats for service deployment 3
See Multilayer switch#2 Layer-4 switching for details.
L7 Switch
See Multilayer switch#Layer 7 for details.
Network engineer Hwanyeong's tech blog: Understanding L4 switches easily
"Understanding Network Infra easily/Understanding L4 & L7 Network easily" series
- Understanding Ports easily - Easy_to_understand_L4_switch_-_01.pdf (Port Number)
- Understanding TCP/IP easily - Easy_to_understand_L4_switch_-_02.pdf (TCP/IP)
- Understanding server load balancing easily - Easy_to_understand_L4_switch_-_03.pdf
- Understanding L4 switches easily #1 (Overview and role of L4 switches) - Easy_to_understand_L4_switch_-_04.pdf
- Understanding L4 switches easily #2 (Traffic Flow) - Easy_to_understand_L4_switch_-_05.pdf
- Understanding L4 switches easily #3 (NAT) - Easy_to_understand_L4_switch_-_06.pdf (NAT)
- Understanding L4 switches easily #4 (3-way handshake) - Easy_to_understand_L4_switch_-_07.pdf (TCP)
- Understanding L4 switches easily #5 (Source IP NAT problem) - Easy_to_understand_L4_switch_-_08.pdf (NAT)
- Understanding L4 switches easily #6 (Solving the Source IP NAT problem) - Easy_to_understand_L4_switch_-_09.pdf (NAT)
- Understanding L4 switches easily #7 (SSL Offload) - Easy_to_understand_L4_switch_-_10.pdf (SSL)
- Understanding L4 switches easily #8 (Health Check / Connection / Sticky) - Easy_to_understand_L4_switch_-_11.pdf
- Understanding L4 switches easily #9 (1, Network configuration) - Easy_to_understand_L4_switch_-_12.pdf
- Understanding L4 switches easily #9 (2, Network configuration part two) - Easy_to_understand_L4_switch_-_13.pdf
- Understanding L4 switches easily #10 (Redundancy) - Easy_to_understand_L4_switch_-_14.pdf
- Understanding L4/L7 load balancing easily - Easy_to_understand_L4_switch_-_15.pdf (L4/L7/Load Balancing)
- Understanding NAT easily - NAT_easy_to_understand.pdf (NAT)
- Understanding Source IP NAT easily - Easy_to_understand_L4_switch_-_17.pdf (NAT)
- Understanding Destination IP NAT easily - Easy_to_understand_L4_switch_-_18.pdf (NAT)
- Understanding SNMP easily #1 - Easy_to_understand_SNMP_1.pdf (SNMP)
- Understanding SNMP easily #2 - Easy_to_understand_SNMP_2.pdf (SNMP)
See also
Favorite site
- Wikipedia (en) Network switch
- Joinc - Network Switch
-
Microsoft Windows: Differences between hubs, switches, routers, and access points - Network Administrator Level 2 (completed) - Differences between hubs, switches, and routers
- Network equipment - Hub, Bridge, Switch, Router
- [Recommended] (Network is Fun!) Network equipment by layer 4
- [Recommended] Understanding the Internet through the evolution of hubs, switches, and routers 5
- [Recommended] Explanation of how MAC addresses, IP addresses, and PORT numbers are used 6