The principle and difference of the two-layer switch, three-layer switch and Router _ network

Source: Internet
Author: User
Tags switches
Two-layer switch:

Two-layer switching technology is a mature development, two-layer switch is a data link layer device, can identify the MAC address information in the packet, according to the MAC address forwarding, and the MAC address and the corresponding port record in their own internal address table.

Specifically as follows:

(1) When the switch receives a packet from a port, it first reads the source MAC address in the header, so it knows the source MAC address machine is connected to which port;

(2) to read the destination MAC address in the header and find the corresponding port in the Address table;

(3) If there is a port corresponding to the MAC address in the table, copy the packet directly onto the port.

Three-layer switch: three-layer switching technology is the technology of combining routing technology with Exchange technology. After the first data flow is routed, the it will generate a MAC address and IP address mapping table, when the same data flow through again, according to this table directly from the two layer through rather than again routing, thus eliminating the router routing and resulting in network delay, improve the efficiency of packet forwarding.

Routers: Traditionally, routers work in the third layer of the OSI Seven layer protocol, whose main task is to receive packets from a network interface and, depending on the destination address contained therein, decide to forward to the next destination address. Therefore, the router must first find its destination address in the forwarding routing table, and if the destination address is found, add the next MAC address in front of the packet's frame, and the TTL (Time to Live) field of the IP packet header begins to be meiosis, and the checksum is recalculated. When a packet is sent to the output port, it needs to wait sequentially in order to be transmitted to the output link.

Routers are able to find the routing table in a device according to a routing communication protocol at work. If there is more than one path to a particular node, the basic predetermined routing criterion is to select the optimal (or most economical) transport path. Because the various network segments and their mutual connections may vary depending on the environment, the routing information is usually updated as specified in the Routing information protocol used.

Main difference: The two-tier switch works at the data link layer, the three-tier switch works at the network layer, and the router works at the network layer.

The specific differences are as follows:

The difference between a two-tier switch and a three-tier switch:

Layer three switch uses three-tier switching technology

Simply put, the three-layer switching technology is: two-layer switching technology + three-layer forwarding technology. It solves the problem of network bottleneck caused by the low speed and complexity of the traditional routers after the network segment is divided and the network segment has to rely on the router for management.

What is a three-tier exchange

The three-tier exchange (also known as multi-layer switching technology, or IP switching technology) is presented in relation to the traditional exchange concepts. As we all know, the traditional exchange technology is done in the second layer of the OSI Network Standard Model, the data link layer, while the three-layer switching technology realizes the high-speed forwarding of the packet in the third layer of the network model. Simply put, the three-layer switching technology is: two-layer switching technology + three-layer forwarding technology.

The emergence of the three-layer switching technology solves the problem of network bottleneck caused by the low speed and complexity of the traditional routers, after solving the division of the network segment in the LAN, the network segment must rely on the router for management.

The principle is: assuming that two sites using the IP protocol to communicate through the third layer of switches, send site A at the beginning of the send, the IP address and B station to compare their IP address, to determine whether B station with their own in the same subnet. If the destination station B is within the same subnet as the sending station A, then two-layer forwarding is carried out. If two sites are not in the same subnet, such as sending station A to communicate with the destination station B, send station A to the "Default gateway" issue ARP (address resolution) packet, and the "Default gateway" IP address is actually a three-tier switch three-tier switching module. When sending station a broadcasts an ARP request to the IP address of the "default gateway", if the three-tier switching module already knows the MAC address of station B in the previous communication, reply to the MAC address of B from the Send station a. Otherwise, the three-layer switching module broadcasts an ARP request to station B according to the routing information. B Station received this ARP request to the three-tier switching module to reply to its MAC address, the three-tier Exchange module to save this address and reply to send station A, while the MAC address of B station sent to the two-tier switching engine MAC Address table. Since then, when a packets sent to B are all handed over to the two-tier exchange, the information is exchanged at high speed. Because only in the routing process requires three layers of processing, the vast majority of data through the two-tier exchange forwarding, so the three-tier switch speed, near the speed of two-tier switches, and the price is much lower than the same router.

The difference between a second tier switch and a router:

The traditional switch is developed from the Network Bridge, which belongs to the OSI second layer, the data link layer equipment. It is based on the MAC address, select routing through the station table, the establishment and maintenance of the station table is automatically carried out by the switch. The router belongs to the OSI third layer, the network layer device, which is addressed according to the IP address and is generated by routing protocol. The biggest advantage of the switch is fast, because the switch only needs to identify the MAC address in the frame, directly based on the MAC address to generate a selection of the algorithm is simple, easy ASIC implementation, so the forwarding speed is very high. But the working mechanism of the switch also poses some problems.

1. Loop: According to the switch address learning and station table building algorithm, the switch does not allow the existence of circuit. Once the loop is present, a spanning tree algorithm must be started to block out the ports that generate the loop. Router routing protocol does not have this problem, routers can have more than one path to balance the load, improve reliability.

2. Load concentration: There is only one path between the switches, so that information is concentrated in a communication link, can not be dynamically allocated to balance the load. The routing protocol algorithm of routers can avoid this, the OSPF routing protocol algorithm can not only produce multiple routes, but also choose the best route for different network applications.

