IP/RIP

droppercauseNetworking and Communications

Oct 28, 2013 (3 years and 7 months ago)

212 views

IP/RIP



RIPv1


RIP was originally developed by Xerox and was called
Gateway Info (GWInfo)

it then developed into
Routed

which you will within the Unix environment. RIP v1 is
described in
RFC
1058
. RIP is a Distance Vector protocol
and uses the Bellmann
-
Ford algorithm for determining the
best route. Other distance vector routing protocols include
IPX RIP, AppleTalk RTMP and IGRP (Inter
-
Gateway
Routing Protocol). There are also other routing pr
otocols
such as OSPF, IPX NLSP (Netware Link State Protocol
and IS
-
IS (Intermediate System to Intermediate System)
which are known as
Link
-
State

routing protocols i.e. they
are concerned with sharing the status of links in their
updates rather than complet
e routing table information.
OSPF tends to be limited to around 1000 routers whereas
IS
-
IS can scale much larger. Ciscos EIGRP (Enhanced
IGRP) is often called a 'hybrid' but is more strictly a Diffuse
Up Algorithm (DUAL). BGP (Border Gateway Protocol) is
n
ot really a routing protocol at all, it is more accurately
described as a Path Vector protocol.


In a RIP v1 environment all subnet masks throughout the
network must be the same therefore limiting addressing
schemes somewhat. This is because RIP v1 is a
C
lassful

routing protocol, it does not have the ability to transmit the
subnet mask within its updates. RIP v1 imposes the
subnet mask on the inbound interface and this is normally
defined by the engineer. Learned routes are entered into
the routing table w
ith their natural mask. As a result there
can be a great waste of internet host addresses. This can
be rectified by using RIP v2 (see later) or OSPF which are
able to implement
Variable Length Subnet Masks
(VLSM)
. They can do this because they
can

transmit

the
subnet mask within their routing updates and these
protocols are known as
Classless

routing protocols.


The following diagram shows a restriction on using RIP:




Fo
r routing updates being sent from router A about
network 131.108.10.0/24, router B resorts to assigning the
natural Class B mask to the network entry in the routing
table. Router B therefore sees a split network since
131.108.0.0 also exists on its own LAN

interface.


Similarly:




Although this network will route correctly as it stands in a
RIP environment, the problems arise if the link between A
and B fails, because the

131.108.0.0 network will split.


Consider the following scenario:




In a RIP environment, if router C routes the first packet
and then switches the rest, then for some
conversations
the link to 131.108.0.0 will work very well and for others
the link to 131.108.0.0 will fail. This is because the Class B
network 131.108.0.0 is split across two routes even
though locally the masks are class C for the subnets. The
networks 2
22.1.1.0 and 222.1.2.0 are two separate Class
C networks anyway. In an IGRP environment, because
IGRP load balances across equal cost paths, the users
will have a slower network since TCP will resend the
dropped packets.


Subnets


When creating subnets, t
he mask determines which
portion of the IP address is used for the subnet address
and which is used for the host address. For example, in
the mask 255.255.255.0, the first three octets consist of all
1's whilst the last octet contains 0's, the mask is ANDe
d to
the incoming IP address and the host part is separated out
in the AND operation and is considered to be a local
interface address. When sizing a subnet, the formula used
is
2
n

-

2 = number of available subnets or hosts

(where
'n' is the number of bits

used). For further discussion on IP
addressing, CIDR and VLSM refer to
IP Addressing

and
CIDR
.


RIP v1 Operation


RIP v1 uses UDP port 520 for sending an
d receiving
broadcast messages.


The RIP v1 packet is illustrated below:




The
Command

field can have one of the following
commands:



Request




Response




Traceon

(no long
er used)



Traceoff

(no longer used)



Reserved

(used by Sun Microsystems)

Each route is identified in the fields from the
Address
Family Identifier

onwards. There can be up to 25 routes
in one RIP packet.


There are two RIP message types
Request Messages

and
Response Messages
. A router requests an update
when it first joins a network and all routers respond with
Response Messages containing the routes. Response
Messages are sent anyway every 30 seconds by default.
Triggered updates

occur when there has bee
n a change
and these triggered updates just contain the changes and
help with quicker network convergence.


IP routing protocols submit their best routes for each
destination to the Router Table Manager (RTM). The RTM
then builds the Routing Table and inc
ludes all the locally
configured interfaces (i.e. on the router itself) and any
static routes that might have been configured. In addition
to the Routing Table, identical copies of which sit on each
slot; there is also a Forwarding Table which acts as a
ro
ute cache for the IP datagrams. This Forwarding Table
is used to hold the most recent and commonly used
datagrams so saving the need to go through the complete
Routing Table every time and this can be of a configurable
size, depending on the memory availab
le. IP global and
interface parameters are maintained within the
Management Information Base (MIB) which is mainly used
by external SNMP clients which view and change these
parameters.


The same IP route information can come from different
interfaces, rou
ting protocols or static routes, and since
only one entry for a particular destination is allowed, the
RTM makes the decision as to which route goes into the
table based on the Route Preference (which can be
configured), or failing that, the Route Weight (
which is not
configurable). RIP is not sensitive to line speed instead it
calculates the best routes by way of 'hops' (or 'metric') or
'ticks' (which is time). If the router receives a change to the
reachability of a route and it is worse than the informat
ion
that it already has in the Routing Table then it will only
update this information if it receives the information from
the original sender.


The maximum number of hops allowed is 15. Once the
hop count reaches 16 then the network becomes
unreachable.
A directly connected network has a hop of 1.
RIP updates (containing up to 25 entries each) are sent
every 30 seconds. Cisco have introduced a time variance
for these updates of between 25.5 and 30 seconds. This is
to stop
RIP_JITTER

where on Ethernet netw
orks RIP can
get sent at the same time causing
update
synchronisation

so making the network very busy every
30 seconds.


To help eliminate routing loops and unnecessary RIP
updates two techniques are employed.
Split Horizon

can
be set so that two connecte
d routers do not send each
other routes that have been learned via their connected
interfaces, there is no point since the other router must
know these routes.
Poisoned Reverse

sends the routes
learned but with a hop count of 16 indicating the network
to b
e unreachable via that interface. This helps defeat
larger routing loops.


Default Route


A default route, which has a mask of 0.0.0.0 will yield a
destination network of 0.0.0.0 when any IP datagram is
ANDed with the mask. The result of this is that if i
t cannot
find a match within the routing table then it uses the next
hop address defined by the 0.0.0.0 destination address.
Configuring a default route causes a certain amount of
traffic overhead.


RIP and Subnet Masking


RIP updates are sent to RIP conf
igured updates every 30
seconds and this update contains all known networks and
their hop counts, no mask information is included. In this
RIP packet 8 bytes, out of the possible 16, are unused so
50% of the bandwidth is wasted. A router will not advertise

a subnetwork out of an interface that does not belong to
that network, what it does do is advertise the natural
portion of the address e.g.




In the above diagram router

A has two subnetworks,
149.213.128.0 and 149.213.192.0 with a subnet mask of
255.255.248.0, however router B cannot see these
subnetworks because no mask information is received
with RIPv1, instead it advertises a network of 149.213.0.0
with a natural mas
k of 255.255.0.0. If the advertised
network belongs to the subnetwork of the interface on
which it was received, then that interface mask is
associated to that advertised network. Equal cost paths to
the same network are handled by the router using the fir
st
one that it learned.


There are three timers that RIP uses:



Expiration Timer

-

This 'Invalid timer' is set when a
route is first added to a routing table and whenever
an update arrives for that same route.



Flush Timer

-

This 'Garbage timer' starts if

the
Expiration timer reaches 180 seconds. The Garbage
Timer runs for 60 seconds and then deletes the route
if no update occurs.



Holddown Timer

-

When an update for a route
appears with a higher metric than the current route in
the table, the Holddown Tim
er prevents changes to
the table until it times itself out thereby maintaining
stability in the routing table if routes are 'flapping'.
This stops routes to failed networks being re
-
introduced by routers that have yet to find out.

If information about a n
etwork is not received within 90
seconds (default value) then the metric is set to 'U' (in the
TI) or '
-
1' (Site Manager). The network is removed from
the routing table if no information is received after 180
seconds.


Unnumbered IP links


Unnumbered IP i
nterfaces can be configured for use on
point to point links as a way of conserving network
address space. An address of 0.0.0.0 is used, along with a
mask of 0.0.0.0, an associate address parameter is used
as the source address for anything transmitted out

of that
interface. This associate address has to be an IP address
of one of that router's interfaces. No pinging or ARPing is
done on or through this unnumbered interface and RIP
decisions are based on the mask of the associated
address. One use of the un
numbered IP interface would
be as a link to another manufacturer's router (such as
Cisco) which also has an unnumbered interface.


