1 RIP principle

1.1 Direct Route

When an interface of the router is configured with an IP address, the router automatically learns the network number of the network segment where the interface IP address resides into the routing table. The loaded routes are direct routes and the routes at the door of the router. To automatically learn the routing table, the physical and protocol status of the interface must be UP.

1.2 Static Route

You can manually add and maintain data on each device based on data access requirements, but cannot dynamically respond to topology changes.

1.3 Dynamic Routing Protocols

The router automatically updates the contract step of routing information and converges when the network topology changes. The so-called dynamic routing protocol enables routers to interact with each other to calculate routing information, learn routes dynamically, and populate routing tables. In large-scale networking, dynamic and static combination is often adopted.

1.4 Classification of Dynamic Routing Protocols

Classification based on routing protocol algorithms or types of information transmitted between routers:

According to the working mechanism of the agreement agreement
Distance vector protocol Features of RIP and BGP: The router directly updates its own routing table to its neighbor. Routers exchange their own routing tables to learn or record routes that do not exist on their own.
Link state protocol OSPF, IS as-is features: transfer IS to describe the topological information IS called link-state information, by flood and collect the information, each router can build topology database, the database IS equivalent to the understanding of the whole topology, based on the understanding of each router algorithm separately calculated, for their own root, produce a shortest path tree.
According to the scope of work agreement
IGP (within AS) RIP, OSPF, and IS-IS ARE autonomous area systems (AS) that work in aN AS and are centrally managed by an independent organization. These networks consist of a group of routers running the same routing protocol type and policy. To be specific, they are similar to the network of a company.
EGP (between AS) BGPESP works between ass, enabling the exchange of routing information

1.5 Overview of RIP

Routing Information Protocols (RIP) is an internal gateway protocol with a long history. Applicable to small networks, RIP is a typical distance vector protocol based on UDP and has port 520. Update the entire routing list regularly, as hearsay; Distance vector routing protocols do not understand network topology. RIP has three versions: RIPv1, RIPv2, and RIPng (developed for IPv6).

V2 made the following improvements on the basis of V1:

Added external routing flags, added VLSM support, multicast RIP messages: 224.0.0.9, supported authentication, added next hop fields.

1.6 Working mechanism of distance Vector Routing protocol -RIP

1.6.1 basis

Routers that use distance-vector routing protocols do not understand the network topology. This is an update based on “rumor”.

Routers running the distance-vector routing protocol exchange routing tables with each other. R1’s direct routes are advertised to R2, which also receives and loads them into its own routing table. R1 means 0 hops to 1.1.1.0/24 (1 hop is a router), R2 means 1 hop to 1.1.1.0/24, and the hop count (metric value) is the cost of the router to measure the destination.

Periodically update (broadcast) the entire routing table. Advertise your entire routing table, and everyone else will do the same, so that all routers can learn the entire network route.

1.6.2 Working Principles of RIP (Learning Process)

Router initial startup: Initial network discovery: The direct network is written to the routing table. The router can automatically learn the direct route and write to the routing table. Now we deploy RIP on all routers.

Initial exchange of routing information: Since BOTH ABCs run RIP, they update their routing tables from all riP-enabled interfaces in broadcast mode (RIP version 1 is broadcast and RIP version 2 is multicast). Take B as an example. It updates its routing table and both A and C receive it. After receiving the routing table sent by B, A finds 10.0.2.0 and 10.0.3.0, but 10.0.2.0 exists in its routing table, it continues to look down and finds 10.0.3.0 does not exist, so it learns this route and records the number of the interface that receives this information. Is also used to when accessing this purpose should be from this interface go out on the network, at the same time as the routing associated A metric value: 1, the so-called 1 mean, jump to reach 10.0.3.0 this network, A need to pass the router B, this is A jump, jump is A three layer device, RIP as the routing metric values through the hop. After this round of learning, A can learn 10.0.3.0, C can learn 10.0.2.0, and B can learn 10.0.1.0 and 10.0.4.0 from A and C.

Route convergence is complete: there is another update, and all routers send their routing tables to their directly connected neighbors. A can learn the 10.0.4.0 route updated by B with 2 hops, because it needs to go through two BC routers to reach 10.0.4.0 (in fact, he does not know who to go through, RIP is just A simple addition). In this way, all routers have a route to every corner of the network. Let’s call this, route convergence is done.

1.6.3 Measurement (Cost)

