A detailed explanation of RIP routing protocol and loop problems!

According to the configuration mode, routing is divided into static routing and dynamic routing.

Static routing means that the administrator manually configures the routing table through commands to implement communication between routers. Although static routing is simple to configure, it has a huge workload. It is only suitable for small-scale networks with simple structures and is not easy to check for errors. In the case of medium and large networks, it is difficult for us to configure the routing table for each router. At this time, we will use dynamic routing to iterate the routing table.

What is dynamic routing? What is a dynamic routing protocol?

Generally refers to what we usually call a dynamic routing protocol. This is a protocol used by routers to calculate and maintain network routing information. There are usually certain algorithms that work at the transport layer or application layer.

Dynamic routing is implemented based on a certain routing protocol. The routing protocol defines some rules when the router communicates with other routers. The dynamic routing protocol is like a language used to exchange information between routers. Through it, network connection information and status information can be shared between routers. The router also uses this different language and different ways to iterate the routing table.

Based on each autonomous system ( AS ), dynamic routing is also divided into two types: Interior Gateway Protocol ( IGP ) and Exterior Gateway Protocol ( EGP ). The internal gateway protocol is mainly used for network communication in autonomous systems, while the external gateway protocol is used for communication between various autonomous systems. RIP protocol is one of IGP .

image.png

What is the RIP routing protocol?

The RIP protocol is the first widely used routing protocol with simple configuration. It is a protocol based on the distance vector algorithm, which uses the number of hops as a metric to measure the distance to the destination network. RIP exchanges routing information through UDP packets, and the port number used is 520 .

The RIP protocol requires each router in the network to maintain routing information from itself to each network. The RIP protocol uses the number of hops to measure the "distance" between networks: the number of hops from a router to its directly connected network is defined as 1 ; the distance from a router to its non-directly connected network is defined as: every time a router passes Add 1 to the distance . "Distance" is also called the number of hops . The maximum number of hops allowed by RIP is 15. When it reaches 16 , it is considered unreachable. Therefore, RIP is generally only suitable for small networks. 

1. The working principle of RIP The initial routing table when the RIP protocol is started only contains some direct connection port routes of the device. Neighboring devices can learn routing table entries from each other to realize routing intercommunication between network segments . When the router finds that the directly connected network has changed, it will immediately forward the updated information of the routing table to all neighboring routing nodes at a distance of one hop. After other routers receive the update information, they continue to forward to other routers with a distance of one hop plus . When each router receives the update information, it will update its own routing table information. On average, each router sends routing update information from each interface of the started RIP protocol every 30s .

There are currently two versions of RIP , which are divided into RIPv1 and RIPv2 . RIPv2 is a supplement to RIPv1 , which can carry more information and enhance security performance. Both RIPv1 and RIPv2 are based on the UDP protocol.

 

The RIP protocol completely relies on the number of hops as the standard. In the following situations, when R1 leads to R3 , even if the transmission speed of the 2- hop path is much greater than that of the 1- hop path, the RIP protocol will still select this 10kbps path for transmission. If there are special path transmission needs, you can manually interfere with the RIP path selection and increase the metric value of the path to let it choose other paths.

 

 image.png

 

RIP routing loop problem

Starting from the first router, the number of hops increases by 1 every time it passes through a router . Why should the maximum hop number be set to 15 ? Is it because the routing table cannot hold more routing information? The reason why the RIP protocol sets the maximum number of hops between routers above 15 to be unreachable is not because the routing table only records the network structure with a radius of 15 hops. It is to solve the problem of routing closed loop.

This AS system uses RIP protocol to connect and can communicate with each other, as shown in the figure below.  

 image.png

1> Router 1 disconnected from the A network, and at the same time sent update messages to router 2 and router 3 .

2> Because the link is blocked, router 2 did not receive the update message from router 1 .

3>After router 3 receives the update message from router 1 , it removes the A network from the routing table.

4> Because the update message of router 1 has not been received . 30s , the router 2 sends update messages tell the router 3 Network A to 2 -hop distance up.

5> router 3 receives Router 2 update packets, updating the routing table, the network record A to 3 -hop distance up forwarding information and routing table updates to the router 1 .

6> Router 1 receives the update information and updates the routing table. Network A is reachable with a distance of 4 hops. And send the update message to router 2 . So back and forth.

 

Due to the problem of counting to infinity, when a loop occurs, the number of hops will be increased by 1 every time a router passes , until a certain peak is reached, and the router considers the path to be unreachable. It will be deleted. Otherwise, the routing loop will go on endlessly.

Split horizon

Under certain conditions, the use of split horizon can effectively solve the routing closed loop problem.

The principle of split horizon is that the routes learned by RIP from an interface will not be sent back to neighboring routers from that interface. This not only reduces bandwidth consumption, but also prevents routing loops .

If the split horizon is not set, the routing information updated by the router from a certain interface will be sent back to this port after adding 1 hop, and the two routers will keep sending routing table update information until the hop count reaches the peak. After setting the split horizon, the routing loop problem can be effectively improved.

Toxicity Reversal Method

Compared with the split horizon method, poison reversal can solve the routing loop problem more efficiently.

The principle of the poison reverse method is that after RIP learns a route from an interface, it sends it back to the neighboring router from the original interface, and sets the cost of the route to 16 (that is, it indicates that the route is unreachable). In this way, useless routes in the routing table of the other party can be cleared.

When a router discovers that it is disconnected from a directly connected network, it directly sets the hop count of this network to 16 , and updates the routing information to the adjacent routing device. Make them all updated to 16 hops unreachable.

 

The difference between RIPv1 and RIPv2

RIPv1 is a classful routing protocol that strictly distinguishes ABC networks. RIPv2 is a classless routing protocol that supports route summarization.

RIPv1 is updated through broadcast, and RIPv2 is updated through multicast.

RIPv1 does not have a marking function for routes, but RIPv2 can mark routes for filtering and tactics.

RIPv1 has no authentication function, RIPv2 can support authentication, and there are two types of authentication , plaintext and MD5 .

 

 


Guess you like

Origin blog.51cto.com/14841124/2668471