Comprehensive comparison between layer-2 switching and layer-3 Switching

Source: Internet
Author: User

There are many things worth learning about layer-3 switching technology. Here we mainly introduce the comprehensive comparison between layer-2 switching and layer-3 switching technology. In today's network construction, the layer-3 switching technology is recognized and praised by users for its efficient performance, excellent performance and price ratio. At present, layer-3 switches have been widely used in enterprise networks, campus network construction, Smart Community Access, and many other occasions. market demands and technological updates promote the development of such applications in depth.

Traditional L2 Exchange Technology

A traditional LAN switch is a L2 network device that constantly collects information during operations to create a MAC address table. This table is quite simple and basically shows the port on which a MAC address is found. Then, when the switch receives an Ethernet packet, it will view the destination MAC address of the packet and check its address table to confirm the port from which the packet is sent. But when the switch receives an unknown packet, that is to say, if the destination MAC address is not in the MAC address table, the switch will "spread" the packet, that is, it will be sent from all ports, just as a vswitch receives a broadcast packet, this exposes the weakness of a traditional LAN switch: it cannot effectively solve broadcast, heterogeneous network interconnection, security control, and other problems. Therefore, the VLAN Virtual LAN technology on the switch is generated.

Layer-3 Switching Technology

Layer-3 switching is also called multi-layer switching technology or IP address switching technology. As we all know, the traditional exchange technology operates on the Layer 2-data link layer in the OSI Standard network model, while the Layer 3 exchange technology implements high-speed packet forwarding in the network model. Simply put, layer-3 switching technology is "layer-2 switching technology + layer-3 forwarding ". The emergence of layer-3 switching technology solves the problem that the subnet in the network segment must be managed by the router after the network segment is divided in the LAN, and solves the network bottleneck problem caused by the low speed and complexity of the traditional router.

L2 Switch communication process

Assume that two sites A and B that use the IP protocol communicate with each other through the L2 Switch. When sending Site A, they will first compare their IP addresses with the IP addresses of site B, determine whether Site B is in the same subnet as itself. If the destination site B and the destination site A are in the same subnet, Layer 2 Forwarding is performed. To obtain the MAC address of Site B, site A first sends an ARP broadcast packet to request the MAC address of site B. After the ARP request packet enters the switch, it first learns the source MAC address. The chip automatically enters the MAC address of Site A and the port number of the switch into the MAC address table of the chip, then, search for the target address in the MAC address table. Because it is a broadcast packet, the switch broadcasts the broadcast packet from the VLAN to which the switch port belongs. After receiving the ARP request, site B immediately sends an ARP reply packet, which is A single broadcast packet with the target address as the MAC address of Site. After the package enters the vswitch, it also learns the source MAC address and then searches for the target address. Because the MAC address table already contains A match entry for the MAC address of Site, therefore, the switch forwards the packet directly from the corresponding port. Through the previous ARP process, the exchange chip saves the information of Site A and site B in its MAC address table. After communication between A and B, or other sites in the same network segment want to communicate with A or B, the switch will know the port from which the packet is sent. From the above process, we can see that all layer-2 Forwarding is completed by hardware. No software intervention is involved in both the learning process of the MAC address table and the process of determining the output port by searching the destination address.

Layer-3 Switch communication process

Sites A and B communicate through layer-3 switches. The CIDR blocks of Site A and site B both belong to the direct connection CIDR blocks of the vswitch. If Site A and site B are not in the same subnet, the sender A must first send an ARP request packet to the "Default Gateway, the IP address of the "Default Gateway" is actually the IP address of the VLAN to which site A belongs on the layer-3 switch. When station A broadcasted an ARP request to the IP address of the "Default Gateway", the switch sent an ARP reply packet to Station A, telling the MAC address of the VLAN of the Site, at the same time, you can set the IP address, MAC address, and port number of Site A directly connected to the switch to the layer-3 hardware table of the switch chip through software. After receiving the ARP reply packet, Site A replaces the destination MAC address and sends the packet to B to the switch first. After receiving the package, the switch first learns the source MAC address. The destination MAC address is the MAC address of the switch, in this case, the paper will be sent to the layer-3 engine of the switch chip for processing. Generally, the layer-3 engine has two tables, one of which is the host route table, which is indexed by IP addresses, which stores information such as the destination IP address, Next Hop MAC address, and port number. If a matching table item is found, the packet will be forwarded from the specified port in the table after some operations are performed on the packet, such as replacing the destination MAC with the source MAC, and decreasing the TTL by 1. If no matching entry is found in the host route table, the route table of the CIDR Block in the other table is queried. This table stores the network segment address, next-hop MAC address, port number, and other information. In general, this table has much fewer entries, but it covers a large range. As long as it is set properly, it can basically ensure that most of the packets entering the switch are forwarded by hardware, this not only greatly improves the forwarding speed, but also reduces the CPU load. Because the layer-3 engine inside the chip has saved the routing information of Site A and site B, the sites that will communicate with site A and site B in the future or other network segments want to communicate with sites A and site B, the switch chip directly forwards the package from the port specified in the three-tier hardware table item, without having to hand over the package to the CPU for processing. This method greatly improves the forwarding speed through "one route and multiple exchanges.

Although it has been only a few years since the concept was proposed and Its Application in network construction has become more and more extensive, from the initial backbone layer to the intermediate aggregation layer, it is always infiltrated into the edge access layer. L3 switches have many advantages such as fast speed, good performance, and low price. You can use a layer-3 Switch instead of a router where WAN connection is not required. With the development of ASIC hardware chip technology and the promotion of practical application, layer-3 switching technology and products will be further developed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.