路由器与开关
Routers and switches are both networking devices, but they shouldn’t be mistaken to be the same as there is some difference between them. Let us have a look at those differences between a router and a switch in this article. Though both routers and switches are networking devices that are used to interconnect devices in computer networks, a router is more advanced and intelligent than a switch. A router works in the network layer and the switch works in the data link layer. A switch connects nodes of the same子网通过分析MAC地址。路由器分析IP地址and routes a packet to the correct destination through the proper gateway . Hence, routers are used for interconnecting networks rather than connecting nodes in a subnet. A router employs complex algorithms known as routing algorithms and hence needs more processing power making is costly. A switch uses a simple self-learning mechanism making it less costly than a router. An important thing to emphasize in the beginning is that here we refer to第2层开关when we say the term switch. In the present, there are devices known asLayer 3 switches这是路由器和2层开关的组合。
什么是开关?
开关是一种网络设备,可将计算机网络上的设备连接在一起,并适当地转发数据包。这在OSI参考模式的数据链路层中起作用,因此,它被称为第2层设备。与中继器集线器不同,开关不会广播数据包。相反,它确实将数据包切换到适当的端口的位置确实存储并转发。开关通过使用过去的数据包,将设备端口和MAC地址之间的映射自我映射,并将这些映射数据存储在被称为开关表的开关中的数据结构中。因此,当收到数据包时,交换机将数据包存储在交换机的内存中,分析其目标MAC地址,使用交换表查找正确的端口,然后将数据包转发到正确的端口。由于这种机制,开关允许在设备之间进行多个同时连接。开关是插头和播放设备,管理员必须只修复端口,而无需任何配置,开关将自动学习事物。
What is a Router?
路由器是一种网络设备,线路数据packets across a network. It works in the network layer of the OSI reference model, and hence, is a layer 3 device. A router also follows a store and forward mechanism, but a router is more intelligent than a switch. A router maintains a table called a routing table, which consists of the gateway IP through which a packet must be routed to reach a certain destination IP. The routing table can be statically set by the network administrator or can be auto generated using routing algorithms. When a router receives a packet, it first stores the packet in the router memory and analyses the destination IP address of the packet. Then, it lookup the routing table to see through which gateway the packet must be routed. Then, based on that information, it forwards the packet appropriately. As routing algorithms are more complex, it requires considerable processing power making it costly than a switch. However, unlike a switch , a router has to be usually configured by the administrator. A router is used to interconnect subnets rather than connecting nodes on a local area network.
路由器和开关之间有什么区别?
•路由器在网络层中工作时,开关在数据链路层中工作。因此,当路由器是第3层设备时,开关是第2层设备。
•路由器比开关更高级和智能。
• A router is more costly than a switch.
•路由器需要更多的处理能力来运行复杂的算法,而不是开关所需的内容。
• A switch reach decisions based on MAC addresses of packets while a router reach decisions based on IP addresses of packets.
• A switch has a table called switch table, which keeps mapping information of MAC address to the specific port it is connected. A router maintains a routing table, which keeps the gateway information to route packets to a certain destination IP.
• A switch occupies simple self-learning algorithms. A router uses complex algorithms called routing algorithms.
•开关是插件,管理员不必配置它们。但是,通常在部署之前和之后对路由器进行配置和编程。
•开关仅在局域网中使用。但是,路由器既用于局部网络和广域网络。
•开关通常用于将节点连接到同一子网中。另一方面,路由器用于在不同子网中互连网络。
概括:
路由器与开关
A switch works in the data link layer while a router works in the network layer. A switch interconnects devices in a subnet and it forwards the packets it receives to the correct port by analyzing the MAC address of packets. A router interconnects different networks together and it routes packets through the correct gateway by analyzing IP addresses of the packets. A router has more complex algorithms than switches hence they are more advanced and intelligent making them costly. Today, there are more advanced switches called Layer 3 switches, which is a layer 2 switch combined with the functionality of a router.
简而言之,开关用于将设备连接到网络。因此,要设置一个简单的家庭网络,开关是适当的设备。路由器用于将网络互连而不是连接设备。因此,仅当您建立一个由多个小型网络组成的庞大网络时,才有必要路由器。另外,如果您将家庭网络连接到WAN(例如Internet),则需要路由器。
马特says
谢谢!- 谢谢!你简化了我的生活。我只需要连接两台计算机:我的塔楼和笔记本电脑。所以我将使用我的开关。
再次感谢,
马特