Sunday , December 22 2024
Home / IP Routing / basic concept of RIP

basic concept of RIP

Routing Information Protocol RIP is an interior gateway protocol IGP, implemented based on a distance-vector algorithm.

RIPv1 characteristics
  1. A classful routing protocol
  2. Uses broadcast address to update routes
  3. Uses UDP port 520 to send and receive packets

Let’s look at the captured request and response packets of RIPv1:

RIPv1_request

RIPv1_response

As we can see from the picture, router broadcasts packets with source and destination port 520. The remaining packet fields of RIPv1:

  • Command – can be request (1) or response (2)
  • Version – can be 1 or 2
  • Address Family Identifier – can be unspecified (0-request for entire routing table) or IPv4 (2-IPv4 response)
  • IP address – destination IP address
  • Metric – hop count

Now we can compare RIPv1 with RIPv2:

RIPv2_request

RIPv2_response

The main differences:

  • RIPv2 is classless routing protocol (Netmask field has been added)
  • RIPv2 uses multicast IP to update routes
  • New fields have been added: Route Tag for imported external routes and Next Hop

Except those differences, RIPv2 supports CIDR, route summarization and authentication. As you can notice from the packet format, there is no separate field for authentication. Authentication uses Address Family Identifier field like below:

RIP authentication

Three timers of RIP
[R1]display rip
Public VPN-instance    
    RIP process : 1
       RIP version   : 2
       Preference    : 100
       Checkzero     : Enabled
       Default-cost  : 0
       Summary       : Enabled
       Host-route    : Enabled
       Maximum number of balanced paths : 32
       Update time : 30 sec              Update time : 30 sec 
       Garbage-collect time : 120 sec 
       Graceful restart  : Disabled
       BFD               : Disabled
       Silent-interfaces : None 
       Default-route : Disabled
       Verify-source : Enabled
       Networks : 
       10.0.0.0           192.168.20.0   
       Configured peers             : None 
       Number of routes in database : 12
       Number of interfaces enabled : 5
       Triggered updates sent       : 16
       Number of route changes      : 30
       Number of replies to queries : 3
       Number of routes in ADV DB   : 10

  Total count for 1 process : 
       Number of routes in database : 12 
       Number of interfaces enabled : 5 
       Number of routes sendable in a periodic update : 60
       Number of routes sent in last periodic update : 14
Relationship between RIP timers

After a router receives an update from its neighbor, Age Time starts counting till 180 sec:

[R1]display rip 1 route 
 Route Flags : R - RIP
               A - Aging, G - Garbage-collect
 ----------------------------------------------------------------------------
 Peer 192.168.20.2 on Serial0/0/0
      Destination/Mask        Nexthop     Cost   Tag     Flags   Sec
     192.168.10.0/24      192.168.20.2      1    0        RA      10
       172.16.0.0/24      192.168.20.2      2    0        RA      10
       172.16.1.0/24      192.168.20.2      2    0        RA      10
       172.16.2.0/24      192.168.20.2      2    0        RA      10
       172.16.3.0/24      192.168.20.2      2    0        RA      10

The router expects to receive the next update after 30 seconds. As soon as it gets it, Age Time is reset and starts counting again.

[R1]display rip 1 route
 Route Flags : R - RIP
               A - Aging, G - Garbage-collect
 ----------------------------------------------------------------------------
 Peer 192.168.20.2 on Serial0/0/0
      Destination/Mask        Nexthop     Cost   Tag     Flags   Sec
     192.168.10.0/24      192.168.20.2      1    0        RA       1
       172.16.0.0/24      192.168.20.2      2    0        RA       1
       172.16.1.0/24      192.168.20.2      2    0        RA       1
       172.16.2.0/24      192.168.20.2      2    0        RA       1
       172.16.3.0/24      192.168.20.2      2    0        RA       1

What will happen if the router is not receiving the expected update after 30 seconds? Let’s try to simulate it.

RIP topology

R1 router believes to receive an update from R2 router after 30 seconds. Accidentally we caused passwords for RIP authentication inconsistent between R1 and R2. In this case R1 is not receiving update from R2. Let’s have a look at RIP routing table of R1:

