Rip Protocol understanding

Source: Internet
Author: User

I. Overview
The full name of the RIP Protocol is the Routing Information Prot ocol. It is an internal gateway protocol (IGP) used to transmit route Information in an autonomous system (. The RIP Protocol is based on the Distance Vector (Distance Vector Algorithms). It uses the number of hops (metric) to measure the routing Distance to the target address.

Ii. Restrictions of the Protocol
1. The Protocol stipulates that the measurement of a valid route information cannot exceed 15, so that the Protocol cannot be applied to a large network, it should be said that this restriction is imposed by the designer because the Protocol is only applicable to small networks. For a target network with a metric of 16, it is considered inaccessible.
2. When the routing protocol is applied to reality, it is easy to see the phenomenon of "count to infinity", which makes the routing convergence very slow, after the network topology changes, it takes a long time for route information to stabilize.
3. The Protocol is based on the number of hops (that is, the number of routers passing through the packets) and the route is selected. This measure is not reasonable, the impact of network delay, reliability, line load, and other factors on transmission quality and speed is not considered.
Iii. Format and features of RIP (version 1) packets
3.1. Format of RIP (version 1) packets
0 7 15 31
Command (1 byte) version (1 byte) must be 0 (2 byte)
Address type identifier (2 bytes) must be 0 (2 bytes)
IP address
Must be 0
Must be 0
Metric value (1-16)
(A maximum of 24 other routes can be created, in the same format as the first 20 bytes)

When the "command word" field is 1, it indicates a RIP request, and when it is 2, it indicates a RIP response. The address type identifier is always 2 in practice, that is, the address type is IP address. The "ip address" field indicates the destination network address, and the "Metric" field indicates the "Number of hops" required to reach the destination network ".

3.2. RIP features
(1) Route information update features:
When a vro is initially started, it only contains the route information of its direct connection network, and the metric value of its direct connection network is 1, then it sends a complete route table RIP request to other routers (the "ip address" Field of the request packet is 0.0.0.0 ). The router updates its route table based on the received RIP response. The specific method is to add a new route table entry and add its metric value to 1. If you receive the same route information as the destination address of an existing table item, you can take the following three actions: first, if the source port of an existing table item is the same as the source port of the new table item, the route table is unconditionally updated based on the latest route information. In the second case, the existing table item and the new table item come from different ports, then compare their metric values to the most self-owned route table item with a smaller metric value. In the third case, the metric values of the old and new table items are equal, the common solution is to retain the old table items.
The router sends its route table every 30 seconds (broadcast in RIP response ). For a route entry, if no new route information about it is received after 180 seconds, mark it as invalid, that is, the metric value is marked as 16. After the other 120 seconds, if no information is updated, the invalid information will be deleted.
2) processing of the "version" field in the RIP message in RIP version 1:
0: Ignore the message.
1: For version 1 packets, check the field "must be 0" in the message. If it does not meet the requirements, ignore the message.
> 1: do not check the fields "must be 0" in the message. Only valid fields specified in RFC 1058 are processed. Therefore, machines running RIP version 1 can receive Packets Processing RIP version 2, but will lose the information of the new rules of RIP version 2.

(3) Address handling in RIP version 1
RIP version 1 cannot identify the subnet network address. Because the route update packet transmitted by RIP does not contain the subnet mask, the RIP route information is either the host address and used for point-to-point link routing; it is either A, B, or C-type network address, used for Ethernet Routing, or 0.0.0.0, that is, the default route information.

