1. Overview
The full name of the RIP protocol is Routing Information Prot ocol, which is an internal gateway protocol (IGP) used to transmit routing information within an autonomous system (AS). The RIP protocol is based on the Distance Vector Algorithms, which uses "hop count", that is, metric to measure the routing distance to the target address.
2. Limitations of this agreement
1. The protocol stipulates that the metric of an effective routing information cannot exceed 15, which makes the protocol unable to be applied to very large networks. It should be said that this restriction is implemented because the designer considers that the protocol is only suitable for small networks. For a target network with a metric of 16, it is considered unreachable.
2. When this routing protocol is applied to reality, it is easy to "count to infinity", which makes the routing convergence very slow, and it takes a long time for routing information to stabilize after the network topology changes.
3. This protocol uses the number of hops, that is, the number of routers through which the packet passes, and uses it to select the route. This measure is not reasonable because the impact of factors such as network delay, reliability, line load on transmission quality and speed is not taken into account.
III. The format and characteristics of RIP (version 1) packets
3.1. RIP (version 1) message format
0 7 15 31
Command word (1 byte) Version (1 byte) Must be 0 (2 bytes)
Address type identifier (2 bytes) must be 0 (2 bytes)
IP address
Must be 0
Must be 0
Metric value (1-16)
(There can be up to 24 additional routes, with the same format as the first 20 bytes)
When the "Command Word" field is 1, it means the RIP request, and when it is 2, it means the RIP reply. The address type identifier is always 2 in actual application, that is, the address type is an 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. Characteristics of RIP
(1) Routing information update characteristics:
When the router initially starts, it only contains routing information for its direct network, and its direct network has a metric value of 1. Then it issues a RIP request for the complete routing table to other surrounding routers (the "IP address" field of the request packet is 0.0.0.0). The router updates its routing table based on the received RIP reply. The specific method is to add a new routing table entry and add its metric value by 1. If you receive routing information that is the same as the destination address of an existing table entry, you will be treated in the following three situations: in the first case, the source port of an existing table entry is the same as the source port of the new table entry, then the routing table is unconditionally updated according to the latest routing information; in the second case, the existing table entry and the new table entry are from different ports, then compare their metric values and make the most of the routing table entry with a smaller metric value; in the third case, the metric values of the new and old table entry are equal, and the common method is to keep the old table entry.
The router sends its own routing table every 30 seconds (broadcasts in RIP response). For a certain routing information, if no new routing information is received after 180 seconds, it will be marked as invalid, that is, the metric value is marked as 16. After another 120 seconds, if the information is still not updated, the invalid information is deleted.
2) RIP version 1 handles the "version" field in RIP packets:
0: Ignore the message.
1: Version 1 message, check the field "must be 0" in the message. If the message does not meet the requirements, ignore the message.
>1: Do not check the fields "must be 0" in the message, and only meaningful fields specified in RFC 1058 are processed. Therefore, machines running RIP version 1 can receive packets that process RIP version 2, but will lose the information newly specified in RIP version 2.
(3) RIP version 1 handles the address
RIP version 1 cannot recognize the subnet network address because the subnet mask is not included in the route update message it transmits. Therefore, the RIP routing information is either the host address, used for point-to-point link routing; or Class A, B, and C network addresses, used for Ethernet, etc.; in addition, it can also be 0.0.0.0, that is, the default routing information.
(4) Counting to Infinity
The previous part of the limitations of RIP mentioned the possible phenomenon of counting to infinity. Let’s analyze the causes and processes of this phenomenon. Check out the following simple network:
c(Destination Network)---------------------------------------�
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 and breaks:
c(Destination Network)-||-router A---router B
Router A will set the metric value of the routing table entry for target network C to 16, that is, it is marked as unreachable to the target network, and prepare to send it out in the routing table update every 30 seconds. If this message has not been sent, router A receives the routing update message from B, and B contains routing information about C with a metric of 2. According to the aforementioned route update method, router A will mistakenly believe that there is a path through router B that can reach the target network C, thereby updating its routing table, changing the metric value of the routing table entry for target network C from 16 to 3, and changing the port to the port connected to router B. It is obvious that A will send the information to B, B will unconditionally update its routing table and change the metric to 4; the information will be sent from B to A, and A will change the metric to 5... Finally, the metric value of the double-send routing table regarding the target network C is changed to 16, and at this time, the correct routing information is truly obtained. This phenomenon is called "counting to infinity". Although convergence is finally completed, the convergence speed is very slow and network resources are wasted to send these looped packets.
In addition, we can also see from here that there is actually contradiction in choosing the maximum value of the metric value. If it is chosen too small, the applicable network size is too small; if it is chosen too large, the convergence time will become very long when the count reaches infinity.
3.3. Two measures to improve RIP performance
3.3.1. Horizontal segmentation
In the above "counting to infinity" phenomenon, the reason for this is that A and B transmit "deception information" to each other. So in response to this situation, we will naturally think that if these "deception information" can be removed, then can we avoid "counting to infinity" to a certain extent? Horizontal segmentation is such a solution.
"Ordinary horizontal segmentation" is: if a routing information is learned from port X, the routing update message sent from that port will no longer contain the routing information.
"Horizontal segmentation with poisoning reversal" is: if a routing information is learned from port X, the route update message sent from that port will continue to contain the routing information, and the metric of this message is set to 16.
"Ordinary horizontal segmentation" can avoid the sending of spoofed information, and reduce the size of route update packets, saving network bandwidth; "Horily segmentation with poisoning reversal" can eliminate the loop of route information faster, but increase the burden of route update. The choice of these two measures can be chosen according to actual conditions.
3.3.2. Trigger update
The above "horizontal segmentation" can eliminate the mutual circulation of spoofed information between two routers, but when three or more routers are involved, the effect is limited. Check out the following networks:
+---+ +----+ +-----+ /-----\
| | | C +-------| D | -----|| E ||
| A +------| | | +---- | |
+-+-+ +----+ +---+-+ \-----/
| -- |
| -- |
| -- |
+----+ |
| B +-----------------------
+----+
E is the target network
For the target network, the routing information of each router is as follows:
A:3 C
B:2 D
C:2 D
D: 1 Direct connection
When a failure occurs between D and the target network, B and C can correctly obtain information that is unreachable from D. However, from the above routing information, it can be seen that although A will not send error messages to C, A may send routing information to B before receiving the unreachable information in the network, making B mistakenly believe that it can reach the target network through A, and then the phenomenon of "counting to infinity" will occur.
Triggering updates is to improve the above situation. Its specific implementation measures are: Once the router detects network changes, it will send update messages as soon as possible, and not wait for the update cycle to end. As long as the trigger update speed is fast enough, it can greatly prevent the occurrence of "counting to infinity", but this phenomenon is still possible.
After using trigger updates, when the network topology changes, a trend of update packets similar to "domino" will appear in the network, and finally aborts the router that reaches the target network with an unchanged path.
3.4. 4 timers in RIP
A total of 4 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 count 180 seconds before routing information expires. Each time the update information of the same routing information is received, the counter will be reset.
Garbage timer and holddown timer are used to delete invalid routing information at the same time: within the holddown timer timer, the invalid routing information cannot be updated by the received new information; after the garbage timer timer timer timer timer timer timer timer timer timeout, the invalid routing information is deleted.
In addition, in triggering updates, the update information will take a random delay of 1 to 5 seconds before it is sent, and a timer is also needed here.
IV. Introduction to RIP Version 2
The packet format of RIP version 2 is as follows:
0 7 15 31
Command word (1 byte) Version (1 byte) Routing domain (2 bytes)
0xFFFF (2 bytes) Verification type (2 bytes)
Verification (16 bytes)
Address type identifier (2 bytes) Routing tag (2 bytes)
IP address
Subnet mask
Next hop IP address
Metric value (1-16)
(There can be up to 24 additional routes, with the same format as the first 20 bytes)
The RIP of version 2 uses the "must be 0" field in version 1, adding some useful information for routing. The main new features are as follows:
(1) The message contains a subnet mask, and subnet routing can be performed
(2) Support plain text/MD5 verification
(3) The message contains the next hop IP, providing more information for the selection of routes. Article entry: csh Editor in charge: csh
The full name of the RIP protocol is Routing Information Prot ocol, which is an internal gateway protocol (IGP) used to transmit routing information within an autonomous system (AS). The RIP protocol is based on the Distance Vector Algorithms, which uses "hop count", that is, metric to measure the routing distance to the target address.
2. Limitations of this agreement
1. The protocol stipulates that the metric of an effective routing information cannot exceed 15, which makes the protocol unable to be applied to very large networks. It should be said that this restriction is implemented because the designer considers that the protocol is only suitable for small networks. For a target network with a metric of 16, it is considered unreachable.
2. When this routing protocol is applied to reality, it is easy to "count to infinity", which makes the routing convergence very slow, and it takes a long time for routing information to stabilize after the network topology changes.
3. This protocol uses the number of hops, that is, the number of routers through which the packet passes, and uses it to select the route. This measure is not reasonable because the impact of factors such as network delay, reliability, line load on transmission quality and speed is not taken into account.
III. The format and characteristics of RIP (version 1) packets
3.1. RIP (version 1) message format
0 7 15 31
Command word (1 byte) Version (1 byte) Must be 0 (2 bytes)
Address type identifier (2 bytes) must be 0 (2 bytes)
IP address
Must be 0
Must be 0
Metric value (1-16)
(There can be up to 24 additional routes, with the same format as the first 20 bytes)
When the "Command Word" field is 1, it means the RIP request, and when it is 2, it means the RIP reply. The address type identifier is always 2 in actual application, that is, the address type is an 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. Characteristics of RIP
(1) Routing information update characteristics:
When the router initially starts, it only contains routing information for its direct network, and its direct network has a metric value of 1. Then it issues a RIP request for the complete routing table to other surrounding routers (the "IP address" field of the request packet is 0.0.0.0). The router updates its routing table based on the received RIP reply. The specific method is to add a new routing table entry and add its metric value by 1. If you receive routing information that is the same as the destination address of an existing table entry, you will be treated in the following three situations: in the first case, the source port of an existing table entry is the same as the source port of the new table entry, then the routing table is unconditionally updated according to the latest routing information; in the second case, the existing table entry and the new table entry are from different ports, then compare their metric values and make the most of the routing table entry with a smaller metric value; in the third case, the metric values of the new and old table entry are equal, and the common method is to keep the old table entry.
The router sends its own routing table every 30 seconds (broadcasts in RIP response). For a certain routing information, if no new routing information is received after 180 seconds, it will be marked as invalid, that is, the metric value is marked as 16. After another 120 seconds, if the information is still not updated, the invalid information is deleted.
2) RIP version 1 handles the "version" field in RIP packets:
0: Ignore the message.
1: Version 1 message, check the field "must be 0" in the message. If the message does not meet the requirements, ignore the message.
>1: Do not check the fields "must be 0" in the message, and only meaningful fields specified in RFC 1058 are processed. Therefore, machines running RIP version 1 can receive packets that process RIP version 2, but will lose the information newly specified in RIP version 2.
(3) RIP version 1 handles the address
RIP version 1 cannot recognize the subnet network address because the subnet mask is not included in the route update message it transmits. Therefore, the RIP routing information is either the host address, used for point-to-point link routing; or Class A, B, and C network addresses, used for Ethernet, etc.; in addition, it can also be 0.0.0.0, that is, the default routing information.
(4) Counting to Infinity
The previous part of the limitations of RIP mentioned the possible phenomenon of counting to infinity. Let’s analyze the causes and processes of this phenomenon. Check out the following simple network:
c(Destination Network)---------------------------------------�
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 and breaks:
c(Destination Network)-||-router A---router B
Router A will set the metric value of the routing table entry for target network C to 16, that is, it is marked as unreachable to the target network, and prepare to send it out in the routing table update every 30 seconds. If this message has not been sent, router A receives the routing update message from B, and B contains routing information about C with a metric of 2. According to the aforementioned route update method, router A will mistakenly believe that there is a path through router B that can reach the target network C, thereby updating its routing table, changing the metric value of the routing table entry for target network C from 16 to 3, and changing the port to the port connected to router B. It is obvious that A will send the information to B, B will unconditionally update its routing table and change the metric to 4; the information will be sent from B to A, and A will change the metric to 5... Finally, the metric value of the double-send routing table regarding the target network C is changed to 16, and at this time, the correct routing information is truly obtained. This phenomenon is called "counting to infinity". Although convergence is finally completed, the convergence speed is very slow and network resources are wasted to send these looped packets.
In addition, we can also see from here that there is actually contradiction in choosing the maximum value of the metric value. If it is chosen too small, the applicable network size is too small; if it is chosen too large, the convergence time will become very long when the count reaches infinity.
3.3. Two measures to improve RIP performance
3.3.1. Horizontal segmentation
In the above "counting to infinity" phenomenon, the reason for this is that A and B transmit "deception information" to each other. So in response to this situation, we will naturally think that if these "deception information" can be removed, then can we avoid "counting to infinity" to a certain extent? Horizontal segmentation is such a solution.
"Ordinary horizontal segmentation" is: if a routing information is learned from port X, the routing update message sent from that port will no longer contain the routing information.
"Horizontal segmentation with poisoning reversal" is: if a routing information is learned from port X, the route update message sent from that port will continue to contain the routing information, and the metric of this message is set to 16.
"Ordinary horizontal segmentation" can avoid the sending of spoofed information, and reduce the size of route update packets, saving network bandwidth; "Horily segmentation with poisoning reversal" can eliminate the loop of route information faster, but increase the burden of route update. The choice of these two measures can be chosen according to actual conditions.
3.3.2. Trigger update
The above "horizontal segmentation" can eliminate the mutual circulation of spoofed information between two routers, but when three or more routers are involved, the effect is limited. Check out the following networks:
+---+ +----+ +-----+ /-----\
| | | C +-------| D | -----|| E ||
| A +------| | | +---- | |
+-+-+ +----+ +---+-+ \-----/
| -- |
| -- |
| -- |
+----+ |
| B +-----------------------
+----+
E is the target network
For the target network, the routing information of each router is as follows:
A:3 C
B:2 D
C:2 D
D: 1 Direct connection
When a failure occurs between D and the target network, B and C can correctly obtain information that is unreachable from D. However, from the above routing information, it can be seen that although A will not send error messages to C, A may send routing information to B before receiving the unreachable information in the network, making B mistakenly believe that it can reach the target network through A, and then the phenomenon of "counting to infinity" will occur.
Triggering updates is to improve the above situation. Its specific implementation measures are: Once the router detects network changes, it will send update messages as soon as possible, and not wait for the update cycle to end. As long as the trigger update speed is fast enough, it can greatly prevent the occurrence of "counting to infinity", but this phenomenon is still possible.
After using trigger updates, when the network topology changes, a trend of update packets similar to "domino" will appear in the network, and finally aborts the router that reaches the target network with an unchanged path.
3.4. 4 timers in RIP
A total of 4 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 count 180 seconds before routing information expires. Each time the update information of the same routing information is received, the counter will be reset.
Garbage timer and holddown timer are used to delete invalid routing information at the same time: within the holddown timer timer, the invalid routing information cannot be updated by the received new information; after the garbage timer timer timer timer timer timer timer timer timer timeout, the invalid routing information is deleted.
In addition, in triggering updates, the update information will take a random delay of 1 to 5 seconds before it is sent, and a timer is also needed here.
IV. Introduction to RIP Version 2
The packet format of RIP version 2 is as follows:
0 7 15 31
Command word (1 byte) Version (1 byte) Routing domain (2 bytes)
0xFFFF (2 bytes) Verification type (2 bytes)
Verification (16 bytes)
Address type identifier (2 bytes) Routing tag (2 bytes)
IP address
Subnet mask
Next hop IP address
Metric value (1-16)
(There can be up to 24 additional routes, with the same format as the first 20 bytes)
The RIP of version 2 uses the "must be 0" field in version 1, adding some useful information for routing. The main new features are as follows:
(1) The message contains a subnet mask, and subnet routing can be performed
(2) Support plain text/MD5 verification
(3) The message contains the next hop IP, providing more information for the selection of routes. Article entry: csh Editor in charge: csh