3. Broadcast control: Switches can only narrow the conflict domain, but not the broadcast domain. The whole switching network is a large broadcast domain, the broadcast message scattered to the entire switched network. While routers can isolate broadcast domains, broadcast messages cannot continue to be broadcast through routers.

4. Subnet Division: Switches can only recognize MAC addresses. The MAC address is the physical address, and it uses a flat address structure, so the subnet cannot be divided according to the MAC address. But the router recognizes the IP address, the IP address is assigned by the network administrator, is the logical address and the IP address has the hierarchy structure, is divided into the network number and the host number, can be very convenient to divide the subnet, the router main function is uses for the connection different network.

5. Confidentiality: Although the switch can also be based on the frame of the source MAC address, the purpose of the MAC address and other frame content to filter the frame, but the router based on the message source IP address, Destination IP address, TCP port address and other content of the message implementation of filtering, more intuitive and convenient.

6. Media-Related: Switches as bridging equipment can also be completed between the different link layer and physical layer of the conversion, but this conversion process is more complex, not suitable for ASIC implementation, it is bound to reduce the forwarding speed of the switch. Therefore, the current switch mainly completes the same or similar physical media and Link protocol network interconnection, and will not be used in physical media and Link layer protocol difference between the network interconnection. Routers, however, are mainly used for interconnection between different networks, so that they can connect different physical media, link layer protocols and network layer protocols. Although the router occupies the advantage in the function, but the price is expensive, the message forwarding speed is low. In recent years, switches have done a lot to improve performance, with the most notable improvements being virtual networks and three-tier switching.

Dividing the subnet can narrow the broadcast domain and reduce the influence of the broadcast storm on the network. Each interface of the router is connected to a subnet, the broadcast message can not be broadcast through the router, the subnet connected to different interfaces of the router belongs to different subnets, and the subnet range is divided by the router physics. For the switch, each port corresponds to a network segment, because the subnet consists of several network segments, through the combination of switch ports, you can logically divide the subnet. Broadcast messages can only be broadcast in the subnet, can not spread to other subnets, through a reasonable division of the logical subnet, to control the purpose of broadcasting. Because a logical subnet is any combination of switch ports and has no physical dependencies, it is called a virtual subnet, or virtual network. The virtual network technology solves the problem of the broadcast message isolation without the router, and the virtual network segment has nothing to do with its physical location, that is, the adjacent network segment can belong to different virtual networks, while the two segments which are far apart may belong to different virtual networks, while the two segments which are far apart may belong to the same virtual network. The terminals in different virtual networks cannot communicate with each other, which enhances the access control of the data within the network.

The difference between a third tier switch and a router:

Before the advent of the third-tier switching technology, there was little need to differentiate between routing features and routers, and they were all the same: Providing routing functionality was being done at the router, but now the third tier switches are fully capable of performing most of the traditional router's functions. As a network interconnection device, the third layer switch has the following characteristics:
1. Forwarding business flows based on third-tier addresses;

2. Full Exchange function;

3. Can complete special services, such as packet filtering or certification;

4. Perform or do not perform routing processing.

Third-tier switches have the following advantages over traditional routers:

1. Transmission bandwidth between subnets can be arbitrarily distributed: traditional routers each interface to connect a subnet, the subnet through the router transmission rate is limited by the bandwidth of the interface. And the three-tier switch is different, it can be defined as a virtual network of multiple ports, the virtual network as a virtual network interface, the virtual network information can be composed of virtual network of ports to the three-tier switch, because the number of ports can be arbitrarily specified, the transmission bandwidth between the subnet is unlimited.

2. Reasonable allocation of information resources: due to access to the resource rate in the subnet and access to the global network, there is no difference in resource rate, the subnet set up a separate server is not significant, by setting up a server group in the global network not only save costs, but also reasonable configuration of information resources.

3. Reduce costs: the usual network design with the switch to form a subnet, using routers to interconnect between subnets. At present, three-layer switch is used to design the network, which can be divided by any virtual subnet, and the communication can be done through the three-layer routing function of the switch, thus saving the expensive router.

