The Routing Information Protocol or RIP is one of the oldest distance vector routing protocols that is still in use. RIP version 1 (RIPv1) is destined as an interior routing protocol and is defined in RFC1058.
RIPv1 is a classful routing protocol, hence cannot function with CIDR based networks. However, a number of extensions were added in version 2 of the protocol (RIPv2), turning it into a classless routing protocol (whilst adding a number of other features/improvements). We will return to RIPv2 in the following lecture. A third variant - RIPng - exists to support IPv6 based networks, which we will address later in the subject.
Since RIPv1 is a classful routing protocol it expects to operate with
classful networks and subnet masks. This will quickly become evident when
working with RIPv1 and routers that are configured with no ip
classless.
Since RIPv1 is a distance vector based routing protocol, its operation is fairly simple. Two message types are defined - a RIP Request and a RIP Response. A request message solicits an immediate response from neighbouring routers and is sent when RIP is first started on a router. This enables it to quickly populate its routing table without waiting for the next update period. A request may specify a particular network, or simply request the entire routing table.
Response messages simply contain a list of networks which are reachable via the sending router, along with the metric for each network. In the case of RIP, the metric is simply the number of hops to reach the network.
All RIPv1 messages are sent via the use of UDP datagrams, with a source and destination port of 520 (0x0208). The UDP datagram is in turn encapsulated within an IP datagram that is sent to the IPv4 limited broadcast address (255.255.255.255). The exception to this is when a response is sent as an answer to a request message - in this case the IPv4 datagram is sent to the requesting router's IPv4 unicast address and the UDP destination port matches the source port of their request.
Since RIPv1 is a distance vector based routing protocol, it periodically broadcasts a full copy of its routing table to neighbouring routers. By default, RIP will send an update in the form of an unsolicited RIP response message every 30 seconds.
RIP routers typically implement four timers:
A RIP response message consists of a RIP header, followed by one or more RIP route entries (up to a maximum of 25). Each route entry consists of a 20 byte record that specifies a reachable network along with its metric:
#define AF_INET in
socket.h on a nearby Unix system).
The following is a RIPv1 response message captured "off the wire" from a nearby network, minus the link-level header - the IP and UDP encapsulation however remain intact:
45c0 0034 0000 0000 0211 a9fd 0a01 03fc ffff ffff 0208 0208 0020 0000 0201 0000 0002 0000 0a01 0100 0000 0000 0000 0000 0000 0001
On receipt of a RIP response message:
Commands to be entered in Configuration Mode:
R1(config)# R1(config)#interface Ethernet0/0 R1(config-if)#ip address 192.168.1.254 255.255.255.0 R1(config-if)#no shutdown R1(config-if)#exit R1(config-if)# R1(config)#interface Ethernet1/0 R1(config-if)#ip address 192.168.2.254 255.255.255.0 R1(config-if)#no shutdown R1(config-if)#exit R1(config)#
R1(config)#ip routing
R1(config)# R1(config)#router rip R1(config-router)#network 192.168.1.0 R1(config-router)#network 192.168.4.0 R1(config-router)#exit R1(config)#
Back in Privileged Mode:
R1#copy running-config startup-config
As discussed in our previous lecture, a number of inherent design flaws in the distance vector routing process can lead to instability and routing loops. RIP implements several techniques in order to combat these issues:
In certain circumstances it is necessary (or preferred) to only listen to RIP messages and not send them - usually this is selected on a per interface basis and is known as being in Passive Mode.
RIP can be instructed to operate passively on an interface via the following commands (entered in Configuration Mode):
R1(config)#router rip R1(config-router)#passive-interface Ethernet0/0
This will prevent RIP messages from being sent out via the
Ethernet0/0 interface, however the router will still process
RIP messages received on this interface - preventing this would require
a distribute-list (see later lecture).
Since RIP only uses the hop count as a metric, in a mixed network a wrong routing decision may result (ie. a faster preferred path with more hops will be less preferred over a slower path with less hops). This can be combatted by manually adjusting the metric for specific routes.
This is implemented using an offset-list which links an
access list with an interface and metric increment:
R1(config)#access-list 10 permit 192.168.1.0 R1(config)#! R1(config)#router rip R1(config-router)#network 192.168.1.0 R1(config-router)#network 192.168.2.0 R1(config-router)#offset-list 10 in 2 Ethernet0/0
This instructs the router to examine all RIP response messages received on
Ethernet0/0 - if the response message advertises a route which
matches 192.168.1.0 (ie. the permit in the access list) then increment the
hop count by 2.