RIP uses Hops as its measurement value. The measurement value refers to the measurement or cost paid to the destination network or the advantage of the two paths. (Each device that supports RIP routes adds a hop.) Fewer hops is better. Fewer hops means I get closer to the target network.

R1 learns two paths to 100.0/24, and the PK priorities of these two routes are both RIP with priorities of 100. Then PK costs are determined. Because the path above is 2-hop and the path below is 3-hop, the router running RIP will choose the path above. However, there is a large gap between link bandwidths. The upper one is 1.544M and the lower one is 1000M. Obviously, the lower transmission speed is higher.

1.6.4 Working Mechanism of RIP

The RIP protocol is updated one by one according to rumors. The neighbor updates the routing table to me. I first update the local routing table and then update my own routing table.

1.7 Route Priority

A Route Preference measures the number of routes received to the same network. Each protocol has a specified Preference. The smaller the route priority, the better. Note: Each vendor may set routing priorities differently.

Routing protocol or route type Routing priority
DIRECT 0
OSPF 10
IS-IS 15
STATIC 60
RIP 100
OSPF ASE 150
OSPF NSSA 150
IBGP 255
EBGP 255

1.8 Loop generation and anti-loop mechanism

, version 1.8.1 produce

Assume that BOTH ABCs run RIP and the network convergence is complete. The direct network segment 10.0.4.0/24 of router C failed, and the 10.0.4.0 routing entry was erased from the routing table because the physical state was Down. At this time, the update cycle arrived, and the routing table of B flooded the routing table. Router C found that it did not have the 10.0.4.0 routing entry, so it learned that the outgoing interface of the route was GE0/0/0 because it received the 10.0.4.0 entry from router B. Moreover, the hop count of router B’s 10.0.4.0 entry was 1. So the hop count to router C is 2. 10.0.4.0 routes continue to be updated around the network as the update cycle comes, but in fact the 10.0.4.0 network no longer exists, so if any part of the network sends data to the 10.0.4.0 network, the data will continue to circulate around the network until the TTL decays to 0. That’s the loop. When the destination address of the packet sent by router B is 10.0.4.0, router B queries the routing table and finds that there is a matching entry and sends the data out through port G0/0/1. Router C also queries the routing table and finds that the destination address of the packet is 10.0.4.0, and sends the packet out through port G0/0/0. The BC router comes and goes, creating a loop. And as the router continues to forward, the hop count increases.

1.8.2 Anti-ring mechanism

1. Define the maximum metric to prevent technology from reaching infinity (16 hops as unreachable)

To prevent RIP routes from being flooded indefinitely on the network, RIP provides that the maximum hop count of a route is 15. That is, if the metric value is greater than or equal to 16, the route is considered unreachable. The setting of the maximum hop count solves the problem of measuring value to infinity, but it also greatly limits the scale of the network that RIP can support.

Routers with loops continuously transmit routes on the network, and the number of hops increases continuously. 15 hops is the maximum number of hops, so we define that when 16 hops are reached, the route is unreachable, preventing endless transmission of a route. This approach is not efficient. For example, if there are really 16 devices on a network, why not consider them unreachable?

2. Split Horizon

Is a representative feature of distance vector protocol. If the 10.0.4.0 route is learned from ge0/0/1, the 10.0.4.0 route cannot be sent from GE0/0/1. This is called horizontal split. The routes learned by RIP from an interface are not sent back to the neighbor router through the interface. This reduces bandwidth consumption and prevents routing loops.

3. Poison Reverse

To break another feature of horizontal splitting, run this rule before disabling horizontal splitting. Although routes are received from GE0/0/1, they are also sent out from GE0/0/1, but the number of hops sent out is set to 16 (when a router receives routing updates from an interface, it updates them out from that interface at 16 hops). Bad news is better than no news. After RIP learns a route from an interface, it sends the route back to the neighbor router from the original interface and sets the cost of the route to 16 (indicating that the route is unreachable). In this way, you can clear unnecessary routes from the routing table of the peer.

The mechanism of Poison Reverse is that RIP learns a route from an interface, sets the cost of the route to 16 (indicating that the route is unreachable), and sends the route from the original interface to the neighbor router. In this way, you can clear unnecessary routes from the routing table of the peer. Toxicity reversal prevents routing loops from occurring. If both horizontal segmentation and toxic reversal are configured, only toxic reversal works.

4. RoutePoisoning

When discovering that the direct network segment is unreachable, C, as the update source, immediately sends an update to other routers. The update content is 10.0.4.0. This route has 16 hops to refresh router AB’s routing table and erase the unreachable route.