4. Flexible connection between switches: As a switch, they do not allow the existence of a circuit, as a router, but also have more than one path to improve reliability, balance load.          The three-layer switch blocks the port that causes the loop with the spanning tree algorithm, but when routing is chosen, the blocked path is still taken as an optional path to participate in routing. Switch and router are the contradictory of performance and function, the switch speed is fast, but the control function is weak, the router control performance is strong, but the message forwarding speed is slow.                  The latest technology to solve this contradiction is the three-layer switch, which has the ability of switching the speed of the forwarding message and the good control function of the router. The main difference between a three-tier switch and a router one can't figure out the difference between the three-tier switch and the router, the most fundamental is that the three-tier switch also has a "routing" feature, which is generally consistent with the routing capabilities of traditional routers. However, the three-tier switch and the router still have a substantial difference in nature, the following are described separately.
1. The main function is different although three-tier switches and routers have routing functions, but we can not equate them, just as many network devices at the same time with a variety of traditional network device features, as now there are many broadband routers not only have the routing function, but also provides the switch port, the hardware firewall function, But you can't equate it with a switch or a firewall. Because the main function of these routers is the routing function, the other function is only its additional function, the purpose is to make the equipment more extensive, make it more practical. The same is the three-tier switch, which is still a switch product, except that it is a switch with some basic routing capabilities, and its main function is data exchange. In other words, it has the data exchange and routing by two functions, but its main function is data exchange, and routers have only the main function of routing forwarding.
2. The main application of the environment is not the same as the three-tier switch routing function is usually simpler, because it is mainly faced with a simple LAN connection. For this reason, the routing function of layer three switches is usually simpler, and routing paths are far less complex than routers. It uses in the local area network The main use or provides the fast data exchange function, satisfies the local area network data exchange frequent application characteristic. And the routers are different, it is designed to meet the different types of network connectivity, although also applicable to the connection between the LAN, but its routing function is more reflected in the interconnection between different types of networks, such as the connection between the LAN and the WAN, the network of different protocols, etc. So routers are primarily used between different types of networks. Its main function is routing forwarding, solve a variety of complex routing network connection is its ultimate goal, so the router's routing function is usually very powerful, not only applicable to the same protocol LAN, more suitable for different protocols of the LAN and WAN. It has the advantage of choosing the best routing, load sharing, link backup and the exchange of routing information with other networks, and so on.
3. Performance is different from the technology, routers and three-tier switches have significant differences in packet switching operations. Routers typically perform packet switching by a microprocessor based software routing engine, while a three-tier switch performs packet switching through hardware. Three-tier switches after the first data flow is routed, it will generate a MAC address and IP address mapping table, when the same data flow through again, according to this table directly from the two layer through rather than again routing, thus eliminating the router routing and resulting in network delay, improve the efficiency of packet forwarding. At the same time, three-layer switch routing lookup is for the data stream, it uses the caching technology, it is easy to use ASIC technology to achieve, therefore, can greatly save costs, and realize fast forwarding. But the router's forwarding uses the longest matching way, realizes the complexity, usually uses the software to realize, the forwarding efficiency is low. Because of this, in terms of overall performance comparisons, three-layer switch performance is much better than the router, very suitable for data exchange frequently in the LAN, while the router is very powerful, but its packet forwarding efficiency is much lower than the three-tier switch, more suitable for data exchange is not very frequent interconnection of different types of networks, such as LAN and the Internet interconnection. If the router, especially high-end routers used in the local area network, it is a waste (in terms of its powerful routing function), but also can not well meet the requirements of LAN communication performance, affecting the normal communication between the subnet.
To sum up, the three-tier switch and routers there is a very big difference between the essential. In any way, in the LAN for multiple subnet connection, it is best to choose three layer switch, especially in different subnet data exchange frequent environment. On the one hand, it can ensure the communication performance requirement between subnets, on the other hand, save the investment of switch. Of course, if the communication between the subnets is not very frequent, the use of routers is understandable, but also to achieve the subnet security isolation and communication purposes. Specific to the actual needs of the three-tier switch to determine the most important goal is to speed up the large LAN internal data exchange, the routing function is also for this purpose service, can do one time routing, multiple forwarding. The regular process of packet forwarding is realized by hardware, while the functions such as routing information updating, routing table maintenance, routing calculation and routing determination are realized by software.
For security and management convenience, mainly in order to reduce the damage of the broadcast storm, the large LAN must be a function or geographical factors into a small local area network, which makes VLAN technology in the network to get a large number of applications, and the communication between different VLANs to be routed through the router to complete forwarding, With the increasing exchange of visits between the Internet. Only using routers to achieve access to the network, not only because the number of ports is limited, and the routing speed is slow. This limits the size of the network and the speed of access. Based on this situation, the three-tier switch is applied to life. The three-tier switch is designed for IP, the interface type is simple, has strong two-layer packet processing ability, it is very suitable for data routing and exchange in large LAN, it can work in the third layer of the Protocol or partially complete the function of traditional router, at the same time it has almost the speed of the second layer exchange, and the price is relatively cheap.
The most important purpose of the three-layer switch is to speed up the exchange of data within the large LAN, and the routing function is mostly spread around this purpose, so its routing function does not have the same grade of professional router strong. After all, there are still many deficiencies in security, protocol support and so on, and can not completely replace the work of the router.
A typical use in practice is the interconnection of each subnet in the same local area network and the routing between VLANs in the local area network, replacing routing with a three-tier switch. And only between the LAN and the public network interconnection to achieve the network access across the region, only through professional routers.
On the surface, the third layer switch is the second layer exchanger and the router, but this combination is not a simple physical combination, but the logical combination of the director. An important manifestation of this is that when the first data stream of an information source is exchanged for a third level, the routing system generates a map of the MAC address and IP address and stores the table, and when the subsequent data stream of the same information source enters the switching environment again, the switch will be based on the first generated and saved address mapping table, The network latency of routing is eliminated by transferring the source address directly from the second layer to the destination address and no longer being processed by the third routing system.

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: 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.