(4) count to Infinity)
In the limitations section of RIP, we mentioned the possible phenomenon of infinite count. Next we will analyze the causes and processes of this phenomenon. Test the following simple network:
C (destination network) ---- router A ------ router B
Under normal circumstances, for the target network, the metric value of router A is 1, and the metric value of router B is 2. When the link between the target network and router A fails:
C (destination network) -- | -- router A ------ router B
Vroa A sets the metric value of the route table entry for the target network C to 16, indicating that the target network is inaccessible, prepare to update the route table every 30 seconds. If router A receives A route update packet from router B before this message is sent, B contains the routing information about metric 2 of C. According to the routing update method mentioned above, router A mistakenly considers that there is A route through router B that can reach the target network C, so as to update its route table. The metric value for the route table entry of the target network C is changed from 16 to 3, the port is changed to the port connected to router B. Obviously, A will send this message to B, B will unconditionally update its route table, and change metric to 4. The message is sent from B to A, and A changes metric to 5 ...... Finally, the metric value of the route table about the target network C is changed to 16, and the correct route information is obtained. This phenomenon is called the "count to infinity" phenomenon. Although the convergence is finally completed, the convergence speed is very slow, and network resources are wasted to send these cyclic groups.
In addition, we can also see from here that there is a conflict in the choice of the maximum metric value. If you select too small, then the applicable network size is too small; if you choose too large, the convergence time will become long when the count to infinity occurs.
3.3. Two Measures to Improve RIP Performance
3.3.1. horizontal segmentation
In the above "count to infinity" phenomenon, the cause is that A and B transmit "spoofing information" to each other. In this case, we will naturally think that if we can remove these "spoofing information", we will not be able to avoid "count to infinity" to a certain extent. Horizontal segmentation is such a solution.
"Normal horizontal segmentation" means that if a route information is learned from Port X, the route update packet sent from this port will no longer contain this route information.
"Horizontal segmentation with drug reversal" is: if a route information is learned from Port X, the route update message sent from this port will continue to contain this route information, in addition, set the metric of this information to 16.
"Normal horizontal segmentation" can avoid sending spoofing information, reduce the size of route update packets, and save network bandwidth; "horizontal segmentation with drug reversal" can quickly eliminate the routing information loop, but it increases the burden of route update. The two methods can be selected based on the actual situation.

3.3.2. Trigger update
The above "horizontal segmentation" can eliminate the cycle of spoofing information between the two routers, but when three or more routers are involved, the effect is limited. Evaluate the knowledge of the following network:

+ --- ++ ---- ++ ----- + /-----\
| C + ------- | D | ----- | E |
| A + ------ | + ---- |
+-++ ---- ++ --- +-+ \-----/
| -- |
| -- |
| -- |
+ ---- + |

| B + -----------------------

+ ---- +
E is the target network

For the target network, the router routing information is as follows:
A: 3 C
B: 2 D
C: 2 D
D: 1 direct connection
After a fault is interrupted between D and the target network, B and C can correctly obtain the inaccessible information from D. However, as shown in the preceding routing information, although A does not send error messages to C, A may send route information to B before receiving the network inaccessible information, so that B may think that A can reach the target network through, then there will be the phenomenon of "count to infinity.
The update trigger is to improve the above situation. The specific implementation measures are as follows: Once a vro detects a network change, it sends an update packet as soon as possible or even immediately, instead of waiting for the end of the update period. As long as the update trigger speed is fast enough, it can greatly prevent the occurrence of "count to infinity", but this phenomenon is still possible.
After an update is triggered, when the network topology changes, a message update trend similar to "Domino" appears in the network, and finally stop the router that has never changed the path to the target network.

4 timers in 3.4. RIP
A total of four timers are used in RIP: update timer, timeout timer, garbage timer, and holddown timer.
Update timer is used to send route Update packets every 30 seconds.
Timeout timer is used to set the timer time for the first 180 seconds before the routing information expires. This counter is reset every time the same route information is updated.
Garbage timer and holddown timer are used to delete invalid route information before the time: During the holddown timer time, invalid route information cannot be updated by new information received; when the garbage timer times out, the invalid route information is deleted.
In addition, during the trigger update, the update information will be sent after a random delay of 1 to 5 seconds. A timer is also required here.
Iv. Introduction to RIP Version 2
The message format of RIP version 2 is as follows:
0 7 15 31
Command (1 byte) version (1 byte) routing domain (2 byte)
0 xFFFF (2 bytes) Verification type (2 bytes)
Verification (16 bytes)
Address type identifier (2 bytes) routing label (2 bytes)
IP address
Subnet Mask
Next Hop IP Address
Metric value (1-16)
(A maximum of 24 other routes can be created, in the same format as the first 20 bytes)

Version 2 uses the "must be 0" field in version 1, and adds some useful information for routing. Its new features are as follows:
(1) The packet contains a subnet mask, which can be used for subnet routing.
(2) Support for plaintext/MD5 Verification
(3) The packet contains the next hop IP address, providing more information for route optimization. Article entry: csh responsible editor: csh

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.