The comparison between a layer-3 Switch and a router is in a large LAN. This function is perfect and helpful for understanding the layer-3 Switch. However, some manufacturers' switches can also directly connect to the Internet to provide the router function.
Comparison Between Layer-3 vswitches and vrouters
In order to adapt to the challenges brought by the deepening of network applications, the scale and speed of the network are rapidly developing. The speed of the LAN has increased from 10 Mbit/s to 100 Mbit/s, currently, Gigabit Ethernet technology is widely used.
In terms of network structure, it has also evolved from the LAN of shared media to the current LAN. The exchange LAN technology enables dedicated bandwidth to be exclusive to users, greatly improving the efficiency of LAN transmission. It can be said that in the network system integration technology, the first-layer interface and the second-layer exchange technology that are directly oriented to users have obtained satisfactory answers. However, as the core of the network, the router technology that acts as the interconnection between networks has no qualitative breakthrough. In this case, a new routing technology came into being. This is the layer-3 switching technology: it is a router because it can operate on the layer-3 of the network protocol, it is a type of routing that understands a device and can act as a route decision. It is a switch because it is extremely fast and almost achieves the second-layer switching speed. Who are the advantages and disadvantages of Layer 2 vswitches, Layer 3 vswitches, and vrouters? To answer this question, let's start with the working principles of these three technologies:
1. layer-2 Exchange Technology
A layer-2 switch is a device at the data link layer. It can read the MAC address information in the data packet and exchange it based on the MAC address.
There is an address table inside the vswitch, which indicates the relationship between the MAC address and the vswitch port. When a vswitch receives a packet from a port, it first reads the source MAC address from the packet header, which knows the port on which the machine with the source MAC address is connected, it then reads the destination MAC address in the packet header and finds the corresponding port in the address table. If there is a port corresponding to the destination MAC address in the table, the packet is copied directly to the port, 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.
The second-layer switch creates and maintains its own address table. Because L2 switches generally have a wide switching bus bandwidth, they can exchange data for many ports at the same time. If a L2 Switch has N ports, and the bandwidth of each port is M, and the bus bandwidth of the switch exceeds N × M, the switch can achieve line rate switching. The L2 Switch does not limit the broadcast packets. It copies the broadcast packets to all ports.
Layer-2 switches generally contain Application specific Integrated Circuit chips used to process data packet forwarding, so the forwarding speed can be very fast.
2. Routing Technology
A Router operates at the network layer, the third layer in the OSI Layer-7 network model.
There is a route table inside the router, which indicates where to go if you want to go somewhere. The router receives a packet from a port. It first removes the packet header of The Link Layer (unpacks), reads the IP address of the destination, and searches for the route table. If you can determine where to send the next packet, the packet header (Package) at the link layer is added to forward the packet. If the next address cannot be determined, a message is returned to the source address and the packet is discarded.
The routing technology and layer-2 switching seem a bit similar. In fact, the main difference between routing and switching is that switching occurs on the layer-2 (data link layer) of the OSI reference model, while routing occurs on the layer-3. This difference determines that different control information needs to be used for routing and exchange during data transmission. Therefore, the two methods to implement their respective functions are different.
The routing technology is actually composed of two basic activities, that is, determining the optimal path and transmitting data packets. Among them, data packet transmission is relatively simple and direct, while the route determination is more complex. The routing algorithm writes different information into the routing table. The router selects the optimal path based on the destination to which the data packet arrives and sends the data packet to the next vro that can reach the destination. When a router receives the packet, it will also view its target address and use the appropriate path to continue transmission to the subsequent router. And so on until the data packet reaches the final destination.
Vrouters can communicate with each other and maintain their route tables by transmitting different types of information. The route update information is generally composed of some or all route tables. By analyzing the route update information sent by other routers, the router can master the topology of the entire network. Link Status broadcast is another type of information transmitted between routers. It can send the link status and incoming notifications of information senders to other routers.
3. layer-3 Switching Technology
A device with layer-3 switching is a layer-2 switch with layer-3 routing, but it is an organic combination of the two, it is not simply to overlay the hardware and software of the router device on the LAN switch.
From the hardware point of view, the interface modules of the second layer switch exchange data through the High-Speed Backplane/bus (the speed can be dozens of Gbit/s). In the third layer switch, the router-related layer-3 router hardware module is also inserted on the high-speed backplane/bus, which enables the routing module to exchange data with other modules that require routing at high speed, this breaks through the speed limit of the traditional external router interface. On the software side, layer-3 switches also have major initiatives, which define the traditional software-based router software.
The practice is:
For packet forwarding, such as IP/IPX packet forwarding, these regular processes are implemented through hardware at a high speed.
For layer-3 routing software, such as route information update, route table maintenance, route calculation, and route determination, Use optimized and efficient software.
Assume that two machines that use the IP protocol communicate with each other through the layer-3 Switch. Machine A knows the destination IP address when sending the message, but does not know the MAC address required to send the message on the LAN. IP Address Resolution (ARP) is used to determine the target MAC address. Machine A compares its IP address with the target IP address, extracts the network address from the subnet mask configured in its software, and determines whether the target machine is in the same subnet as itself. If the destination machine B and machine A are in the same subnet, A broadcasts an ARP request, and B returns its MAC address. After A obtains the MAC address of the destination machine B, it caches the address, use this MAC address to package and forward the data. The second layer switch module looks for the MAC address table and determines to send the data packet to the destination port. If two machines are not in the same subnet, if machine A needs to communicate with machine C, machine A must send an ARP packet to the "Default Gateway, the IP address of the "Default Gateway" has been set in the system software. This IP address actually corresponds to the layer-3 Switch module of the layer-3 switch. Therefore, when sending an ARP request to the IP address of the "Default Gateway" from machine A, if the layer-3 Switch module obtains the MAC address of the target machine C during the previous communication, send the MAC address of C to machine A. Otherwise, the layer-3 Switch module broadcasts an ARP request to the target machine based on the routing information, the target machine C receives the ARP request and replies to its MAC address to the layer-3 Switch module. The layer-3 Switch module saves the address and sends it back to the machine. later, when data packets are forwarded between A and C, they are encapsulated with the MAC address of the destination machine. The data forwarding process is all forwarded to the second layer for exchange, enabling high-speed information exchange. The so-called one-time routing and multiple exchanges.
Layer-3 switching has the following outstanding features:
The combination of organic hardware accelerates data exchange;
The optimized routing software improves the routing efficiency;
In addition to the necessary route decision processes, most data forwarding processes are processed by Layer 2 exchange;
When multiple subnets are connected, they are only logically connected to the layer-3 Switching Module. Unlike traditional external routers, ports need to be added to protect users' investment.
4. Comparison of the three technologies
It can be seen that L2 switches are mainly used in small LAN, and the number of machines is less than two or thirty. In such a network environment, broadcast packets have little impact, the Quick Switch Feature of L2 switches, multiple access ports, and low prices provide a perfect solution for small network users. In such a small network, there is no need to introduce the routing function to increase the management difficulty and cost, so there is no need to use a router, of course, there is no need to use a layer-3 switch.
A layer-3 switch is designed for IP addresses. The interface type is simple and has a strong layer-2 packet processing capability. Therefore, it is suitable for large lan. To reduce the risk of broadcast storms, A large lan must be divided into one small LAN based on functions or regions, that is, one small network segment. This will inevitably lead to a large number of mutual access between different network segments, the use of layer-2 Switching Machines alone cannot achieve mutual access between networks, but simply using routers, because the number of ports is limited, the routing speed is slow, and the network size and access speed are limited, therefore, in this environment, a layer-3 switch that combines L2 switching technology and routing technology is the most suitable.
Vro has many port types, supports many layer-3 protocols, and has strong routing capabilities. Therefore, vro is suitable for interconnection between large networks. Although there are no fewer layer-3 switches or even layer-2 switches, there are interconnection ports of heterogeneous networks, however, generally, there are not many interconnect ports in a large network. The main function of the interconnect device is not to quickly exchange ports, but to select the best path for load balancing, link backup and the most important routing information exchange with other networks, all of which are completed by routing.
In this case, it is naturally impossible to use a L2 Switch, but whether or not a l3 switch is used depends on the actual situation. The main factors are network traffic, response speed requirements, and investment budget. The most important purpose of a layer-3 switch is to speed up data exchange within a large lan. The Integrated routing function also serves this purpose. Therefore, its routing function is not as powerful as a professional router of the same level. When the network traffic is high, if a layer-3 Switch performs both switching between networks and routing between networks, the load on the switch will be greatly increased and the response speed will be affected. When the network traffic is large but the response speed is high, the layer-3 Switch performs Intranet switching. The router is responsible for inter-network routing, in this way, we can make full use of the advantages of different devices. Of course, if the investment budget is limited, it is also a good choice to connect networks with layer-3 switches.