2

任何人都可以从基础解释距离矢量路由算法吗?过去几个小时以来,我一直在互联网上搜索材料,但没有任何地方以初学者可以理解的方式进行解释。要么用非常小的例子来解释(试图将算法应用于不同的例子似乎非常困难),要么解释得非常模糊。如果可能的话,请用一个“好”的例子来解释。

PS:我在理解路由器交换信息的确切时间和顺序方面存在很大的问题。我必须为此算法实现一个 C 或 C++ 程序。所以我试图完全理解它。提前致谢 。

4

1 回答 1

4
Start with distance-vector:
    0 for self,
    D for neighbor at distance D.

Every 30 seconds,
    For each neighbor,
        Send the current distance vector, with entries that pass trough
            that neighbor set to 16.

When receiving a distance-vector from a neighbor,
    Save the received distance vector.
    If any estimated distance, trough this neighbor, has changed,
        Update the current vector, but cap at 16.

When 180 seconds has passed since the last message from some neighbor,
    Set it's distance to 16.
    Send the updated distance vector as above.

180 秒是标准超时值。16 的距离被认为是无穷大。

由于节点不会立即知道网络中的每个其他节点,因此它不能立即添加所有列。最简单的方法是使用表格:

(Neighbor, Destination, Distance)

当前向量将是每个目的地的最小距离加一。

上面的伪代码实现了水平分割中毒反向,但没有触发更新


阅读更多:

于 2012-11-04T12:40:21.757 回答