IP Multinetting


IP multinetting can be achieved by adding subnets to the
same interface, normally this is necessary because

a LAN
has been inherited and resubnetting is out of the question
due to all the IP address changes that would have to be
changed. In an ideal world multinetting should be avoided
because the router interface has to work hard routing
between subnets on the

same interface. Using RIP v2 and
OSPF allows variable subnets to be used and, if carefully
planned, should allow the configuration of single subnets
with masks allowing enough hosts per subnet.


RIP Accept Policies


RIP Accept Policies can be configured
to perform any of
the following:



Listen to RIP updates from certain routers




Listen only for specific networks




Alter the advertised metric of a network




Assign a specific mask to be included with a
network in the routing table




Change the preference metr
ic of a route


An example of a use for an Accept Policy would be to
prevent users connected to a router B from accessing
networks off a router A, the Accept Policy would be
configured on router B. The result of this policy would also
prevent users on route
r A from accessing these networks
on router B, this is because, although they could reach the
router, they could not get a response back. RIP Accept
Policies are configured globally on the router and if there
are several policies configured a Rule Preceden
ce
parameter can be set so that if a RIP update comes along
with contents matching more than one policy, the policy
with the highest precedence takes priority.


RIP Announce Policies


RIP Announce Policies can be configured to do any of the
following:



