Advanced Tutorial: Learn about the basic features of a layer-3 Switch

Source: Internet
Author: User

Beginner: I learned about the basic features of a layer-3 Switch. Some time ago, my colleagues asked me questions about the basic features of the layer-3 Switch. At that time, I did not give a positive answer, I was also the first to have a problem with the basic features of a layer-3 Switch. In the following days, I checked the relevant information and was satisfied with the answer below. Share it with you now!

In the overview section, we provide a summary of the basic features of layer-3 switches, which have the following features:
◆ Layer-2 switching and layer-3 Intercommunication
◆ Implement layer-3 exact match Query
◆ Optimized for LAN, especially Ethernet
◆ Introduced some features that do not exist on both L2 switches and L3 Routers
◆ Implemented initial BAS Functions

In general, as long as the first point can be achieved, it can be called the basic features of layer-3 switches. However, the basic features of most popular layer-3 switches are not limited to the first point, however, most of the above functions are implemented. Therefore, in order to better understand the basic features of a layer-3 switch, we will detail the above features.

Layer-2 switching and layer-3 Intercommunication

The basic feature of a layer-3 switch is a switch, that is, the layer-2 switch function. On Ethernet, like a common L2 Switch, the basic features of a l3 switch also maintain an address table for L2 switching, which is usually called a CAM table ), this table corresponds to the MAC address and the outbound interface.

In this way, each time an Ethernet data frame is received, the basic features of the layer-3 Switch determine if the data frame is not sent to itself. How can we determine the basic features of the layer-3 switch, in the following sections, we will explain in detail). Then, the CAM table is queried based on the target MAC address of the data frame. If it can hit the so-called hit, is to find the forwarding item corresponding to the MAC address in the CAM table), then based on the query result, it is usually an output interface list for forwarding. If the data frame cannot be hit, the data frame is broadcast to all ports.

The cam table of the vswitch can be obtained in multiple ways, such as static configuration and dynamic learning. For multicast, you can also get attention through various multicast protocols, such as IGMP Snoop and GMRP, multicast forwarding tables cannot be obtained through learning. Different from normal forwarding items, multicast forwarding entries may have more than one egress but an egress set, if you want to learn more about some basic concepts of multicast, refer to the previous topic materials ). But for unicast, the most important way to establish it is to learn.

When the switch receives a data frame, it extracts the target MAC address of the data frame and queries the CAM table accordingly. If the result can be found, it forwards the data frame according to the result, if the hit is not hit, it is copied to all ports except the acceptor port.

While forwarding data, the switch also performs a learning process. The switch extracts the source MAC address of the data frame and queries the CAM table, check whether there are forwarding entries for this MAC address in the CAM table. If not, bind the MAC address to the port on which the MAC address is received and insert the CAM table entry.

In this way, when receiving a data frame sent to the MAC address, you do not need to broadcast to all ports, but only send to this port. It should be noted that the data Frame Forwarding is based on the target MAC address to query the CAM table, while the learning of the CAM table is based on the source MAC address.

The CAM table of vswitch dynamic learning is not static, but starts a timer. When the timer decreases to zero, the CAM table is deleted, each time this CAM table item is used for forwarding, the initial timer value is restored. In this case, no VLAN is used. Currently, all vswitches implement VLAN (Virtual LAN). For details, refer to the relevant Ethernet tutorial ), in this way, the CAM table for forwarding is changed.

From the original two ing MAC address and Interface) to three ing MAC address, vlan id, egress), so when receiving a data frame, the switch queries the CAM table based on the destination MAC address and vlan id of the data frame, finds the interface, and forwards the data frame.

However, if the switch fails to query the CAM table based on the MAC address and vlan id, it does not have a correspondence with the MAC and vlan id, the switch copies the data frame to all ports included in the VLAN except the receiving port. If you only use the CAM table to determine which ports are contained in a VLAN, you must traverse the entire CAM table. In this way, if the CAM table is large, it is generally 4 K or above ), the efficiency is particularly low.

Therefore, when VLAN is implemented on a general switch, another table is created, namely, the VLAN configuration table, which contains the correspondence between VLAN IDs and all ports, that is, you can query the table by vlan id to find all ports contained in the VLAN. This makes it very easy to broadcast packets in the VLAN.

Another problem is how the vlan id of the data frame is obtained. Generally, a vswitch attaches vlan id to a data frame according to the following principles: If the received data frame port is a non-TAG port and the data frame is a common data frame, append the default vlan id of the port. According to the native understanding, when a non-TAG port receives a data frame and contains a vlan id, make a judgment, if the vlan id is the PVID of the port, it can be received; otherwise, it is discarded.

If the port that receives the data frame is a TAG port and the data frame is a common data frame, the default vlan id of the port is appended. If the port that receives the data frame is a TAG port, A data frame carries its own vlan id through the 802.1Q protocol. note that before querying the CAM table for forwarding, the VLAN switch first attaches the vlan id to the data frame.

The above functions are layer-2 functions. As a basic feature of a layer-3 Switch, these functions must be implemented. However, the most fundamental feature of the basic features of a layer-3 switch is the interconnection between VLANs. In terms of the basic features of a layer-3 Switch, VLAN intercommunication is achieved by implementing a virtual VLAN interface. For each VLAN, the switch maintains an interface corresponding to the VLAN, this interface is invisible to external users and is a virtual interface. However, this interface has all the features of physical interfaces, such as MAC addresses, you can configure the maximum transmission unit and the Ethernet frame type for transmission.

In the above description, we mentioned that when the switch receives a data frame, it determines whether it is sent to itself, check whether the MAC address is the MAC address of the interface of the VLAN where the received data frame is located. If yes, perform layer-3 processing. If not, perform layer-2 processing, forward data according to the preceding process.

Since Layer-3 Forwarding is implemented, the switch must maintain a layer-3 forwarding table. This table can be a FIB table based on the longest matching query, or a layer-3 Forwarding Table Based on the precise matching of the destination network address, this is related to the manufacturers. In this way, when the switch receives a data frame, the destination MAC address of the data frame is the same as the MAC address of the VLAN Interface corresponding to the data frame, layer-3 Forwarding is performed.

The forwarding process is to query the three-layer forwarding table. The query result is one or more. When the data frame is multicast, the egress and the corresponding two-layer encapsulated data are returned, the switch then modifies the three-layer data frame carried by the data frame, for example, IP or IPX datagram. For example, it modifies the CHECKSUM. In the IP protocol, it also degrades the TTL field and recalculates CHECKSUM, after this is done, the layer-3 data packet is encapsulated in layer-2 mode based on the layer-3 Forwarding Table query results) and sent from the corresponding interface.

The formation of this layer-3 forwarding table is very different from that of the layer-2 Forwarding Table CAM table. It is formed by querying the route table and passing through other protocols such as ARP. Later, we will introduce the formation of a three-tier forwarding table with examples.

This section has the following key points: the basic features of a layer-3 Switch include all the functions of a layer-2 switch, such as MAC address-based filtering, or MAC address-based unicast forwarding; the basic features of a layer-3 Switch are that VLAN interfaces are interconnected by assigning a VLAN interface to each VLAN. The VLAN interface has its own MAC address and IP address. The destination MAC address is the data frame of the VLAN interface, all vswitches perform layer-3 forwarding or self-receive-depending on whether the destination IP address is the interface address of the vswitch.

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.