working principle

  Routing information protocol RIP (Routing Information Protocol) Is the internal gateway protocol IGP The first widely used protocol in .

RIP Is a distributed , Distance vector based routing protocol .

RIP The protocol requires each router in the network to maintain a distance record from itself to each other destination network .( Each router should remember the distance to the target network segment , The distance to the target refers to the number of hops )

RIP Working characteristics of the agreement

It every 30 Send your complete routing table to all active interfaces in seconds .( Whether the network changes or not , Periodic . The connected network segment and the learned routing information , Tell other routers through these ports . If there are many routing tables , Then you may need to send several packets to announce the routing table , If the number is small , Maybe one packet can be sent )

RIP The standard for the protocol to select the best path is the number of hops , It is considered that the path with the least router to reach the target network is the best path .(
Regardless of bandwidth , Therefore, the protocol is suitable for those with similar network bandwidth , There is no case where there is a particularly large difference in network bandwidth )

By default, the maximum number of hops allowed is 15 jump , in other words 16 The jump distance will be considered unreachable .( stay 1 It works particularly well in small networks )

In small networks ,RIP It will work well , But for using slow WAN For large networks connected or networks with a large number of routers , Its efficiency is very low .

“ distance ” Definition of

The distance from a router to a directly connected network is defined as 1.

The distance from a router to a non directly connected network is defined as the number of routers passed plus 1.

RIP In the agreement “ distance ” also known as “ Number of hops ”(hop count), Because every router , Add the number of hops 1.

there “ distance ” Actually, it means “ Shortest distance ”.

Examples

192.168.10.0/24 How do network segments pass through RIP Protocol notification to other routers in the network .

If you learn that a network segment has two paths , Keep only the best path .

Suppose these routers A B C D E It's all running RIP agreement , Every router is running RIP agreement .

Now with 192.168.10.0 Network segment as an example ,A How does the router announce this network segment to other routers , And how the distance increases .

A Router pass s0 and s1 The interface will 192.168.10.0/24 This network segment is announced , because A The router is directly connected to this network segment , So the distance is 0. adopt s0 Interface tell B Router , Then the appropriate distance for the announcement must be increased by one , that B I learned that the distance to this network segment is 1, At the same time, the next jump is recorded , Interface s0
2.0.0.1.

B After learning , Because it's running RIP agreement , So every 30s, adopt s1 Interface notification to c This router is out of order , The distance will be added when announcing 1, So the distance is 2 Yes . Finally in c It is recorded on the router that two routers are required to access this network segment , And the address of the next hop .

Similarly A--->E--->D----C

last C Router learned 192.168.10.0/24 There are two paths to this network segment , One path is 3, One path is 2.

Finally, only one is reserved , Distance is 3 Path ignored , Keep only the best path .

Of course C Router to other network segments will also be announced , Each network segment will be announced , Same as others A,B So is the router .

RIP Three characteristics of the protocol

Exchange information with neighboring routers only .

The information exchanged is all the information known to the router at present , Own routing table .

Exchange routing information at fixed time intervals , for example , every other 30
second . When the network topology changes , The router also timely notifies the adjacent router of the routing information after the topology change ( When the link changes , Just wait 30s Yes , For example, a network segment does not exist , I'll tell you right away .)

Establishment of routing table

When the router just started working , Only know the distance to the directly connected network ( This distance is defined as 0). Its routing table is empty .

in the future , Each router only exchanges and updates routing information with a very limited number of adjacent routers .

After several updates , All routers will eventually know the shortest distance to any network in the autonomous system and the address of the next hop router .( Last run RIP Protocol Router , After a period of updating , We all know how many segments there are in the network , Who's next )

RIP Convergence of protocol (convergence) Fast process .“ convergence ” It is the process that all nodes in the autonomous system get the correct routing information .
( After the network changes , The time when all nodes can learn the correct routing information , This is called convergence , That is, the time to adjust the route )

 

Distance vector algorithm

  Router receives adjacent router ( Its address is X) One of RIP message :

(1) Modify this first RIP All items in the message : hold “ Next jump ” The addresses in the fields are changed to X, And put all the “ distance ” The value of the field plus 1.

(2) For the modified RIP Each item in the message , Repeat the following steps :      

If the destination network in the project is not in the routing table , Add the item to the routing table .          

otherwise              

If the router address given in the next hop field is the same , Replace the items in the original routing table with the items received .                

otherwise                    

If the distance in the received item is less than the distance in the routing table , Then update ,         

otherwise , Do nothing .

(3) if 3 The updated routing table of adjacent routers has not been received for minutes , Then the adjacent router is recorded as an unreachable router , Set the distance to 16( Indicates unreachable ), And delete the route to the network segment .

(4) return .

The basis of distance vector algorithm is Bellman-Ford algorithm ( or Ford-Fulkerson algorithm ).

The key point of this algorithm is as follows : set up X Is a node A reach B A node on the shortest path of . If the path A→B Split into two paths A→X and X→B, Then each path A→X and
X→B They are also nodes A reach X And node X reach B Shortest path . 

If the routing record is not used, it will be added , Update as soon as possible . 

 【 example 】 routing table update

 

 

 

RIP2 Message format of protocol

 

 RIP The protocol uses UDP agreement ,

Technology
Daily Recommendation