Hub, switch, router, working principle 1. A switch is also called a switch hub. It regenerates information and forwards it to a specified port after internal processing. It has the ability to automatically address and exchange information, the switch sends each information packet independently from the source port to the destination port based on the destination address of the information packet to avoid collision with other ports. A vswitch in the broad sense is a device that implements information exchange in a communication system. 2. How a vswitch works in a computer network system. A vswitch is developed to address the weakness of the shared working mode. A hub is represented by a shared working mode. If a hub is compared to a postman, the postman is an unliterate "dumb"-asking him to send a mail, he doesn't know how to send the mail to the recipient directly based on the address on the letter. Instead, he only delivers the mail to all the recipients, and then asks the recipient to determine whether the recipient is his own Based on the address information! The switch is a "smart" postman-the switch has a high-bandwidth back bus and an internal switching matrix. All the ports of the switch are attached to the back bus. When the control circuit receives the data packet, the processing port searches for the address table in the memory to determine the target MAC address (the hardware address of the NIC) the port on which the NIC is attached, and data packets are quickly transmitted to the destination port through the internal switching matrix. If the target MAC does not exist, the switch broadcasts all the ports. After receiving the port response, the switch "learns" the new address and adds it to the internal address table. It can be seen that when receiving a "letter" from a network card, the switch will quickly send the letter to the recipient based on the above address information and its "resident residence booklet. In case the recipient's address is not in the "user register", the switch will distribute the email to all people like a hub, and then find the recipient. After finding the receiver, the switch will immediately register the information of the receiver to the "user register", so that the mail can be delivered quickly when serving the customer. 3. vswitch performance characteristics 1) Exclusive bandwidth because the vswitch can intelligently send data to the destination based on the address information, it will not "Disturb" non-recipients when transmitting data like the hub. In this way, the switch can transmit data between multiple port groups at the same time. In addition, each port can be considered as an independent network segment, and both parties that communicate with each other enjoy all the bandwidth, without competing with other devices. For example, when host A sends data to host D, host B can send data to host C at the same time, the two transmissions all enjoy the bandwidth of the network. Assume that they use a 10 Mb switch, then the total traffic of the switch is 2*10 Mb = 20 Mb. 2) Full Duplex: When two ports on the switch are in communication, because the channels between them are relatively independent, they can implement full duplex communication. 1. through hubs or switches, we can build many computers into a large LAN, but when the number of machines reaches a certain number, the problem arises: for LAN composed of hubs, due to the use of the "broadcast" mode, when the network size is large, information in the transmission process of collision, congestion is becoming more and more serious, even if the switch, this situation also exists. Second, this lan is not secure and is not conducive to management. To solve these problems, people divide a large network into small subnets and CIDR blocks, or directly divide them into multiple VLANs (Virtual LAN ), in a VLAN, the information sent by a host can only be sent to other hosts with the same VLAN number. Other VLAN members cannot receive the information or broadcast frames. After VLAN division, it can effectively suppress broadcast storms on the network, increase network security, and centralize management and control. What if hosts in different VLANs need to communicate with each other in a LAN? At this time, you have to use a Router (Router, forwarder) to help. Vrouters can connect computers in different subnets, CIDR blocks, and VLANs to allow them to communicate freely. In addition, we all know that the current network has many types of structures, and the Protocols and speeds used by different networks are also different. When two networks of different structures need to be interconnected, they can also be achieved through routers. A router can connect two LAN segments with similar or different architectures to form a larger LAN or a wan. It can be seen that a router is a network device that connects multiple networks or CIDR blocks. It can translate data information between different networks, CIDR blocks, or VLANs ", so that they can "read" each other's data to form a larger network. 2. Router Working principle the so-called routing refers to the activity of moving information from the source location to the target location through the interconnected network. Then how does a router translate? When we are studying and translating English, we will certainly prepare an English-Chinese dictionary to implement the conversion between English and Chinese. For a router, it also has a path table, a dictionary for translation. The Routing Table stores data about various transmission paths, such as the subnet flag information, the number of online routers, and the name of the next router. The path table can be set by the system administrator or dynamically modified by the system. It can be automatically adjusted by the router or controlled by the host. Different subnets and CIDR blocks can be connected through routers. Therefore, different routers and hubs and vswitches are generally installed in the "backbone" Area of the network, rather than working in the Grass-roots layer as hubs and vswitches. For example, a large-scale enterprise LAN generally divides the entire network into multiple VLANs based on management, security, and performance considerations. As a result, when a VLAN communicates with a VLAN, you must use a vro. For this enterprise network, it must be connected to the Internet. For enterprises, they generally use ddnleased lines of China Telecom or use ADSL, Cable, and ISDN to connect the enterprise network to the Internet, at this time, because of the different network systems and protocols used, routers are also required to interconnect the enterprise network with the Internet. Click to zoom in. Generally, information passes through at least one or more intermediate nodes during the routing process. In general, people will compare routing and switching, mainly because the functions of the two are the same in the eyes of common users. In fact, the main difference between routing and switching is that switching occurs at the Layer 2 (data link layer) of the OSI reference model, while routing occurs at the Layer 3 (Network Layer. This difference determines that different control information needs to be used in the process of routing and exchange of mobile information. Therefore, the two methods to implement their respective functions are different. The router determines data forwarding through routing. The forwarding policy is called route selection, which is also the origin of the router name. The appearance of the three muskeys is compared with that of the hubs, switches, and routers. However, for many beginners, they sometimes want to differentiate their appearances. Of course, the appearance of hubs, switches, and routers must be different, but these are often used as reference information. After all, many hubs, switches, and router products are very similar in appearance. What is the most difficult to distinguish between hubs and switches on a common table is that routers are relatively easy to identify. Switching between a vswitch and a vro is the most frequently used word in the network today. It can be applied in any situation from a bridge to an ATM to a telephone system, it is hard to figure out what is the real exchange. In fact, the word exchange first appeared in the telephone system, specifically to achieve the exchange of voice signals between two different telephones, the device to complete this work is the telephone switch. Therefore, in terms of intention, exchange is only a technical concept, that is, to complete the forwarding of signals from the device entry to the exit. Therefore, any device that complies with this definition can be called an exchange device. It can be seen that "Exchange" is a widely used term. When it is used to describe the second layer of the data network, it actually refers to a bridge device; when it is used to describe the third-layer device of the data network, it also refers to a routing device. We often mention that an Ethernet switch is actually a multi-port L2 network device based on the bridge technology, it provides low-latency and Low-overhead channels for data frame forwarding from one port to another. It can be seen that the core of the switch should have an exchange matrix to provide a channel for communication between any two ports, or a fast exchange bus, to send data frames received by any port from other ports. In actual devices, the function of the switching matrix is usually completed by a dedicated chip (ASIC. In addition, there is an important assumption in the design philosophy of the Ethernet switch, that is, the speed of the switching core is very fast, so that the normal large-volume data will not cause congestion. In other words, the exchange capability is infinite relative to the amount of information transmitted (on the contrary, the design idea of the ATM switch is that the exchange capability is limited to the amount of information transmitted ). Although the second layer Ethernet switch is developed based on a multi-port bridge, after all, the switch has more features, making it the best way to get more bandwidth, it also makes the network easier to manage. A router is a group exchange device (or network layer Relay Device) in the network layer of the OSI protocol model. The basic function of a router is to transmit data (IP packets) to the correct network, including: 1. forward IP datagram, including path finding and transmission of the datagram; 2. subnet isolation to prevent broadcast storms; 3. maintain the route table and exchange route information with other routers. This is the basis for IP packet forwarding. 4. IP datagram error handling and simple congestion control; 5. Filtering and accounting of IP datagram. Vrouters of different regions have different roles. On the backbone network, the main role of a router is routing selection. The router on the backbone network must know the path to all the lower-Layer Networks. This requires maintaining a large route table and responding to connection status changes as quickly as possible. A Router failure may cause serious information transmission problems. In the regional network, the main role of the router is network connection and route selection, that is, to connect to the lower-layer grass-roots network units-the campus network, while responsible for data forwarding between the lower-Layer Networks. Inside the campus network, the main role of a router is to separate subnets. In the early days, the basic unit of the Internet connection was LAN, where all hosts were in the same logical network. With the continuous expansion of the network scale, the LAN has evolved into a campus network composed of multiple subnets connected to the high-speed trunk and router. The subnet is logically independent, and the router is the only device that can separate them. It is responsible for packet forwarding and broadcast isolation between subnets, the vro on the border is responsible for connecting to the upper-layer network. 3. Differences between L2 switches and routers traditional switches are developed from bridges and belong to the OSI L2 data link layer device. It selects routes from the station table based on MAC address addressing. The establishment and maintenance of the station table is automatically implemented by the switch. A router is a layer-3 network-layer device of OSI. It is addressing based on IP addresses and is generated through the route table routing protocol. The biggest advantage of a vswitch is that it is fast. Because the vswitch only needs to identify the MAC address in the frame, the selection of forwarding Port Based on the MAC address is simple, Which is easy for ASIC implementation. Therefore, the forwarding speed is extremely high. However, the working mechanism of vswitches also brings about some problems. 1. Loop: Based on the vswitch address learning algorithm and the station table, no loop is allowed between vswitches. Once a loop exists, the Spanning Tree Algorithm must be enabled to block the ports that generate the loop. The router routing protocol does not solve this problem. There are multiple channels between routers to balance the load and improve reliability. 2. Load aggregation: only one channel is available between switches, so that information is concentrated on one communication link and cannot be dynamically allocated to balance the load. The router routing protocol algorithm can avoid this. The OSPF routing protocol algorithm can not only generate multiple routes, but also select different optimal routes for different network applications. 3. Broadcast control: A vswitch can only narrow down the conflicted domain, but not the broadcast domain. The entire exchange network is a large broadcast domain, where broadcast packets are scattered across the entire exchange network. Vrouters can isolate broadcast domains, and broadcast packets cannot be broadcast through vrouters. 4. subnet division: The switch can only recognize MAC addresses. The MAC address is a physical address and uses a flat address structure. Therefore, you cannot divide subnets Based on the MAC address. Vro identifies IP addresses. IP addresses are allocated by network administrators. They are logical addresses and IP addresses have hierarchies. They are divided into network numbers and host numbers, which can be easily used to divide subnets, the main function of a vro is to connect to different networks. 5. confidentiality: although the switch can also filter Frames Based on the source MAC address, target MAC address, and other frames, however, the vro filters packets based on the source IP address, destination IP address, and TCP port address of the packets, making them more intuitive and convenient. 6. media-related: A switch can also be used as a bridge device to convert between the link layer and the physical layer. However, this conversion process is complicated and is not suitable for ASIC implementation. This will inevitably reduce the forwarding speed of the switch. Therefore, currently, vswitches primarily Interconnect Networks with the same or similar physical media and link protocols, instead of connecting networks with different physical media and link layer protocols. Different routers are used for interconnection between different networks, so they can connect networks with different physical media, link layer protocols, and network layer protocols. Although a vro has a functional advantage, it is expensive and has a low packet forwarding speed. In recent years, vswitches have made many improvements to improve performance. The most prominent improvement is the virtual network and layer-3 switching. Dividing subnets can narrow the broadcast domain and reduce the impact of broadcast storms on the network. Each vro interface is connected to a subnet. broadcast packets cannot be broadcast by the vro. The subnets connected to different vro interfaces belong to different subnets. The subnet ranges are physically divided by the vro. For a vswitch, each port corresponds to a CIDR block. Because the subnet consists of several CIDR blocks, you can logically divide subnets by combining vswitch ports. Broadcast packets can only be broadcast within the subnet and cannot be spread to another subnet. By rationally dividing the logical subnet, broadcast can be controlled. Because logical subnets are composed of vswitch ports and have no physical correlation, they are called virtual subnets or virtual networks. The virtual network technology eliminates the need for routers to isolate broadcast packets, and the virtual network INTRANET segment has nothing to do with its physical location, that is, the adjacent network segment can belong to different virtual networks, however, the two CIDR blocks that are far from each other may belong to different virtual networks, while the two CIDR blocks that are far from each other may belong to the same virtual network. Terminals in different virtual networks cannot communicate with each other, enhancing access control over network data. Vswitches and vrouters are the contradiction between performance and functions. The switch exchange speed is fast, but the control function is weak, the vro control performance is strong, but the packet forwarding speed is slow. The latest technology to resolve this conflict is layer-3 switching, which provides both the ability to forward packets at the wire speed of the switch and the good control function of the router. 4 The differences between layer-3 vswitches and vrouters before the emergence of layer-3 switching technology, there is almost no need to distinguish between the routing feature devices and vrouters. They are exactly the same: the router is working to provide the routing function. However, the layer-3 switch can fully perform most of the functions of the traditional router. As a device for network interconnection, layer-3 switches have the following features: 1. forward the business flow based on the layer-3 address; 2. full switch function; 3. special services such as packet filtering or authentication can be completed; 4. execute or do not execute route processing. Layer-3 vswitches have the following advantages over traditional vrouters: 1. the transmission bandwidth between subnets can be arbitrarily allocated: each interface of a traditional router connects to a subnet, and the transmission rate of the subnet through the router is limited by the bandwidth of the interface. The layer-3 switch is different. It can define multiple ports as a virtual network and use a virtual network composed of multiple ports as a virtual network interface, the information in the virtual network can be sent to the layer-3 Switch through the port that forms the virtual network. The number of ports can be specified arbitrarily, so there is no limit on the inter-subnet transmission bandwidth. 2. reasonable configuration of Information Resources: As there is no difference between the resource rate in the subnet access and the resource rate in the global network access, it is of little significance to set a separate server in the subnet. Setting a server group in the global network not only saves money, more reasonable configuration of information resources. 3. Cost Reduction: Generally, vswitches are used to form subnets and vrouters are used to interconnect subnets. Currently, a three-tier switch is used for network design. It can be divided into any virtual subnet, and inter-subnet communication can be completed through the three-tier routing function of the switch, which saves the cost of a router. 4. Flexible Connections between vswitches: As vswitches, no loops are allowed between them. As vrouters, there are multiple channels to improve reliability and balance load. Layer-3 switches use the Spanning Tree Algorithm to block the loop port. However, when selecting a route, the blocked path is still used as an optional path for route selection. Conclusion: To sum up, the switch is generally used for the LAN-WAN connection, the switch belongs to the bridge, is the data link layer equipment, some switches can also achieve the third layer of the exchange. A vro is used for WAN-WAN connections. It can resolve forwarding groups between different networks and act on the network layer. They only accept the input group from one line and then forward it to another line. These two lines may belong to different networks and adopt different protocols. In comparison, vro features more powerful than vswitches, but the speed is relatively slow and expensive. layer-3 vswitches have both the ability to forward packets at the wire speed of vswitches and the good control function of vrouters, broadcast applications