路由要点

pno*_*ata 4 networking router routing

我是一名程序员,试图填补我对网络基础知识的理解中的一个大漏洞。我一直在读一本好书(Sosinki 的Networking Bible),但我发现其中包含很多“假设”信息,其中术语/概念在没有适当介绍的情况下向读者抛出。

我知道“路线”是通过网络的路径。但是我正在努力将一些基于路由的概念可视化。即:

  1. 路由实际上如何在硬件中体现出来?它们只是在网络层计算然后由传输执行的 IP 地址列表吗?
  2. 所谓的路由表中存在什么样的数据?路由表是否只是保存这些 IP 地址列表的机制(阅读上文)?
  3. 与动态路由相比,静态路由的性能优缺点是什么?

MaQ*_*eod 5

路由不是由任何一个硬件定义的。路由器的工作是查看 IP 并决定数据包是属于它的网络还是其他网络,然后根据它的决定沿途发送它。路由器实际上只关心下一步而不是过去,没有单个设备路由数据包的整个路径。

路由表包含路由器需要知道的信息,以确定一个数据包是否属于它自己的网络,以及如果它需要去其他地方发送它的下一跳。来自维基百科

The routing table consists of at least three information fields:

 -the network id: i.e. the destination network id
 -cost: i.e. the cost or metric of the path through which the packet is to be sent
 -next hop: The next hop, or gateway, is the address of the next station to which the packet is to be sent on the way to its final destination

 Depending on the application and implementation, it can also contain
 additional values that refine path selection:

 -quality of service associated with the route. For example, the U flag indicates that an IP route is up.
 -links to filtering criteria/access lists associated with the route
 -interface: such as eth0 for the first Ethernet card, eth1 for the second Ethernet card, etc.
Run Code Online (Sandbox Code Playgroud)

选择静态路由还是动态路由完全取决于应用程序。静态路由的容错性不是很强,但可能更容易解决某些网络问题,因为您的路由永远不会改变。