Generally speaking, the main differences between routers and switches are as follows:
(1) Different working levels
The original switch works in the data link layer of OSI/RM open architecture, that is, the second layer, while the router is designed to work in the network layer of OSI model from the beginning. Because the switch works in the second layer (data link layer) of OSI, its working principle is relatively simple, while the router works in the third layer (network layer) of OSI, which can obtain more protocol information and make more intelligent forwarding decisions.
(2) Data forwarding is based on different objects.
Switches use physical addresses or MAC addresses to determine the destination address for forwarding data. Routers use the ID numbers (IP addresses) of different networks to determine the address of data forwarding. The IP address is implemented in software and describes 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 assigned by the hardware itself and the network card manufacturer, and has been solidified into the network card, which is generally unchangeable. The IP address is usually automatically assigned by the network administrator or the system.
(3) The traditional switch can only divide the collision domain, but not the broadcast domain; Routers can split broadcast domains.
The network segments connected by the switch still belong to the same broadcast domain, and broadcast packets will spread on all network segments connected by the switch, which will lead to communication congestion and security loopholes in some cases. The network segments connected to the router will be assigned to different broadcast domains, and the broadcast data will not pass through the router. Switches with more than three layers can be divided into broadcast domains although they have VLAN function, but there is no communication between sub-broadcast domains, and routers are still needed for communication between them.
(4) Routers provide firewall services.
Routers only forward packets with specific addresses, and do not forward packets that do not support routing protocols and packets of unknown target networks, thus preventing broadcast storms.
Switches are usually used for LAN-WAN connections. Switches belong to bridges and are data link layer devices. Some switches can also implement Layer 3 switching. Routers are used to connect between wide area networks, which can solve the problem of forwarding packets between heterogeneous networks and act on the network layer. They just accept incoming packets from one line and forward them to another. These two lines may belong to different networks and adopt different protocols. Comparatively speaking, routers are more powerful than switches, but they are relatively slow and expensive. Layer 3 switches are widely used because they have both the line speed forwarding ability of switches and the good control function of routers.
At present, the personal broadband access mode is ADSL, so the author will briefly explain ADSL access. Most of the ADSL cats purchased now have routing function (in many cases, manufacturers blocked the routing function when they left the factory, because most of the telecom installations did not enable the routing function, but enabled DHCP. Open the routing function of ADSL), if individuals surf the Internet or several computers pass through ADSL itself, if there are many computers, they only need to buy one or more hubs or switches. Considering that the difference between hub and switch is very small now, it is not a special reason, please buy switch. There is no need to pursue high prices, because the homogenization of products is very serious now, and there is no problem with my cheapest switch now. I'll give you a reference quotation. I suggest you buy an 8-mouth one to meet the expansion demand. The general price is around 100 yuan. Connect the switch to which all computers will be connected. What remains to be done is to plug the network cable of each machine into the interface of the switch and plug the network cable of the cat into the uplink interface. Then set the routing function, DHCP, etc. , you can enjoy the internet.