What is the difference between a switch and a router

Source: https://www.cnblogs.com/Lynn-Zhang/articles/5754336.html
Comments:
The difference between a switch and a router:

1. The router can automatically assign IP to your local area network, virtual dial, just like a traffic policeman, Directing your computer where to go, you don't have to worry so much yourself. Switches are only used to distribute network data.

2. The router is at the network layer. The router is addressed according to the IP address. The router can handle the TCP/IP protocol, but the switch cannot.

3. The switch is at the relay layer, and the switch is addressed according to the MAC address. A router can assign one IP to many hosts, and these hosts only show one IP to the outside world. A switch can connect many hosts, each of which has its own IP address to the outside world.

4. The router provides the service of the firewall, and the switch cannot provide this function. Hubs and switches are used for port expansion, that is, to expand the access point of the local area network (usually Ethernet), that is, to allow more computers to be connected to the local area network. Routers are used to connect between networks, that is, to connect different networks.

The switch uses the physical address or MAC address to determine the destination address for forwarding data. The router uses the ID numbers (ie IP addresses) of different networks to determine the address for data forwarding. IP addresses are implemented in software and describe the network where the device is located. Sometimes these Layer 3 addresses are also called protocol addresses or network addresses. The MAC address is usually provided by the hardware, assigned by the network card manufacturer, and has been solidified into the network card. Generally speaking, it cannot be changed. The IP address is usually assigned automatically by the network administrator or the system.



The first difference between a router and a switch is that the switch is a network cable to access the Internet, but everyone dials up separately to access the Internet, and each uses its own broadband, so it does not affect everyone's Internet access. The router has one more virtual dial-up function than the switch. The computers that access the Internet through the same router share a broadband account, and everyone needs to influence each other when they access the Internet.
The second difference between a router and a switch: the switch works at the relay layer, and the switch is addressed according to the MAC address. Routers work at the network layer, and based on IP address addressing, routers can handle TCP/IP protocols, but switches cannot.

The difference between a router and a switch is three: a switch can make multiple computers connected to it form a local area network. If there is a proxy server, it can also achieve simultaneous Internet access and all computers in the local area network share its bandwidth rate, but the switch does not automatically recognize the router. Functions for sending and arriving addresses of packets. The router can automatically identify the addresses to which data packets are sent and arrived. The router is equivalent to the police on the road, responsible for traffic guidance and directions.

The difference between a router and a switch 4: To give a few examples, a router is a small post office, with only one address (IP), responsible for sending and receiving in one place (personal computer, a certain server, so your home Internet needs this thing), the switch is a provincial The big postal center is responsible for linking various small places from one address. Simply put, the router is only responsible for accessing the network, the switch is only responsible for distribution, the routing is to find a way for you to get online, the switch is only responsible for opening the door, and you cannot access the Internet without a route on the switch.

Five differences between routers and switches: routers provide firewall services. The router only forwards data packets with specific addresses, and does not transmit data packets that do not support routing protocols and unknown destination network data packets, thereby preventing broadcast storms.



The difference between a Layer 3 switch and a router

  Although they both have routing functions.

  However, the main function of the Layer 3 switch is still data exchange. Its routing function is usually relatively simple, because it mainly faces simple LAN connections, and the routing path is far less complicated than that of routers. Its main purpose in LAN is Provide fast data exchange function to meet the application characteristics of frequent data exchange in the local area network.

  The main function of the router is the routing function, and its routing function is more reflected in the interconnection between different types of networks, such as the connection between the local area network and the wide area network, the connection between the networks of different protocols, etc., so the router is mainly used. between different types of networks. Its main function is routing and forwarding. Solving the connection of various complex routing path networks is its ultimate goal. Therefore, the routing function of routers is usually very powerful, not only suitable for LANs with the same protocol, but also for different protocols. between LAN and WAN. Its advantage lies in the functions of routers such as selecting the best route, load sharing, link backup, and exchanging routing information with other networks. In order to connect with various types of networks, routers have very rich interface types, while Layer 3 switches generally only have the same type of LAN interface, which is very simple.

  Technically speaking, routers and Layer 3 switches have distinct differences in the operation of packet switching. Routers typically perform packet switching by microprocessor-based software routing engines, while Layer 3 switches perform packet switching by hardware. After the Layer 3 switch routes the first data flow, it will generate a mapping table between MAC addresses and IP addresses. When the same data flow passes through again, it will directly pass through Layer 2 according to this table instead of routing again. , thereby eliminating the network delay caused by the router's routing selection, and improving the efficiency of data packet forwarding. At the same time, the route lookup of the Layer 3 switch is aimed at the data flow. It uses the cache technology and can be easily realized by the ASIC technology. Therefore, the cost can be greatly reduced and fast forwarding can be achieved. The forwarding of the router adopts the longest matching method, which is complicated to implement and usually implemented by software, and the forwarding efficiency is low.

  Because of this, in terms of overall performance, the performance of the three-layer switch is much better than that of the router, which is very suitable for the local area network with frequent data exchange; although the router has a very powerful routing function, its packet forwarding efficiency is much lower than that of the router. Layer 3 switches are more suitable for the interconnection of different types of networks where data exchange is not very frequent, such as the interconnection of local area networks and the Internet. If routers, especially high-end routers, are used in local area networks, it is a waste to a large extent (in terms of its powerful routing function), and it cannot well meet the communication performance requirements of local area networks, affecting the inter-subnet communication performance. normal communication

  To sum up, it is better to use a Layer 3 switch for multi-subnet connection in a local area network, especially in an environment where data exchanges between different subnets are frequent. On the one hand, it can ensure the communication performance requirements between subnets, and on the other hand, it saves the investment of purchasing additional switches. Of course, if the communication between subnets is not very frequent, it is understandable to use a router, which can also achieve the purpose of safe isolation of subnets and mutual communication. It depends on the actual needs.

  The biggest difference between Layer 3 switching and routing is that routing supports NAT conversion, while Layer 3 does not. It is reflected in the actual project: directly connecting the optical fiber to the router can access the Internet, but connecting the optical fiber to the layer three equipment cannot access the Internet. Each port on the third layer has a dedicated mac address and a dedicated ASIC integrated circuit.



The difference between a

  network switch and a router A network switch is a device that expands the network and can provide more connection ports in the subnet to connect more computers. With the development of the communication industry and the advancement of the informatization of the national economy, the network switch market has shown a steady upward trend. It has the characteristics of high cost performance, high flexibility, relative simplicity, and easy implementation. Therefore, Ethernet technology has become the most important LAN networking technology today, and network switches have become the most popular switches.

  A router is a device that connects various local area networks and wide area networks in the Internet. It will automatically select and set routes according to the channel conditions, and send signals in the order of the best path. The router is the hub of the Internet, the "traffic cop". At present, routers have been widely used in all walks of life, and various products of different grades have become the main force for realizing the internal connection of various backbone networks, the interconnection between backbone networks, and the interconnection between backbone networks and the Internet. The main difference between routing and switching is that switching occurs at layer 2 (the data link layer) of the OSI reference model, while routing occurs at layer 3, the network layer. This difference determines that routers and switches need to use different control information in the process of moving information, so the way they implement their respective functions is different.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326174941&siteId=291194637