The difference between routers and switches? And the role of the working principle of the router!

Reprinted   https://baijiahao.baidu.com/s?id=1596373286946216952&wfr=spider&for=pc

 

We continue to share the knowledge of the first monitoring network series, wrote two original front, introduces Ethernet and Ethernet switches, the switch forwards principle.

1, and Ethernet switch

2, the switch forwards principle

We are here purely knowledge-sharing, reading the article you probably know everything, but certainly not to take a professional examination, ha, because we ignore a lot of things to remember.

 

The last time we talk about network seven models, almost all of the network from the professional courses will require you to remember the name of each agreement and one that includes the beginning, but we only used where layer, look at this picture on it .

From low to high, it referred to as the bottom layer 1-4, 5-7 is called high-level, each responsible for its own work, and then spread on a layer of the instruction.

 

These preliminary work such as a first layer, a physical layer, by definition, is the physical connection layer, and we most weak security of the contact person, cable, optical fiber, network cards, etc. are the physical layer of the work.

 

A second layer, a data link layer, the data is synchronized, the specified MAC method. The most common device is to switch the link layer.

 

The third layer, the network layer, the specified address, to select the transfer path. Routers work at the network layer. The fourth layer 4-7, respectively, the transport layer, session layer, presentation layer, application layer.

 

Through the above network model, leads to the concept of the router.

A router (Router), a variety of different devices connected to the network, it automatically selected and set route, to the best path, the transmission signal sequence according to the situation before and after the press channel.

 

Router is the hub of the Internet, the current router has been widely used in various industries, various grades of products have become the main force to achieve interoperability of Internet services.

That switches and routers What difference does it make?

Both devices are connected to the Internet, the main difference between them is that the switch occurs at the data link layer of the second network, and the third layer occurs in the router network layer. This distinction is the fundamental difference between the respective work of the two. The router may find the IP address of the next device, TCPIP protocol can handle, and the one we have said switch is a MAC address for addressing.

 

Switches are data distribution network, the router can assign an IP address to the network address assigned to you and can come at any time by address to find you.

 

路由器可以在不同时间内把一个IP分配给多台主机使用。交换机是通过MAC地址和识别各个不同的主机。

 

路由器的工作原理是怎么样的呢?前面我们知道了交换机有MAC地址表,自动生成自动学习,同样的,路由器也有个路由表,会自己学习、生成、维护路由表。

 

我们举一个简单的例子,只要能看懂就可以了,不上图了:

 

1,主机A准备发数据给主机B。

 

2,A将B的IP地址连同数据一起,以数据包形式发送给路由器R1。

 

3,路由器R1收到数据包后,先从数据中读取到B的IP地址,然后根据路径表计算发往B的最优路径。

 

4,比如路径为:R1->R2->R5->B;并将数据包发往路由器R2。

 

5,路由器2重复路由器1的工作,并将数据包转发给路由器5。

 

6,路由器5同样取出目的地址,发现目的地址就在自己的网段上,于是将该数据包直接交给主机B。

 

7,主机B收到主机A的信息,一次完整的通信宣告结束。

Guess you like

Origin www.cnblogs.com/renjiaqi/p/11375013.html