Comparison of layer-2 switching and routing technologies

Source: Internet
Author: User

The emergence of local area networks has already gone through more than thirty years. During the past thirty years of development, the core CSMA/CD technology was introduced from the first wireless technology ALOHA to the Fast Ethernet 802.3u) and the emergence of modern GE802.3z) 10GE Ethernet technology, constantly new. This raises a problem. For a specific network, it is difficult to choose a good networking technology because of the diversity of available networking methods.

For users, the high reliability, high performance, easy maintenance, and scalability of the network are ensured under the premise of reducing the cost, which is closely related to the networking technology used. For device manufacturers, on the basis of ensuring the realization of users' network functions, how to make more profits and use the advantages and disadvantages of networking technology is also a means to increase profits.

At present, the development of technology can be said that the first-layer interface and second-layer exchange technology for users have become increasingly mature, and their development status is satisfactory. Therefore, the focus of selection is not at this level. However, as the core of the network, there is no substantial breakthrough in the router technology that acts as the interconnection between networks. Therefore, a new routing technology came into being-layer-3 switching technology, which is a routing technology because it works on the layer-3 network protocol, the two-layer switching speed is almost possible.

In the trade-offs of these technologies, the choice of layer-2 switching + Routing networking and layer-3 switching networking is a focus. Who is the best or inferior of layer-2 switches, layer-3 switches, and routers, what environments are they applicable? To answer this question, we should first start with the working principles of these three technologies.

1) layer-2 Exchange Technology

The layer-2 switching technology is 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, the 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 from the packet header, so that it knows the port on which the machine with the source MAC address is connected;

2) read the target MAC address in the header and find the corresponding port in the address table;

3) if the table contains a port corresponding to the destination MAC address, copy the packet directly to the port;

4) if no corresponding port is found in the table, the packet is broadcast to all ports. When the target machine responds to the source machine, the switch can learn which port the target MAC address corresponds, the next time you transmit data, you no longer need to broadcast all ports.

In this process, the MAC address information of the entire network can be learned. The second-layer switch creates and maintains its own address table.

The working principle of a L2 Switch can be inferred from the following three points:

1) because the switch exchanges data on most ports at the same time, it requires a wide switching bus bandwidth. If the L2 Switch has N ports, the bandwidth of each port is M, if the bandwidth of the vswitch bus exceeds N × M, the vswitch can achieve line rate switching;

2) the MAC address of the machine connected by the Learning port, which is written to the address table. The size of the address table is generally expressed in two ways: one is beffer ram and the other is the MAC table item value ), the address table size affects the access capacity of the vswitch;

3) Another layer-2 switch generally has an ASIC Application specific Integrated Circuit Chip dedicated for packet forwarding, so the forwarding speed can be very fast. Because different manufacturers use different ASIC, the product performance is directly affected.

The above three points are also the main technical parameters used to judge the performance of Layer 2 and Layer 3 switches. Please pay attention to the comparison when considering device selection.

2) routing technology

The router operates on the layer 3 of the OSI model-the network layer. Its working mode is similar to that of the Layer 2 switch, but the router works on the layer 3, this difference determines that routes and switches use different control information when passing packets, and the implementation methods are different. The working principle is that there is also a table inside the vro, which 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, add the link layer information and forward it. If you do not know where the next step is, discard the package and return a message to the source address.

In essence, the routing technology has two features: determining the optimal route and forwarding data packets. Various information is written into the routing table. The routing algorithm calculates the Optimal Path to the destination address, and then sends data packets through a simple and direct forwarding mechanism. The next vro that receives data continues to forward according to the same working method, and so on until the data packet reaches the destination vro.

There are two different ways to maintain the route table. One is to update the route information, publish some or all of the route information, and the router learns route information from each other to master the topology of the whole network, this type of routing protocol is called the distance vector routing protocol. The other is that the router broadcasts its own link status information and learns from each other to learn route information across the network, then, the optimal forwarding path is calculated. This type of routing protocol is called the Link State routing protocol.

