Professional Documents
Culture Documents
PROTOCOL (RIP)
“DATA NETWORK” FOR JTOs PH-II : RIP
INTRODUCTION
The DARPA Internet Architecture.
Internet Protocols
BRBRAITT March-2007 2
“DATA NETWORK” FOR JTOs PH-II : RIP
Autonomous Systems
BRBRAITT March-2007 3
“DATA NETWORK” FOR JTOs PH-II : RIP
RIP is intended for use within the IP-based Internet. The Internet is organized
into a number of networks connected by gateways. The networks may be
either point-to-point links or more complex networks such as Ethernet or the
ARPANET. hosts and gateways are presented with IP datagrams addressed
to some host. Routing is the method by which the host or gateway decides
where to send the datagram. It may be able to send the datagram directly to
the destination, if that destination is on one of the networks that are directly
connected to the host or gateway. However, the interesting case is when the
destination is not directly reachable. In this case, the host or gateway
attempts to send the datagram to a gateway that is nearer the destination.
The goal of a routing protocol is very simple. It is to supply the information that
is needed to do routing.
This protocol does not solve every possible routing problem. As mentioned
above, it is primary intended for use as an IGP, in reasonably homogeneous
networks of moderate size. In addition, the following specific limitations should
be mentioned
RIP Algorithm
Let's look at what happens when a datagram is sent from one source to a
destination. If the source and the destination are in the same autonomous
system it is delivered by the system's technology. But, if the destination is in
another autonomous system the datagram should be transferred to that
autonomous system. There it will be delivered by that system technology.
routers are the ones that should do the transferring. Therefore, they should
know all the autonomous systems in the supernet. When they receive a
datagram addressed to autonomous system `A' they should transfer it to
`A'. A trivial way to implement a router is having one router that is connected
to all autonomous systems. However this is not practical.
This way requires each router to hold a database of all the possible
destinations. Each entry in the database should hold the next router that
datagrams should be sent to. This way could have worked very well. Alas, the
network cannot be kept still. New routers can be installed Old routers can
BRBRAITT March-2007 4
“DATA NETWORK” FOR JTOs PH-II : RIP
crash. Crashed router can come up. Therefore, our connection through a
router is not guaranteed. Even if the router doesn't crash, a new router may
be installed, providing better service.
d( i , i ) = 0 for any i .
Let D( i , j ) be the cost of the best route from i to j . It is defined for any two
entities i , j .
D( i , i ) = 0 for any i .
The last equation can be proven using induction over the number of steps in
the routes. The metrics can be calculated using a simple algorithm. Entity i
gets its neighbor k to send their estimates of their distance from j . When i
gets the estimates from k , it adds d( i , k ) to each of the numbers. Then i
picks the smallest value. A proof that this algorithm converges to the correct
values of D( i , j ) in finite time, when the network topology does not change.
Very few assumption were made about the order in which the entities send
each other their information. No assumption were made on the initial values of
D( i , j ), except that they have to be non-negative. That means that it is safe
to run the algorithm asynchronously. Entities can send updates by their own
clock. Updates may be dropped, as long as they don't get all dropped.
Because there are no assumptions on the initials values, the algorithm
handles changes. when the topology changes, the system will move to a new
equilibrium using the old one as its starting point.
BRBRAITT March-2007 5
“DATA NETWORK” FOR JTOs PH-II : RIP
always inform others, that it is about to crash. A router can't depend on such
message to warn it.
Therefore a router crash, must be learned in other ways. RIP forces a router
to send update messages every thirty seconds. These messages contain
routes, that that router knows; and their metrics. If a router does not receive
an update message for 180 seconds. from another router. It assumes that
router to be unreachable. This timeout of 180 seconds allow a router to miss
five update messages, without being marked unreachable. This is necessary,
because the media might be unreliable and loose datagrams.
The algorithm so far, sends update messages every thirty seconds. Every
update message contains a list of the autonomous system the routers knows
to reach and their metrics. If the metric in an update message is lower than
the metric in the router 's table, the router would update the metric and the
next hop fields in its table. If for some destination, an update had come from
the next hop, indicating a different metric, then the metric in the table should
be changed. This is necessary because if the metric changes in the next hop,
we must change the metric in our router, as well. This guarantees correct
performance, but not good enough. Consider this case:
BRBRAITT March-2007 6
“DATA NETWORK” FOR JTOs PH-II : RIP
All links have cost of 1, except for the direct link from C to B which has cost
10. Each router will have a table showing the next hop and the metric for each
destination. We're interested only in the connection to the target network.
Now suppose that the link from B to D fails. The routes should adjust to use
the link from C to D . Unfortunately it will take quite a while for this to happen.
The routing changes start when B notices that the route to D is no longer
usable. The chart below assumes that all router s send updates at the same
time. the chart shows the metrics for the target.
time --->
B : unreachable | C , 4 | C , 5 ....
C: B, 3 | A,4| A,5
A: B, 3 | C,4| C,5
The problem is that A and C both believe they can connect to the target
through each other. It happened because they sent messages indicating they
can connect to the target at cost of 3. When they received the message from
B saying that the target is unreachable, they received another message. The
second message said they can connect to the target in cost of 3. This cost is
of course not true, because the link from B to D is unusable. Since A and C
don't know that the route from each other uses another link that is no longer
usable, they would both update their tables to point at each other. Since, they
increase the metric by one, they will both report that the cost is now four.
Since A uses C as next connection, and C signals that the cost had change, A
would change the cost of the link. Same thing would happen to C . This way
the cost of the connection will slowly rise. The worst case is when the target is
really unusable, and then the cost will rise up to infinity. This effect is called
'counting to infinity'. This is why infinity was chosen to be such a small
number. If some autonomous system becomes completely unreachable, we
would like the counting to be over as soon as possible.
There are several ways to prevent this from happening. The ones that RIP
uses are called 'split horizon with poison reverse' and 'triggered update'.
BRBRAITT March-2007 7
“DATA NETWORK” FOR JTOs PH-II : RIP
Split horizon.
Notice that the problem above is caused because both A and C deceive each
other. They both claim they have a connection. Since they both think they can
connect through each other, a real link is not established. This could have
been prevented if A hadn't told C that it can connect to the target. Generally, it
is not useful to claim reachability for a destination to the neighbor from which
the route was learned. The "simple split horizon" omits routes learned from
one neighbor in updates to that neighbor. "split horizon with poisoned reverse"
include those routes but with cost of infinity.
In general, split horizon with poisoned reverse, is safer than simple split
horizon. If two routers point at each other, advertising reverse routes with
metric of 16 will brake the loop immediately. If the reverse routes are simply
omitted, those routes will have to be eliminated by waiting for a timeout. Alas,
poisoned reverse increases the size of the messages. Consider the case of a
campus backbone connecting many buildings. Each building has a router. In
simple split horizon only the network that is connected to the router is included
in the updates messages. In split horizon with poisoned reverse, ALL
networks learned must be published as well.
Implementors may use simple split horizon if they like. Or they can offer a
configuration option, to allow the system manager to choose which way to
use. It is also possible to advertise some reverse routes with metric of sixteen,
and omit others.
Triggered updates
Split horizon with poisoned reverse will break any loop of two router s.
However, it is still possible for loops of three or more router s, to occur. A may
think it can reach the target through B . B may think it can reach the target
through C . C may think it can reach the target through A . This loop will break
only when infinity will be reached. Triggered updates are an attempt to speed
up this convergence. To imply triggered updates, we simply add a rule that
whenever a router changes the metric of a route, it is required to send update
messages almost immediately. The triggered update messages will be sent
even if it is not time to the regular update message. Consider a case were G
can connect to a target network, and then its link becomes unusable. G will
send its neighbor updates about the change. Its neighbors will update their
tables if necessary. The ones that updated their tables will send their own
update messages. Some of the neighbors' neighbors will update their tables,
and send their own update messages. The update messages will propagate
back, until they reach a portion of the network that uses another route to
connect to the target.
BRBRAITT March-2007 8
“DATA NETWORK” FOR JTOs PH-II : RIP
If the system could be made to stay still while the update messages
propagate back, it had been possible to prove that counting to infinity would
never happen. A bad router will be removed from the tables, using update
messages. Alas, this is not the case. While the triggered updates are being
sent, regular updates can be sent, from router who hasn't got the update yet.
Their update will indicate that the target is still reachable. It is possible that a
router will receive a false regular update saying the target is reachable, after it
received a triggered update saying the target is unreachable. This could
reestablish a connection incorrectly. Triggered updates reduce the chance to
get counting to infinity, however this can still happen.
IP ADDRESS
UNUSED (SET TO ZERO’S)
UNUSED (SET TO ZERO’S)
METRIC
The portion of the datagram from address family field through metric may
appear up to 25 times. IP address is the usual 4-octet Internet address, in
network order. The special address 0.0.0.0 is used to describe a default route.
The address family identifier for IP is 2. The metric field must contain a value
between 1 and 15 inclusive, specifying the current metric for the destination,
or the value 16, which indicates that the destination is not reachable. The
maximum datagram size is 512 octets. (IP or UDP headers not counted)
Every datagram contains a command, a version number, and possible
arguments.
Here is a summary of the commands implemented in version 1 of RIP:
BRBRAITT March-2007 9
“DATA NETWORK” FOR JTOs PH-II : RIP
1. request A request for the responding system to send all or part of its
routing table.
2. response A message containing all or part of the sender's routing table.
This message may be sent in response to a request or poll, or it may
be an update message generated by the sender.
3. traceon Obsolete. Messages containing this command are to be
ignored.
4. traceoff Obsolete. Messages containing this command are to be
ignored.
5. reserved This value is used by Sun Microsystems for its own purposes.
If new commands are added in any succeeding version, they should
begin with 6. Messages containing this command may safely be
ignored by implementations that do not choose to respond to it.
Addressing considerations
The RIP packet formats do not distinguish among various types of address.
Fields that are labeled "address" can contain any of the following:
• host address
• subnet number
• network number
• 0, indicating a default route
"Border" gateway s send only a single entry for the network as a whole to host
s in other networks. This means that a border gateway will send different
information to different neighbors. For neighbors connected to the subnetted
network, it generates a list of all subnets to which it is directly connected,
using the subnet number. For neighbors connected to other networks, it
makes a single entry for the network as a whole, showing the metric
associated with that network. (This metric would normally be the smallest
metric for the subnets to which the gateway is attached.)
Timers
There are two timers associated with each route, a "timeout" and a "garbage-
collection time". Upon expiration of the timeout, the route is no longer valid.
However, it is retained in the table for a short time, so that neighbors can be
notified that the route has been dropped. Upon expiration of the garbage-
collection timer, the route is finally removed from the tables.
BRBRAITT March-2007 10
“DATA NETWORK” FOR JTOs PH-II : RIP
The timeout is initialized when a route is established, and any time an update
message is received for the route. If 180 seconds elapse from the last time
the timeout was initialized, the route is considered to have expired, and the
deletion process which we are about to describe is started for it.
Deletions can occur for one of two reasons: (1) the timeout expires, or (2) the
metric is set to 16 because of an update received from the current gateway .
(See response command for a discussion processing updates from other
gateway s.) In either case, the following events happen:
- The metric for the route is set to 16 (infinity). This causes the route to be
removed from service.
- A flag is set noting that this entry has been changed, and the output process
is signalled to trigger a response.
Until the garbage-collection timer expires, the route is included in all updates
sent by this host , with a metric of 16 (infinity). When the garbage-collection
timer expires, the route is deleted from the tables.
Input processing
After checking the version number and doing any other preliminary checks,
processing will depend upon the value in the command field.
BRBRAITT March-2007 11
“DATA NETWORK” FOR JTOs PH-II : RIP
Output processing
Let describe the processing used to create response messages that contain
all or part of the routing table. This processing may be triggered in any of the
following ways
Triggered updates require special handling for two reasons. First, experience
shows that triggered updates can cause excessive loads on networks with
limited capacity or with many gateway s on them. Thus the protocol requires
that implementors include provisions to limit the frequency of triggered
updates. After a triggered update is sent, a timer should be set for a random
time between 1 and 5 seconds. If other changes that would trigger updates
occur before the timer expires, a single update is triggered when the timer
expires, and the timer is then set to another random value between 1 and 5
seconds. Triggered updates may be suppressed if a regular update is due by
the time the triggered update would be sent.
Second, triggered updates do not need to include the entire routing table. In
principle, only those routes that have changed need to be included. Thus
messages generated as part of a triggered update must include at least those
routes that have their route change flag set. They may include additional
routes, or all routes, at the discretion of the implementor; however, when full
routing updates require multiple packet s, sending all routes is strongly
discouraged. When a triggered update is processed, messages should be
generated for every directly-connected network. Split horizon processing is
done when generating triggered updates as well as normal updates.
If, after split horizon processing, a changed route will appear identical on a
network as it did previously, the route need not be sent; if, as a result, no
routes need be sent, the update may be omitted on that network. (If a route
had only a metric change, or uses a new gateway that is on the same network
as the old gateway , the route will be sent to the network of the old gateway
with a metric of infinity both before and after the change.) Once all of the
triggered updates have been generated, the route change flags should be
cleared.
BRBRAITT March-2007 12
“DATA NETWORK” FOR JTOs PH-II : RIP
The only difference between a triggered update and other update messages
is the possible omission of routes that have not changed. The rest of the
mechanisms about to be described must all apply to triggered updates.
The IP source address must be the sending host 's address on that network.
This is important because the source address is put into routing tables in
other host s. If an incorrect source address is used, other host s may be
unable to route datagram s. Sometimes gateway s are set up with multiple IP
addresses on a single physical interface. Normally, this means that several
logical IP networks are being carried over one physical medium. In such
cases, a separate update message must be sent for each address, with that
address as the IP source address.
If the route passes these tests, then the destination and metric are put into the
entry in the output datagram . Routes must be included in the datagram even
if their metrics are infinite. If the gateway for the route is on the network for
which the datagram is being prepared, the metric in the entry is set to 16, or
the entire entry is omitted. Omitting the entry is simple split horizon. Including
an entry with metric 16 is split horizon with poisoned reverse.
RIP Version 2
BRBRAITT March-2007 13
“DATA NETWORK” FOR JTOs PH-II : RIP
Recently, RIP version 2 became the standard version of RIP, and the original
RIP is now historic.
8B + 4B + 25x20B = 512 B
The Command, Address Family Identifier (AFI), IP Address, and Metric all
have the same meanings as in RIP 1. The Version field specifies version
number 2 for RIP datagrams which use authentication or carry information in
any of the newly defined fields.
BRBRAITT March-2007 14
“DATA NETWORK” FOR JTOs PH-II : RIP
The Routing domain field enables some routing domains inter-work upon the
same physical infrastructure, while logically ignoring each other. This gives
the ability to simply implement various kinds of policies. There is a default
routing domain which is assigned the value '0'.
The Route Tag (RT) field exists as a support for EGP's. This field is expected
to carry Autonomous System numbers for EGP and BGP. RIP systems which
receive RIP entry which contains a non-zero RT value must re-advertise that
value.
The Subnet Mask field contains the subnet mask which is applied to the IP
address to yield the non-host portion of the address. If this field is zero, then
no subnet mask is included for this entry.
Next Hop is the immediate next hop IP address to which packets to the
destination specified by this route entry should be forwarded. The purpose of
the Next Hop field is to eliminate packets being routed through extra hops in
the system. It is particularly useful when RIP is not being run on all of the
routers on a network.
RIP 2 is totally backwards compatible with RIP 1. Its applications support fine
tuning to be RIP 1 emulation, RIP 1 compatible, or fully RIP 2.
BRBRAITT March-2007 15