LAN switching is a form of packet switching used in local area networks (LAN). Switching technologies are crucial to network design, as they allow traffic to be sent only where it is needed in most cases, using fast, hardware-based methods. LAN switching uses different kinds of network switches. Basic switch is marked as layer 2 switch and could be found in nearly all LAN around. Layer 3 or layer 4 switch requires advanced technology (see managed switch) and are more expensive, and thus could be found in larger LAN or in the special network environment.
Layer 2 switching
Layer 2 switching uses the media access control address (MAC address) from the host's network interface cards (NICs) to decide where to forward frames. Layer 2 switching is hardware-based, which means switches use application-specific integrated circuit (ASICs) to build and maintain filter tables (also known as MAC address tables or CAM tables). One way to think of a layer 2 switch is as a multiport bridge.
Layer 2 switching provides the following
- Hardware-based bridging (MAC)
- Wire speed / non-blocking forwarding
- Low latency
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 dissimilar media (such as from Ethernet to FDDI). 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.
- Server farms — Servers need no longer be distributed to physical locations because virtual LANs can be created 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.
- Intranets — Allows organization-wide client/server communications based on a Web technology.
These new technologies allow more data to flow off from local subnets and onto a routed network, where a router's performance can become the bottleneck.
Bridged networks break up collision domains, but the network remains one large broadcast domain. Similarly, layer 2 switches (bridges) cannot break up broadcast domains, which can cause performance issues and limits the size of your network. Broadcast and multicasts, along with the slow convergence of spanning tree, can cause major problems as the network grows. Because of these problems, layer 2 switches cannot completely replace routers in the internetwork.
Layer 3 switching
Layer 3 switching is solely based on (destination) IP address stored in the header of IP datagram (see layer 4 switching later on this page for the difference). The difference between a layer 3 switch and a router is the way the device is making the routing decision. Traditionally, routers use microprocessors to make forwarding decisions, while the switch performs only hardware-based packet switching (by specialized ASIC with the help of content-addressable memory memory). However, some traditional routers can have advanced hardware functions as well in some of the higher-end models.
The main advantage of layer 3 switches is low latency. A traditional router receives a whole datagram and then analyzes it (i.e. store and forward). The layer 3 switch is able perform cut-through switching which means that the routing decision could be made by receiving only first part of the datagram (which contains IP addresses). This cut-through operation lowers network latency significantly and, for example, benefits in supercomputer environments with storage attached by iSCSI.
As layer 3 switches have no different functionally than a traditional router, they could be placed anywhere in the network because they cost-effectively replace expensive advanced routers with similar throughput and latency. The operations that a layer 3 switch does in the same manner as a traditional router are:
- Determine paths based on logical addressing
- Run layer 3 checksums (on 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
The benefits of layer 3 switching include the following:
- Hardware-based packet forwarding
- High-performance packet switching
- High-speed scalability
- Low latency
- Lower per-port cost
- Flow accounting
- Quality of service (QoS)
The switching algorithm is relatively simple and is the same for most of the routed protocols: a host would like to send a packet to a host on another network. Having acquired a router's address by some means, the source host sends the packet directly to that router's physical (MAC) address. The protocol (network layer) address is that of the destination host.
The router examines the packet's destination protocol address and determines whether it knows how to forward the packet or not. If the router does not know how to forward the packet, it typically drops the packet. If it knows how to forward packet, it changes the destination physical address to that of the next hop router and transmits the packet.
The next hop may be the destination or the next router, which executes the same switching process. As the packet moves through the internetwork, its physical address changes, but its protocol address remains same.
IEEE has developed hierarchical terminology that is useful in describing this process. Network devices without the capability to forward packets between subnetworks are called end systems (ESs, singular ES), whereas network devices with these capabilities are called intermediate systems (ISs). ISs are further divided into those that communicate only within their routing domain (Intradomain ES) and those that communicate both within and between routing domains (Interdomains IS). A routing domain is generally considered as portion of an internetwork under common administrative authority and is regulated by a particular set of administrative guidelines. Routing domains are also called autonomous systems.
Layer 4 switching
Layer 4 switching means hardware-based layer 3 switching technology that can also consider the type of network traffic (for example, distinguish between HTTP, FTP or VoIP). Layer 4 switching provides additional datagram inspection by reading the port numbers found in the Transport layer header to make routing decisions (i.e. ports used by UDP or TCP). These port numbers are found in RFC 1700 and reference the upper-layer protocol, program, or application.
The largest benefit of layer 4 switching is that the network administrator can configure a layer 4 switch to prioritize data traffic by application, which means a QoS can be defined for each user. For example, a number of users can be defined as a Video group and be assigned more priority, or band-width, based on the need for video conferencing.
Layer 4 information has been used to help make routing decisions for quite a while. For example, extended access lists can filter packets based on layer 4 port numbers. Another example is accounting information gathered by open standards using sFlow provided by companies like Arista Networks or proprietary solutions like NetFlow switching in Cisco's higher-end routers.
Multi-layer switching (MLS)
Multi-layer switching combines layer 2, 3 and 4 switching technologies and provides high-speed scalability with low latency. It accomplishes this high combination of high-speed scalability with low latency by using huge filter tables based on the criteria designed by the network administrator.
Multi-layer switching can move traffic at wire speed and also provide layer 3 routing, which can remove the bottleneck from the network routers. This technology is based on the idea of "route once, switch many".
Multi-layer switching can make routing/switching decisions based on the following
- MAC source/destination address in a Data Link frame
- IP source/destination address in the Network layer header
- Protocol field in the Network layer header
- Port source/destination numbers in the Transport layer header
There is no performance difference between a layer 3 and a layer 4 switch because the routing/switching is all hardware based (routing decision is done by specialized ASIC with the help of content-addressable memory).