Your Network's Edge®
Blog Post
You are here
Layer 2 vs Layer 3 Switching
How to Use Them to Effectively Deliver High-Quality Data Services
According to the open systems interconnection (OSI) networking model, Layer 2 is known as the data link layer. The Layer 2 protocol you’re likely most familiar with is Ethernet, in which devices are identified by a media access control (MAC) address. This address is typically hardcoded into a particular device and doesn’t normally change.
Layer 3 is the network layer and its protocol is the Internet Protocol or IP. Devices in an IP network are identified by an IP address, which can be dynamically assigned and may change over time. Traditionally, the network device most associated with Layer 3 has been the router, which allows you to connect devices to different IP networks.
7 layers of the OSI Model |
|||
7 |
Application |
End User layer-HTTP, FTP, SSH, DNS |
Process |
6 |
Presentation |
Syntax layer-SSL, SSH, MPEG, IMAP |
|
5 |
Session |
Synch & send to port-APIs, Sockets |
|
4 |
Transport |
E2E connection-TCP, UDP |
Host-to-Host |
3 |
Network |
Packets-IP, IPSec, ICMP, L3 Switch |
Internet |
2 |
Data Link |
Frames-Ethernet, PPP, L2 Switch, Bridge |
Network |
1 |
Physical |
Physical structure-Coax, Fiber, Wireless, Hubs |
Switches are one of the traffic directors of a network. They are used in the local area network (LAN), and as such a network grows in size and complexity, virtual LANs (VLANs) are introduced to segment the large physical network into multiple logical networks. For two devices to communicate across a typical business or home network, they need to have both an IP address, associated with Layer 3 (the IP layer), and a MAC address, associated with Layer 2 (the Ethernet layer). Simple networks connect devices through Layer 2, but as more VLANs are introduced into more complex networks, Layer 3 switching allows devices connected to different VLANs to communicate with one another without going through a dedicated router. Typical routing protocols that are used to assign Ethernet ports to different VLANs are RIP and OSPF (Open Shortest Path First). Layer 3 hardware logic sometimes replaces software logic deployed in routers but does not offer complete routing capabilities.
Major Switching Applications for L2 and L3
Major Layer 2 switching applications: Layer 2 switching is highly efficient because there is no modification to the data packet and the frame encapsulation of the packet changes only when the data packet is passing through different media (such as from Ethernet cable to fiber). Layer 2 switching is used for workgroup connectivity and network segmentation (breaking up collision domains). This allows a flatter network design with more network segments than traditional networks joined by repeater hubs and routers. Layer 2 switching has helped develop new components in the network infrastructure such as server farms. Servers no longer need to be distributed among physical locations because virtual LANs can be used to create broadcast domains and network proximity in a switched internetwork. This means that all servers can be placed in a central location, yet a certain server can still be part of a workgroup in a remote branch, for example in Intranets — allowing organization-wide client/server communications based on a web technology for distinct departments.
Layer 3 switching applications: The main advantage of layer 3 switches compared to traditional routers is the low latency they provide. A traditional router receives a whole datagram and then analyzes it (i.e., store and forward). A layer 3 switch, on the other hand, can perform cut-through switching, which means that the routing decision is made based only on the first part of the datagram (which contains IP addresses). This cut-through operation lowers network latency significantly – a major benefit in various environments. One example for this is supercomputers with storage attached by an iSCSI (Internet Small Computer System Interface), which is very common for linking data storage devices. Layer 3 switches can be placed anywhere in the network because they cost-effectively replace expensive advanced routers with similar throughput and latency. Just like a traditional router, a layer 3 switch will perform the following operations: Determine paths based on logical addressing, run layer 3 checksums (on the header only), use Time to Live (TTL), process and respond to any option information, update Simple Network Management Protocol (SNMP) managers with Management Information Base (MIB) information, provide security, and more.
Major benefits of layer 3 switching include hardware-based packet forwarding, high-performance packet switching, high-speed scalability, low latency, lower per-port cost, and Quality of service (QoS).
How to Choose Between Layer 2 and Layer 3 Switch
Choosing between a Layer 2 and a Layer 3 switch depends on various networking factors including the size of your network, the number of devices connected, and your network's traffic pattern. The key criteria are:
Criteria |
Layer 2 Switching |
Layer 3 Switching |
Cost |
Very cost-effective to small or medium-sized organizations |
More expensive and suits large organizations with complex networks |
Set-up and Configuration |
Simple to set up and manage |
Requires advanced configurations to set up and manage, mostly requiring dedicated IT resources |
Routing capabilities |
None |
Offers routing between different network segments |
Scalability |
Limited |
Very high |
Security |
No built-in security features |
Built-in security features such as access control lists, network segmentation with VLANs, authentication and more… |
Quality of Service (QoS) |
No QoS features to improve packet switching |
Several QoS features enabling prioritization of different types of network traffic, ensuring critical applications get the bandwidth required. |
With the criteria clarified, small to medium-sized networks with a limited number of devices and a simple traffic pattern can efficiently manage with Layer 2 switches. As mentioned above, these Layer 2 switches are cost-effective, easy to set up, and can handle high-speed data transfers within a single network segment. Conversely, large, complex networks with multiple network segments and more demanding traffic patterns are better addressed with Layer 3 switches and routers. The reason being that Layer 3 switches are capable of routing between network segments, providing advanced security features, and allowing for the implementation of quality of service (QoS).
Choosing the Right Layer 2 and Layer 3 Switch
Understanding the differences between Layer 2 and Layer 3 switching and deploying a switch that best meets your networking needs will help you ensure that your network is running at its best.
RAD’s ETS-1 line of Ethernet access switches provides 1G/10G end-user connectivity to large-scale corporate networks, small and medium businesses, and service providers. The ETS-1 features both L2 and L3 capabilities, highly effective cost-performance ratio, Power-over-Ethernet capabilities and advanced Ethernet OAM, Quality-of-Service, and other network service assurance features.
Learn more about the ETS-1 here.