Default Routes - University of Windsor

Download Report

Transcript Default Routes - University of Windsor

Distance Vector Routing
Using the Hop Count as a Metric
Distance Vector Forwarding
 Also called Bellman-Ford forwarding
 Used for ARPANET routing several years ago
 This category of routers use some concept of route
distance to determine the best path
 In addition to destination network addresses and ports,
distance vector routing tables contain the distance (in hops)
to each network
 Routing tables in distance vector (DV) routing typically
contain a number of routes to a given network address
 If these tables are sorted based on distance vectors (i.e. hop
count), the first entry can be used (shortest distance)
 This distance can propagate from router to router (each
incrementing or decrementing as necessary) when new
networks join
Distance Vector Forwarding
N4
N1
1
N5
R3
3
R1
2
N2
R2
N3
Destination
Distance
Port
N1
0
1*
N2
1
2
N2
2
3
N3
1
2
N3
2
3
N4
1
3
N4
2
2
N5
1
3
N5
2
2
Distance Vector Tables
 DV routing tables are created dynamically
DV routers initialize their routing tables with entries for
networks in which they are directly connected (i.e. zero
distance links)
 Distance is 0, port is the port which connects the router
directly to that network
Periodically, DV routers announce their routing table
entries
 If a neighbouring router R2 is advertising a route for
network N with distance D, we can route to N with
distance (D+1)
 Our routing table will get a new entry for each of these
remote entries
 Distance is D+1, port is the port which connects the
router to R2
Distance Vector Tables
N1
N2
Dest
Distance
Route
N1
0
1
N2
0
2
N3
0
3
1
R1
2
4
3
T1 T1 T1 T1
N4
1
R2
2
3
N3
Dest
Distance
Route
N4
0
1
N5
0
2
N5
Distance Vector Tables
N1
N2
Dest
Distance
Route
N1
0
1
N2
0
2
N3
0
3
1
R1
2
3
4
N4
1
R2
2
N4
0
1
N5
0
2
N1
1
3
N2
1
3
N3
1
3
T2 T2 T2 T2
3
N3
N5
Distance Vector Tables
N1
N2
1
1
N2 0
2
N3 0
3
N4 1
4
N5 1
4
R1
2
3
N3
N1 0
4
N4
1
3
R2
N4
0
1
N5
0
2
N1
1
3
N2
1
3
N3
1
3
2
N5
Distance Vector Tables
Routers share their routing table
information by sending datagrams:
These datagrams contain a number of pairs of
destinations (V) and distances (D)
DV Routing: Conceptual
 Distance Vector routing requires that each router
publicly announce the distance to all its
reachable destinations
 Consider this analogy:
Think of a router as a road intersection in the middle of
nowhere
At this location, several signs are posted indicating the
distance (in kilometres), direction (with an arrow on the
sign), and the name of the destination
These 3 values correspond to hop count, port, and
network address, respectively
DV Routers: Conceptual View
Welcome to Bobton
Population: 1
Whoohoo!
A friend!
Leamington 86 →
Essex 21 ↑
Windsor 46 ←
DV Routing: Conceptual
 Continuing this analogy, routers establish
information the same way you would create
these signposts:
 Travel down each of your paths, and look for
either:
Other signposts: Create a signpost with the same
elements as the other signpost
 Measure the distance to the signpost
 Add that distance to each distance
Towns: Measure the distance, and post it verbatim onto
your signpost
DV Routing: Conceptual
It is possible that two or more directions
could lead to the same destination
In this case, the shortest path is used
Considering our analogy, two streets could
potentially lead to the same town
However, one direction may be a less efficient
route than the other
Clearly, we wish to direct traffic towards the
more efficient route
DV Routing: Conceptual
In this way, routers (and sign builders) only
need to travel down one link in each
direction to gather routing information
Until they either find another router (signpost),
or a destination network (town)
RIP
Routing Information Protocol
RIP
Distance vector forwarding
Employed (but not exclusively) in the
following networks:
IP
IPX
How RIP Works
 Participants on an RIP network are either passive or active
 Active nodes
 Are routers
 They collect routing information from neighbours to build their own
routing tables
 They advertise their own routes (using distance vectors) to other
nodes
 Passive nodes
 Usually hosts or bridges
 They collect routing information from neighbours to build their own
routing tables
 They do not, however, advertise their own routes, because no
datagrams are forwarded through passive nodes
 In other words, passive nodes are the end links in the chain only
How RIP Works
 Passive and active nodes create their routing
tables by listening to RIP response messages
(explained later)
These response messages contain lists of distance
vectors
 When a shorter route (lower distance) is
found, it overwrites the previous route in the
routing table
Equal distances are not overwritten:
 Saves processing time
RIP Packet Format: Version 1
octets
1
command
1
version
2
reserved
2
address family ID
14
address
4
metric
May be repeated
Version has the
value of 1 (for
RIPv1)
Reserved is not
presently utilized
RIP Packets: Command
 Denotes whether the packet is a request
message (1) or a response message (2)
These are the only 2 kinds of packets in RIP
 Requests might be transmitted by routers that
have ‘timed out’ or outdated information
Requests essentially ask for information (i.e. DVs) from
specific (or all) nodes
 Responses might be transmitted in response to
a request
Thus the response messages usually contain a list of
distance vectors
RIP Responses
 Are sent:
In response to a request
 Usually issued by nodes with outdated information or new
nodes
Periodically
 The RIP specification defines that distance vectors should
be publicized every 30 seconds
In response to a change
 If a neighbour (or link to a neighbour) changes (e.g. fails),
a response message is automatically transmitted to
neighbour nodes
RIP Packets: DV Lists
 Can be up to 25 in each packet
 Contain 3 parts:
 Address family ID: Identifier describing that kind of address is
specified
 Address: The address of the node to which this DV refers
 Metric: The distance in some metric (e.g. hop count)
 The large space allocated for addresses (14 octets) can
be used in different ways in networks that have smaller
addresses
 E.g. In IP networks, 2 octets is left unused before the 4 octet
address, and 8 octets is left unused after the address (see page
301 for a more complete picture)
DV Routing Problems: Example
Consider the network shown below:
1
A
1
B
2
1
C
Dest Dist
Port
Dest Dist
Port
Dest Dist
Port
B
1
1
A
1
1
A
2
1
C
2
1
C
1
2
B
1
1
DV Routing Problems: Example
 What happens if we have link failure between B
& C?
 B will realize there is a problem (ignored
messages, etc.), and tries to determine another
route to C
1
A
1
B
2
1
X
C
Dest Dist
Port
Dest Dist
Port
Dest Dist
Port
B
1
1
A
1
1
A
2
1
C
2
1
C
1
2
B
1
1
DV Routing Problems: Example
 B will ask its neighbours (i.e. A), if they can
reach C
 How will A respond?
Look at A’s routing table to find the answer
1
A
1
B
2
Dest Dist
Port
Dest Dist
Port
B
1
1
A
1
1
C
2
1
C
?
?
X
1
C
DV Routing Problems: Example
 A thinks that it can reach C in 2 hops
This path is through B, but that is not known to A
 B will get this information and (falsely) think it
can access C through A
B believes that the path is 3 hops
1
A
1
B
2
Dest Dist
Port
Dest Dist
Port
B
1
1
A
1
1
C
2
1
C
3
1
X
1
C
DV Routing Problems: Example
 Now suppose B has a message for C:
It will send the message to A
 Just as its routing table suggests
A will send the message back to B
This will put the packet into a continuous loop
1
A
1
B
2
Dest Dist
Port
Dest Dist
Port
B
1
1
A
1
1
C
2
1
C
3
1
X
1
C
DV Routing Problems: Example
 This loop could eventually be resolved by network management
protocols, but:
 It takes a while for A and B to realize there is a routing loop
 A will eventually invalidate its route, and use B’s distance vector
(3+1=4) for its new route (it now seems possible to get to C via B)
 A will soon after send out its distance vector
 This will cause B to invalidate its route, and use A’s distance vector
(4+1=5), etc. (to ‘infinity’)
 Once A and B determine that no route is possible the process may
continue backward (if A had other neighbours)
1
A
1
B
2
Dest Dist
Port
Dest Dist
Port
B
1
1
A
1
1
C
2
1
C
3
1
X
1
C
Count to Infinity
The example shows a route towards a
host (destination node) D
D
R1
R2
R3
Network
Count to Infinity
What happens if there is link failure
between R1 and D?
R1 will detect the change and look for
alternative routes
D
X
R1
R2
R3
Network
Count to Infinity
 R2 will advertise that it has a route to D (with
distance 2)
R1 is unaware that this route passes through itself to D
(and as such is invalid)
Because only the distance is advertised (not the link
state), there is no way for R1 to know that R2 does not
have a viable route
D
R1
?
R2
R3
Network
Count to Infinity
 R1 will replace its routing table entry for D with
one pointing to R2 for packets addressed to D
The distance will be 3 (2+1)
The new distance vector is sent to R2
D 3
…
D
R1
?
R2
R3
Network
Count to Infinity
 R2 will replace its routing table entry for D with
one pointing to R1 for packets addressed to D
The distance will be 4 (3+1)
The new distance vector is sent to R1
D 4
…
D
R1
?
R2
R3
Network
Count to Infinity
 R1 will replace its routing table entry for D with
one pointing to R2 for packets addressed to D
The distance will be 5 (4+1)
The new distance vector is sent to R2
…etc… (to ‘infinity’)
D 5
…
D
R1
?
R2
R3
Network
Count to Infinity
 Once infinity is reached, R2 concludes (correctly) that R1
cannot deliver packets to D
 R2 will use the distance vector from R3 to find an
alternative path to D
 If none exists (as in the example below), this process will
propagate backwards to the very source of the message
D
?
R1
R2
R3
Network
Slow Convergence
 Slow convergence describes when this
situation occurs
The routers in the network spend a large amount of
time in an inconsistent state
 Some routers know of the failure, while others do not
 During this time, messages addressed to D are being
lost and/or looping between routers
The routers of the network (as a whole) slowly
converge on the correct configuration to route (or
determine routing impossible) to D
Split Horizon Updates
 One preventative measure for counting to infinity:
 Distance vectors are not transmitted to the same port
where the original distance vector came from, on which this
distance vector is based
 For example
 R1 may advertise a distance vector to D (D,1)
 R2 will receive this distance vector and create its own (D,2)
 R2 will not propagate this distance vector to R1 at any time
 It will, however, propagate it to through all other links
Split Horizon Updates
 Problems:
Information about where distance vectors came from
must be stored in the routing table
It is possible to create the count to infinity problem
using three or more routers in a cycle
 Thus, split horizon is not a complete solution to the
count to infinity problem
Hold Down
 Routers wait before distributing their information about a
disconnected network for a period of time
 For RIP, the distance vectors expire in 180 seconds
 Before this time, routers will continue to forward this data
incorrectly
 After this time, all routers will remove all paths containing the
disconnected link from their routing tables
 Distance vectors are considered out-of-date if the vector is
not retransmitted
 After this time, the new routing information (minus the failed
link) is distributed and new routes are created
 If a route to the new destination is not found at this time, the
routers will not have entries (thus it is unreachable)
Hold Down
Problem:
The routers are expected to wait a long time
(180s)
During this time, routers are in an inconsistent
state
An ideal solution would result in routers
remaining consistent throughout the process
Poison Reverse
 Routers detecting a disconnected host or network keep
its entry, but increase its cost to infinity
 The new distance vector(s) are immediately transmitted
 This prompts all other routers to find an alternative route if
possible
 If no alternative routes are found, the routers will determine the
host to be unreachable
RIP: Count to Infinity Solutions
 Infinity in RIP is 16
This way, the number of messages during count to
infinity is limited
However, it also means that the width of the network
(host to host) must be less than 16
If costs > 1 are to be used, the width must be even less
This imposes a serious restriction on the network size
 Most RIP implementations use split horizon
 However, some RIP implementations use poison
reverse