2012-11-03 63 views
1

任何人都可以从基础知识中解释距离矢量路由算法吗? 我从过去的几个小时一直在搜索整个互联网上的资料,但是没有一个地方是以初学者可以理解的方式解释它。要么用非常小的例子来解释它(尝试将算法应用于不同的例子看起来非常困难),要么非常模糊地解释它。 如果可能,请用一个“好”的例子来解释。 PS:在理解路由器交换信息的时间和顺序时,我有一个非常大的问题。我必须为这个算法实现一个C或C++程序。所以我想完全理解它。 在此先感谢。距离矢量路由算法

+0

您是否检查过: - http://cseweb.ucsd.edu/classes/fa10/cse123/lectures/123-fa10-l13.pdf –

+0

是的,该文件解释得很好,但不是很“清楚”。我读了3次以上。还有很多东西都不见了。 – jsp99

+0

你能告诉一下它缺失的东西吗?我的意思是你想了解什么? –

回答

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) 

当前矢量将是每个目标的最小距离加1。

上面的伪代码实现水平分割逆向毒化,但不触发更新


了解更多: