"RIP" protocol (principle + example)

1. Introduction to RIP

1、RIP

RIP (Routing Information Protocol) is the first widely used protocol in the interior gateway protocol IGP. Its Chinese name is called routing information protocol, but it is rarely used. RIP is a distributed 基于距离向量的路由选择协议, standard protocol of the Internet, and its greatest advantage is simplicity.

2. Distance (distance vector) explanation

The distance from a router to the directly connected network is defined as 1. The distance from a router to a network that is not directly connected is 定义的路由器的数量再加1. 1 is added because the direct delivery is performed after reaching the destination network, and the distance to the directly connected network has been defined as 1.
As shown in the figure below, the distance from router R1 to Net 1 and Net 2 is 1, the distance to Net 3 is 2, and the distance to Net 4 is 3 The distance of

RIP protocol is also called 跳数, each time it passes through a router, it can be understood as a jump. The number of hops is increased by 1. RIP believes that 好的路由就是它通过的路由器的数目少,即距离短, note that this will be used when understanding the principle later. RIP only allows one path to contain 15 routers. When the number of hops (distance) exceeds 15, it is considered unreachable.

3. Features of RIP protocol

  • 仅和相邻路由器交换信息。If the communication between two routers does not require a third router, it is said to be adjacent. RIP stipulates that non-adjacent routers do not exchange information.
  • The information exchanged by the router is当前本路由器所知道的全部信息,即自己现在的路由表
  • 按固定的时间间隔Exchange routing information. For example, every 30 seconds, the router then updates the routing table according to the received routing information. When the network topology changes, the router also advertises the changed routing information to neighboring routers in time.

Two, distance vector algorithm

As can be seen from the above description, the update of the routing table between routers is a process of constantly finding the shortest distance. During this process, one router passes to another, and the other passes to the third. Slowly, the routing tables in all routers correspond to the minimum distance of network jumps. This updated algorithm is called 距离向量算法.

Algorithm Description

First of all, you must know that each item of a RIP message has three key fields, namely: destination network, distance, and next-hop router . Perform the following steps for the RIP message sent by
each router.相邻路由器

1. For the RIP message sent by the neighboring router with address X, first modify all items in the message: change the address in the "next hop" field to X, and add all the "distance" fields 1. Each item corresponds to the destination network N, distance d, next-hop router X
2. Perform the following operations on each item of the modified RIP message:

If there is no destination network N in the original routing table, this item is added to the routing table.
Otherwise (that is, there is a destination network N in the original routing table, then check the next hop router)

If the address of the next hop router is X, replace the item just received with the item in the original routing table.
Otherwise (that is, this item goes to the destination network N, but the next hop router is not X)

If the distance of the received item is less than the distance in the routing table, update
it, otherwise do nothing

3. If the updated routing table of the adjacent router has not been received in 3 minutes, the child adjacent router is recorded as an unreachable router, that is, the distance is recorded as 16. (More than 15 means unreachable, as mentioned above)
4. Back

Three, examples

Router R 6 routing table

Destination network distance Next hop router
Net2 3 R4
Net3 4 R5

R 4 sends R 6 routing update information

Destination network distance Next hop router
Net1 3 R 1
Net2 4 R 2
Net3 1 Direct delivery

Directly follow the above steps to modify the RIP message sent by R 4

Destination network distance Next hop router
Net1 3+1=4 R4
Net2 4+1=5 R4
Net3 1+1=2 R4

Then look at the modified RIP message information

  • There is no Net1 in the original routing table, so add this item directly
  • There is Net2 in the original routing table, and its next hop router is the same as that in R 4 , so replace
  • YouNet3 in the original routing table, but the next hop router is different, and the received item distance is less than the original distance, so replace it

So the final routing table information of R 6 is

Destination network distance Next hop router
Net1 4 R4
Net2 5 R4
Net3 2 R4

Four, annotation

To be updated

Guess you like

Origin blog.csdn.net/weixin_43716048/article/details/111145837