Pa
ss on certain routes out of particular interfaces




Automatically create a default route




Pass on routes learned from particular gateways




Pass on routes learned from particular interfaces


An Announce Policy could be used, for instance, exclude
a couple of

subnetworks on router A from the routing
tables of all the other routers within the network, thereby
isolating them from the rest of the network.


When configuring the networks involved in either Accept
or Announce Policies, the match criteria could be '
exact' or
'range'. When range is selected it is worth noting that the
network address, say 153.17.12.0, becomes the lowest
address in a range of addresses limited by the mask. So in
our example, if the mask is 255.255.0.0 then the upper
limit of the range
of addresses would be 153.17.255.255.
Another item worth noting is the Route Source parameter;
the hexadecimal value entered is the SUM of the codes
used to represent each routing protocol used for
contributing the route.


RIP v2


The latest RFC for RIP v
2 is
RFC 1723

and replaces
RFC
1388
.


The following features are additional to those found within
RIP v1:



Authentication:

A si
mple password of up to 128
characters can be used to verify legal IP datagrams
between RIP v2 configured router interfaces. This
helps in preventing hackers making use of erroneous
updates. The
Address Family Identifier

is set to a
specific value and is re
ad to check authenticity.



Route Tags




Subnet Mask:
Each network entry within the RIP
update has it's subnet mask included so accurate
routing information can be included within the routing
tables and a RIP v2 router advertises all known
subnetworks out an

interface not belonging to that
subnetwork. Different subnet masks can be
configured throughout the whole network without
confusing the routers, address space no longer
needs to be wasted as subnet mask sizes can be
adjusted to accommodate different netwo
rk sizes.



Multicasting:
RIP v2 updates are multicast to
224.0.0.9 (class D) so RIP v2 routers share
information independently from other routers.

The RIP v2 packet is illustrated below:




Extensions to RIP are detailed in
RFC 2091

and include
triggered RIP updates which were designed to allow RIP
to run over dial circuits. Only when a route changes would
RIP

send a routing update, thereby minimising the number
of calls required to maintain the routing table.