Because a vro requires a lot of path computing, the performance of a general processor is determined directly. Of course, this judgment is still for low-end routers, because high-end routers often adopt distributed processing system design.

3) layer-3 Switching Technology

In recent years, three-layer technology has been widely promoted, and many people have shouted three-layer technology. Some people say this is a very new technology. Some people also say that it is a three-layer exchange technology, there is no new things in the stack of routers and L2 switches. Is that true? Next, let's take a look at the working process of a layer-3 Switch through a simple network.

Easy networking

Device A with IP address ---------------------- layer-3 Switch ---------------------- Device B with IP Address

For example, if A wants to send data to B and the target IP address is known, A uses the subnet mask to obtain the network address and determine whether the destination IP address is in the same network segment as itself.

If A is in the same network segment but does not know the MAC address required for data forwarding, A sends an ARP request, B returns its MAC address, and A uses this MAC encapsulation packet to send it to the switch concurrently, the second-layer switch module is used to find the MAC address table and forward data packets to the corresponding port.

If the destination IP address is not displayed in the same CIDR block, A needs to communicate with B, and there is no corresponding MAC address entry in the stream cache entry, send the first normal data packet to a default gateway. This default gateway is usually set in the operating system and corresponds to the layer-3 routing module. Therefore, we can see that for data not in the same subnet, the MAC address of the default gateway is first placed in the MAC table. Then, the layer-3 module receives the packet and queries the route table to determine the route to B. A new frame header is constructed, the MAC address of the default gateway is the source MAC address, and the MAC address of host B is the target MAC address. Through A certain identification trigger mechanism, it establishes the MAC address and forwarding port correspondence between host A and host B, and records the data from host A to host B in the stream cache entry table, it is directly submitted to the layer-2 Switching Module. This is generally referred to as one-time route forwarding.

The above is a brief summary of the three-layer switch process. We can see the characteristics of the three-layer switch:

Hardware is used together to achieve high-speed data forwarding.

This is not a simple superposition of Layer 2 switches and routers. The Layer 3 routing module is directly superimposed on the Layer 2 switching high-speed backplane bus, breaking through the interface speed limit of traditional routers, the speed can reach dozens of Gbit/s. Calculating the backboard bandwidth is two important parameters for the performance of a layer-3 switch.

The simple routing software simplifies the routing process.

Most of the data forwarding, except for the necessary route selection, is handled by the routing software, and is a layer-2 module for high-speed forwarding. Most of the routing software is an efficient optimization software that has been processed, it is not a simple copy of the software in the router.

Conclusion

L2 switches are used in small local networks. There is no need to talk about this. In a small LAN, broadcast packets have little impact, the two-layer switch's fast switching function, multiple access ports, and low price provide a perfect solution for small network users.

The advantage of a vro lies in its rich interface types, powerful three-tier functions, and powerful routing capabilities. It is suitable for routing between large networks. Its advantage lies in the selection of the best route and load balancing, router functions such as link backup and exchange of route information with other networks.

The most important function of a layer-3 switch is to accelerate the fast data forwarding within a large local area network. If a large network is divided into small local networks by department, region, and other factors, this will lead to a large number of Internet mutual access. Simply using a layer-2 switch cannot achieve Internet mutual access. For example, simply using a router, due to the limited number of interfaces and slow route forwarding speed, the network speed and network scale will be limited. Using a layer-3 switch with the routing function for fast forwarding will become the first choice.

In general, in a network with a large volume of intranet data streams and fast response requirements, if all three-layer switches do this, the layer-3 switches will be overloaded and the response speed will be affected, it is a good networking strategy to make full use of the advantages of different devices by handing over the routes between networks to routers. Of course, the premise is that the customer's pockets are great; otherwise, they will leave for the second place, the layer-3 switch is also connected to the Internet.

Related Articles]

  • What are the differences between layer-3 vswitches and vrouters?
  • Why use a layer-3 Switch and its benefits
  • Analysis of layer-3 switching technology and product selection

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.