The difference between the two-layer, three-layer, and four-layer switches is

  
. The Layer 2 switching technology is relatively mature. The Layer 2 switch is a data link layer device that can identify the MAC address information in the data packet and forward it according to the MAC address. These MAC addresses and corresponding ports are recorded in an internal address table. The specific workflow is as follows:

(1) When the switch receives a packet from a port, it first reads the source MAC address in the header, so that it knows that the source MAC address of the machine is connected. Which port is on;

(2) Then read the destination MAC address in the packet header and look up the corresponding port in the address table;

(3) As shown in the table The port corresponding to the destination MAC address, copy the packet directly to this port;

(4) If the corresponding port is not found in the table, the packet is broadcast to all ports, when the destination machine is the source When the machine responds, the switch can learn which port the destination MAC address corresponds to, and it is no longer necessary to broadcast all the ports when the data is transmitted next time. This process is continuously cycled, and the MAC address information of the entire network can be learned. The Layer 2 switch establishes and maintains its own address table.

From the working principle of the Layer 2 switch, the following three points can be inferred:

(1) Since the switch exchanges data of most ports at the same time, this requires a wide exchange bus bandwidth. If the Layer 2 switch has N ports, each port has a bandwidth of M, and the switch bus bandwidth exceeds N× M, then the switch can implement line-speed switching;

(2) Learning port-connected machines MAC address, write address table, address table size (generally two representations: one for BEFFER RAM, one for MAC entry value), the address table size affects the access capacity of the switch;

(3 Another is that Layer 2 switches generally contain an ASIC (Application Specific Integrated Circuit) chip dedicated to packet forwarding, so the forwarding speed can be very fast. Because each manufacturer uses different ASICs, it directly affects product performance.

The above three points are also the main technical parameters for judging the performance of the second and third layer switches. Please pay attention to the comparison when considering the equipment selection.

(2) Routing Technology

The router works in the third layer of the OSI model---network layer operation, and its working mode is similar to that of Layer 2 switching, but the router works on the third layer. This distinction determines the way routing and switching use different control information when delivering packets, and the way they implement functionality is different. The working principle is that there is also a table inside the router. The table indicates that if you want to go to a certain place, the next step should be to go there. If you can find the data packet from the routing table, go to the next step and put the link layer. The information is forwarded out; if you can't know where to go next, discard the packet and return a message to the source address.

Routing technology is essentially two functions: determining the optimal routing and forwarding of packets. Various information is written in the routing table, and the routing algorithm calculates the best path to the destination address, and then sends the data packet by a relatively simple direct forwarding mechanism. The next router that accepts the data continues to forward in the same way, and so on, until the packet arrives at the destination router.

There are two different ways to maintain routing tables. One is the update of routing information, which advertises part or all of the routing information. The router learns the topology of the whole network by learning routing information from each other. This type of routing protocol is called distance vector routing protocol; The router broadcasts its own link state information and learns the routing information of the entire network by learning each other to calculate the optimal forwarding path. This type of routing protocol is called a link state routing protocol.

Because the router needs to do a lot of path calculation work, the working ability of the general processor directly determines the performance of its performance. Of course, this judgment is still for low-end and mid-range routers, because high-end routers often adopt a distributed processing system architecture.

(3) Three-layer exchange technology

In recent years, the promotion of three-layer technology, the ears can be scorpion, shouting three layers of technology everywhere, some people say that this is a very new Technology, some people say that the three-tier exchange is not the stack of routers and Layer 2 switches, and there is nothing new. Is this really the case? Let's take a look at the working process of a Layer 3 switch through a simple network.

Networking is relatively simple

Equipment using IP A------------------------ Three-layer switch -- ----------------------Using IP device B

For example, A wants to send data to B, known destination IP, then A uses The subnet mask obtains the network address and determines whether the destination IP is on the same network segment as itself.

If it is on the same network segment but does not know the MAC address required to forward data, A sends an ARP request, and B returns its MAC address. A uses this MAC to encapsulate the packet and send it to the switch. The Layer 2 switching module searches the MAC address table and forwards the data packet to the corresponding port.

If the destination IP address is not on the same network segment, then A needs to communicate with B. If there is no corresponding MAC address entry in the stream cache entry, the first normal packet is sent to a default. Gateway, this default gateway is generally set in the operating system
, corresponding to the third layer routing module, so it can be seen that for the data that is not the same subnet, the default gateway is placed in the MAC table first. The MAC address; then the packet is received by the Layer 3 module, the routing table is queried to determine the route to B, and a new frame header is constructed, wherein the MAC address of the default gateway is the source MAC address to Host B. The MAC address is the destination MAC address. Through a certain identification trigger mechanism, the correspondence between the MAC address and the forwarding port of the host A and the B is established, and the inflow cache entry table is recorded, and the data of the subsequent A to B is directly submitted to the layer 2 switching module. This is usually referred to as a route that is forwarded multiple times.

The above is a brief summary of the working process of the three-layer switch. It can be seen that the characteristics of the three-layer switching:

High-speed forwarding of data by hardware combination.

This is not a superposition of a simple Layer 2 switch and router. The Layer 3 routing module is directly superimposed on the high-speed backplane bus of the Layer 2 switch, breaking the interface rate limit of the traditional router, and the rate can reach dozens. Gbit/s. Counting backplane bandwidth, these are two important parameters of Layer 3 switch performance.

Copyright © Windows knowledge All Rights Reserved