1.9 RIP Configuration

1.9.1 Configuration Commands

  • Start the RIP process and enter the RIP configuration view:

[Router] rip 1

  • Enable RIP on the specified network segment (RIP supports classful network declaration only) :

[the Router – rip – 1] network 192.168.12.0

  • Specify the RIP version (version 1 by default) :

[Router-rip-1] version 2

1.9.2 Configuration Example

R1 configuration is as follows:

< Huawei >system-view [Huawei]sysname R1 [R1]interface gigabitethernet0/0/1 [R1-gigabitethernet0/0/1] IP address Address 192.168.1.254 24 [R1-gigabitethernet0/0/1]quit [R1]int g0/0/0 [R1-gigabitethernet0/0/0] IP address 192.168.12.1 24 [R1-GigabitEthernet0/0/0]quit

RIPv2 on ge0/0/0 and GE0/0/1 of R1 [R1]rip 1 [R1-RIP-1]version 2 # Specify the rip version as version 2 [R1-RIP-1]network 192.168.1.0 # Activate rip [R1-RIP-1]network on ge0/0/0 192.168.12.0 # Enable RIP on ge0/0/1


The CONFIGURATION of R2 is as follows:

< Huawei >system-view [Huawei]sysname R2 [R2]interface gigabitethernet0/0/0 [R2-gigabitethernet0/0/0] IP address Address 192.168.12.2 24 [R2-gigabitethernet0/0/0]quit [R2]int g0/0/1 [R2-gigabitethernet0/0/1] IP address 192.168.23.2 24 [R2-GigabitEthernet0/0/1]quit

RIPv2 is enabled on ge0/0/0 and GE0/0/1 of R2. [R2] RIP 1 [R2-RIP-1] Version 2 [R2-RIP-1]network 192.168.12.0 [R2-RIP-1]network 192.168.23.0


The configuration of R3 is as follows:

Configure the IP address of the interface

< Huawei >system-view [Huawei]sysname R3 [R3]interface 0/0/0 [R3-gigabitethernet0/0/0] IP address 192.168.23.3 24 [r3-gigabitethernet0/0/0]quit [R3]int g0/0/1 [R3-gigabitethernet0/0/1] IP address 192.168.2.254 24 [R3-GigabitEthernet0/0/1]quit

RIPv2 = ge0/0/0 and GE0/0/1

[R3]rip 1 [R3-RIP-1] Version 2 [R3-RIP-1]network 192.168.2.0 [R3-RIP-1]network 192.168.23.0


After completing the above configuration, let’s check and verify. First check the IP routing table of R1:

[R1]display ip routing-table Route Flags: R – relay, D – download to fib ————————————————————————— Routing Tables: Public Destinations : 8 Routes : 8 Destination/Mask Proto Pre Cost Flags NextHop Interface 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 192.168.1.0/24 Direct 0 0 D 192.168.1.254 G0/0/1 192.168.1.254/32 Direct 0 0 D 127.0.0.1 G0/0/1 192.168.2.0/24 RIP 100 2 D 192.168.12.2 G0/0/0 192.168.12.0/24 Direct 00 D 192.168.12.1 G0/0/0 192.168.12.1/32 Direct 00 D 127.0.0.1G0/0/0 192.168.23.0/24 RIP 100 1 D 192.168.12.2G0/0/0

R1 has learned two routes, 192.168.2.0/24 and 192.168.23.0/24, through RIP. Of course, to ensure that PC1 and PC2 can communicate normally, all routers along the route must have complete routing entries. Therefore, we need to check the routing tables of R2 and R3, focusing on RIP routes:

Route Flags: R – relay, D – download to fib[R2]display ip routing-table protocol rip ————————————————————————— Public routing table : RIP Destinations : 2 Routes : 2 RIP routing table status : Destinations : 2 Routes : 2 Destination/Mask Proto Pre Cost Flags NextHop Interface 192.168.1.0/24 RIP 100 1 D 192.168.12.1 G0/0/0 192.168.2.0/24 RIP 100 1 D 192.168.23.3G0/0/1 RIP routing table status: Destinations: 0 Routes: 0

R2 also learns two routes, 192.168.1.0/24 and 192.168.2.0/24, through RIP. Similarly, view the routing table of R3 to ensure that R3 can learn the route of 192.168.1.0/24. PC1 and PC2 can now communicate with each other.