Now network products are becoming common in ordinary households, and the line between routers and switches is increasingly blurred — switches with routing functions are also very common. So what exactly is the difference between a router and a switch? A router is the main node device of the Internet. A router decides data forwarding through routing. The forwarding policy is called routing, which is also the origin of the name router (router, forwarder). As the hub connecting different networks, the router system forms the main backbone of the TCP/IP-based international internetwork — the Internet — and one could say routers form the skeleton of the Internet. Its processing speed is one of the main bottlenecks of network communication, and its reliability directly affects the quality of network interconnection. A switch, on the other hand, is a network device based on MAC address recognition that can complete the encapsulation and forwarding of data packets. A switch can “learn” MAC addresses and store them in an internal address table, establishing a temporary switching path between the originator and the target receiver of a data frame, so the data frame travels directly from the source address to the destination address. The main differences are as follows: 1. Different working layers 1) The physical layer (commonly known as the first layer, L1) relay system, i.e. the repeater. 2) The data link layer (the second layer, L2), i.e. the bridge or bridging device. 3) The network layer (the third layer, L3) relay system, i.e. the router. 4) A mixture of bridge and router — the brouter — has both bridge and router functions. 5) A relay system above the network layer, i.e. the gateway. The earliest switches worked at the data link layer of the OSI/RM open architecture, that is, the second layer, while routers were designed from the start to work at the network layer of the OSI model. Because switches work at the second layer (data link layer) of OSI, their working principle is relatively simple, while routers work at the third layer (network layer) of OSI and can obtain more protocol information, allowing routers to make more intelligent forwarding decisions. 2. Different bases for forwarding rules A switch uses the physical address, or MAC address, to determine the destination address for forwarding data. A router uses the IP addresses of different networks to determine the address for data forwarding. IP addresses are implemented in software and describe the network the device is on; sometimes these third-layer addresses are also called protocol addresses or network addresses. MAC addresses usually come with the hardware, assigned by the NIC manufacturer, and are already burned into the NIC, generally unchangeable. IP addresses are usually assigned by the network administrator or automatically by the system. 3. Traditional switches can only segment collision domains, not broadcast domains; routers can segment broadcast domains The segments connected by a switch still belong to the same broadcast domain, and broadcast packets will propagate across all segments connected by the switch, which in some cases leads to communication congestion and security holes. The segments connected to a router are assigned to different broadcast domains, and broadcast data will not pass through the router. Although switches above the third layer have VLAN functionality and can also segment broadcast domains, the sub-broadcast-domains cannot communicate with each other — communication between them still requires a router. 4. Routers can provide firewall services, while switches cannot A router only forwards packets to specific addresses, and does not transmit packets that don’t support routing protocols or packets to unknown destination networks, thus preventing broadcast storms. Conclusion: Switches are generally used for LAN-WAN connections; switches belong to bridges and are data link layer devices, though some switches can also implement third-layer switching. Routers are used for WAN-WAN connections and can solve packet forwarding between heterogeneous networks, acting at the network layer. They simply accept an incoming packet from one line and forward it to another. These two lines may belong to different networks and use different protocols. Comparatively, a router’s functions are more powerful than a switch’s, but its speed is relatively slower and it is expensive. The third-layer switch has both the wire-speed packet forwarding capability of a switch and the good control functions of a router, so it has been widely adopted.

Related Posts
Recommended readingUncategorized
Notes on Building OpenWRT (LEDE) Yourself
Uncategorized
How to Choose Ethernet Cables for Home Wiring and Daily Use — What Are Cat5e, Cat6, and Cat6a? Picking Cable for 100M/1G/10G Networks
Uncategorized
Xiaomi Router or Xiaomi Router mini — Which to Choose?
Uncategorized
Ethernet Cable and RJ45 Connector Making Tutorial
Uncategorized
How to Install a Wireless Router
Uncategorized