[R1]display rip 1 route
 Route Flags : R - RIP
               A - Aging, G - Garbage-collect
 ----------------------------------------------------------------------------
 Peer 192.168.20.2 on Serial0/0/0
      Destination/Mask        Nexthop     Cost   Tag     Flags   Sec
     192.168.10.0/24      192.168.20.2      1    0        RA      51
       172.16.3.0/24      192.168.20.2      2    0        RA      51
       172.16.2.0/24      192.168.20.2      2    0        RA      51
       172.16.1.0/24      192.168.20.2      2    0        RA      51
       172.16.0.0/24      192.168.20.2      2    0        RA      51

As you can see, we still have these routes in RIP routing table. Moreover, these networks are still available:

[R1]ping 172.16.1.1
  PING 172.16.1.1: 56  data bytes, press CTRL_C to break
    Reply from 172.16.1.1: bytes=56 Sequence=1 ttl=254 time=40 ms
    Reply from 172.16.1.1: bytes=56 Sequence=2 ttl=254 time=80 ms
    Reply from 172.16.1.1: bytes=56 Sequence=3 ttl=254 time=30 ms
    Reply from 172.16.1.1: bytes=56 Sequence=4 ttl=254 time=80 ms
    Reply from 172.16.1.1: bytes=56 Sequence=5 ttl=254 time=30 ms

  --- 172.16.1.1 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 30/52/80 ms

If the router doesn’t not receive the update during 180 seconds Age Time, it changes Flag to RG and starts counting Garbage-collect time (120 sec):

[R1]display rip 1 route
 Route Flags : R - RIP
               A - Aging, G - Garbage-collect
 ----------------------------------------------------------------------------
 Peer 192.168.20.2 on Serial0/0/0
      Destination/Mask        Nexthop     Cost   Tag     Flags   Sec
     192.168.10.0/24      192.168.20.2     16    0        RG      11
       172.16.3.0/24      192.168.20.2     16    0        RG      11
       172.16.2.0/24      192.168.20.2     16    0        RG      11
       172.16.1.0/24      192.168.20.2     16    0        RG      11
       172.16.0.0/24      192.168.20.2     16    0        RG      11

After Garbage-collect time starts counting, the networks are not available any more but we can still see them in RIP routing table.

[R1]ping 172.16.1.1
  PING 172.16.1.1: 56  data bytes, press CTRL_C to break
    Request time out
    Request time out
    Request time out
    Request time out
    Request time out

  --- 172.16.1.1 ping statistics ---
    5 packet(s) transmitted
    0 packet(s) received
    100.00% packet loss

After the next 120 seconds the entries are to be deleted from RIP database. The whole process of deleting route entry, from RIP routing table, takes 300 seconds.

Of course we can modify the timers for our needs:

[R1]rip
[R1-rip-1]timers rip 10 60 40

[R1-rip-1]display rip
Public VPN-instance    
    RIP process : 1Age time : 60 sec
       Default-cost  : 0
       Summary       : Enabled
       Host-route    : Enabled
       Maximum number of balanced paths : 32
       Update time : 10 sec              Age time : 60 sec 
       Garbage-collect time : 40 sec 
       Graceful restart  : Disabled
       BFD               : Disabled
       Silent-interfaces : None 
       Default-route : Disabled
       Verify-source : Enabled
       Networks : 
       10.0.0.0           192.168.20.0   
       Configured peers             : None 
       Number of routes in database : 12
       Number of interfaces enabled : 5
       Triggered updates sent       : 16
       Number of route changes      : 30
       Number of replies to queries : 3
       Number of routes in ADV DB   : 10

  Total count for 1 process : 
       Number of routes in database : 12 
       Number of interfaces enabled : 5 
       Number of routes sendable in a periodic update : 60
       Number of routes sent in last periodic update : 14

To be honest, RIP is very seldom used but, as it is required for certification, it is worth to touch it a little bit.

Leave a Reply

Your email address will not be published. Required fields are marked *