Chapter 2 Advanced Routing for FortiOS 5.0 : Routing Information Protocol (RIP) : RIP background and concepts : How RIP works : RIP packet structure
  
RIP packet structure
It is hard to fully understand a routing protocol without knowing what information is carried in its packets. Knowing what information is exchanged between routers and how will help you better understand the RIP protocol, and better configure your network for it.
This section provides information on the contents of RIP 1 and RIP 2 packets.
RIP version 1
RIP version 1, or RIP IP packets are 24 bytes in length, with some empty areas left for future expansion.
Table 10: RIP IP packets
1-byte command
1-byte version
2-byte zero field
2-byte AFI
2-byte zero field
 
4-byte IP address
4-byte zero field
4-byte zero field
4-byte metric
A RIP 1 packet contains the following fields:
Command — Indicates whether the packet is a request or a response. The request asks that a router send all or part of its routing table. The response can be an unsolicited regular routing update or a reply to a request. Responses contain routing table entries. Multiple RIP packets are used to convey information from large routing tables.
Version — Specifies the RIP version used. This field can signal different potentially incompatible versions.
Zero field — This field defaults to zero, and is not used by RFC 1058 RIP.
Address-family identifier (AFI) — Specifies the address family used. RIP is designed to carry routing information for several different protocols. Each entry has an address-family identifier to indicate the type of address being specified. The AFI for IP is 2.
IP Address — Specifies the IP address for the entry.
Metric — This is the number of hops or routers traversed along the route on its trip to the destination. The metric is between 1 and 15 for that number of hops. If the route is unreachable the metric is 16.
RIP version 2
RIP version 2 has more features than RIP 1, which is reflected in its packets which carry more information. All but one of the empty zero fields in RIP 1 packets are used in RIP 2.
Table 11: RIP 2 packets
1-byte
command
1-byte
version
2-byte
unused
2-byte
AFI
2-byte
route tag
4-byte IP address
4-byte
subnet
4-byte
next hop
4-byte metric
A RIP 2 packet contains fields described above in RIP 1, as well as the following:
Unused — Has a value set to zero, and is intended for future use
Route tag — Provides a method for distinguishing between internal routes learned by RIP and external routes learned from other protocols.
Subnet mask — Contains the subnet mask for the entry. If this field is zero, no subnet mask has been specified for the entry.
Next hop — Indicates the IP address of the next hop to which packets for the entry should be forwarded.