Você está na página 1de 15

1

Local Local Local Local & && & Metropolitan Metropolitan Metropolitan Metropolitan
Area Networks Area Networks Area Networks Area Networks
ACOE322
Lecture 6
Routing
2
Overview
- The main function of the network layer is routing
packets from the source to the destination
machine.
- The only exception is for broadcasting networks
-!n broadcasting routing a packet is sent simultaneously
to all destinations
-Still routing is an issue if the source and destination are
not on the same network
3
Routing algorithm
- How to find the best path from A to F?
- How does R1 chooses the best route to R+?
- The routing algorithm is that part of the network layer
software responsible for deciding which output line an
incoming packet should be transmitted on.
A
B
C
D
E
F
R1
R2
R3
R4
source
router
destination
router
4
Routing & forwarding
- Not the same thing!
- Routing means filling in and updating the routing
tables
- Forwarding means handling the packets based
on routing tables
- Routing differs in datagram and virtual-circuit
networks
5
Routing - properties
Certain properties are desirable in a routing algorithm:
1. correctness
2. simplicity
3. robustness
- updating possibility
- should cope with changes in the topology and traffic
+. stability
- must converge to equilibrium
5. fairness
6. optimality
- min mean packet delay
- max total network throughput
- 5 8 6 often contradictory
6
Routing algorithms
- DYNAMIC {adaptive)
- change routing decisions to reflect changes in the topology
- adapt for changes in the traffic (load change)
- ALGOR!THNS: where routers get the information from?
- locally
- from adjacent routers
- from all routers
- ALGOR!THNS: when they change their routes?
- every T sec
- when the load changes
- when topology changes
- STATIC {non-adaptive)
- routes computed in advance
- node failures, current load etc. not taken into account
- Note that both adaptive 8 non-adaptive algorithms can be
either load-sensitive or load-insensitive
7
Global & decentralized
routing algorithms
1. Global routing algorithm
- least-cost path calculated using global knowledge about
network
- input: connectivity between all nodes 8 link costs nodes
- Link-state algorithms
2. Decentralized routing algorithm
- least-cost path calculated in an iterative, distributed manner
- no node has complete info about the cost of all network links
- begins with cost of directly attached links
- info exchange with neighbouring nodes
- Distance-vector algorithms
8
Determining the path
- Build a graph of the subnet:
-each router represented by a node
-node connected by a link (communication line)
2
1
3
2
3
1
2
1
5
5
A
D E
F
C B
cost: number of hops, geographic distance in km, queuing delay,
transmission delay, bandwidth, reliability, price
least-cost path the minimum sum of the cost of the links
shortest path crossing the smallest number of links
9
8tatic algorithms
- Shortest Path routing
-Dijkstra's algorithm
-computes the least-cost path (route) from one node to
all the other nodes
- Flooding
-Computes the shortest path (route) from one node to all
the other nodes (inverse tree)
10
8hortest Path routing {1}
- Netrics (criteria for routing)
-Distance
- path length = the number of hops
- Geographic distance in km
-Bandwidth
-Delay
-Average traffic
-Communication cost
-Nean queue length
-Neasured delay
- By changing the weighting function, the algorithm can
compute the shortest" path measured according to any one
of a number of criteria or to a combination of criteria
11
8hortest Path routing {2}
- Best known algorithm to compute the shortest
path between two nodes is Dijkstra (1959)
-Each node is labeled with its distance from the source
node along the best known path
-!nitially, no paths are known, so all nodes are labeled
with infinity
-As the algorithm proceeds and paths are found, the
labels may change, reflecting better paths
-A label may be either tentative or permanent
- !nitially all labels are tentative
- When it is discovered that a label represents the shortest
possible path from the source to that node, it is made
permanent and never changed thereafter
12
How labeling works {1}
A
B
E
C
D
F
H G
2
6
7
2
1
4
3
3
2 2
- The weights represent, for example, distance
- We want to find the shortest path from A to D
- We start by marking node A as permanent (filled-in circle)
- Then we examine each of the nodes adjacent to A, relabeling each
one with the distance to A
2
13
How labeling works {2}
A
B (2, A)
E(,-)
C (,-)
D(,-) F(,-)
H(,-) G(6,A)
2
6
7
2
1
4
3 3
2 2
- Whenever a node is relabeled we also label it with the node from
which the probe was made so that we can reconstruct the final path
later
- Then we examine all the tentatively labeled nodes and make the one
with the smallest label permanent. This one becomes the new
working node (B, in this case)
- We now start at B and examine all nodes adjacent to it.
- !f the sum of the label on B and the distance from B to the node
being considered is less than the label on that node, we have a
shorter path, so the node is relabeled
2
14
How labeling works {3}
A
B (2, A)
E(4,B)
C (9,B)
D(,-) F(,-)
H(,-) G(6,A)
2
6
7
2
1
4
3 3
2 2
- After all nodes adjacent to the working node (B) have been inspected
and the tentative labels changed if possible, then a search is made to
find the tentatively-labeled node with the smallest value
- This node is made permanent and becomes the new working node
for the next round (node E)
2
15
How labeling works {4}
A
B (2, A)
E(4,B)
C (9,B)
D(,-) F(6,E)
H(,-) G(5,E)
2
6
7
2
1
4
3 3
2 2
A
B (2, A)
E(4,B)
C (9,B)
D(,-) F(6,E)
H(9,G) G(5,E)
2
6
7
2
1
4
3 3
2 2
A
B (2, A)
E(4,B)
C (9,B)
D(,-) F(6,E)
H(8,F) G(5,E)
2
6
7
2
1
4
3 3
2 2
The process repeats
until the shortest path
is found, which is
A-B-E-F-H-D
2
2
2
16
A
B
D
C
E
G
F
H
Flooding {1}
- Another static algorithm
- Every incoming packet is sent out to every outgoing line
except the one that the packet arrived on
PROBLEN:
- A large number of duplicated
packets - consumes bandwidth
SOLUT!ON:
- Have a hop counter in the header
of each packet, which is
decremented at each hop
- When counter reaches zero, the
packet is discarded
- !deally, the hop counter should be
initialized to the length of the path
from source to destination
17
Flooding {2}
- Flooding always chooses the shortest path because it chooses
every possible path in parallel.
- Flooding is not practical in most applications, but it has several
important uses:
1. !n military applications, where large numbers of routers may be
blown at any instant, the tremendous robustness of flooding is
highly desirable
2. !n distributed database applications, it is sometimes necessary to
update all the databases concurrently
3. !n wireless networks all messages transmitted by a station can be
received by all other stations within its radio range
+. A metric against which other routing algorithms can be compared
- !n selective flooding, a router sends packets out only on those
lines in the general direction of the destination. That is, don't send
packets out on lines that clearly lead in the wrong direction.
18
Dynamic algorithms
- Distance-Vector Routing
-used in the ARPANET until 1979
- Link-State Routing
-used in the newer !nternet Open Short Path First (OSPF)
protocol
19
The Distance Vector Routing
- Operates by having each router maintain a table (vector)
giving the best known distance to each destination and
which line to use to get there
- dynamic algorithm
-takes current network load into account
- distributed
-each node receives information from its directly attached
neighbours, performs a calculation, distribute the results back
to neighbours
- the last one introduces overhead
- iterative
-algorithm performed in steps until no more information to
change
-initially, each node knows only about its adjacent nodes
- asynchronous
-nodes do not operate in lockstep with each other
20
The Distance Vector Routing
D
C
E
B
A
7
2
1
1
8 2
D
E
() A
A 0
B 7
C
D
B
7
0
1

2
0
2 ) , (
8 ) , (
1 ) , (
=
=
=
D E c
B E c
A E c
A B D
1 15
8 8
9 4
2
d
e
s
t
i
n
a
t
i
o
n

n
o
d
e
s
distance
tables from
neighbors
intermediate
distance table
Es
distance
vector
node E sends this
distance vector to
its neighbors
1,A
8,B
4,D
2,D
)) ( ) , ( ( min ) (
) (
Y D Z X c Y D
Z
X N Z
X
+ =

Are these paths
shortest possible?
Note that this is not
the final vector!
21
The count-to-infinity problem
- DvR - good news spread rapidly, bad news slowly
- Suppose all distance vectors sent at once
- Suppose that A was down (link cost = ) and it just came
up
a metric
is the
number
of hosts
If node X tells Y that it has a path somewhere, Y has no way of knowing
whether it itself is on the path.
How can we avoid this problem?

They still think that A is down


22
Avoid looping
- Split horizon
-Never send information about the routing for a particular
packet in the direction from which it was received
-Can be achieved by means of a technique called poison
reverse.
- informing all routers that the path back to the originating
node for a particular packet has an infinite metric
-Performance:
- Split horizon with poison reverse, is more effective in
networks with multiple routing paths
23
The 8plit horizon with poison
reverse
D
C
E
B
A
7
2
1
1
8 2
2 ) , ( 8 ) , ( 1 ) , ( = = = D E c B E c A E c ; ;
D
E
() A
A 0
B 7
C
D
B
7
0
1

2
0
A B D
1 15
8 8
9 4
2
d
e
s
t
i
n
a
t
i
o
n

n
o
d
e
s
distance
tables from
neighbors
intermediate
distance table
Es
distance
vector
1,A
8,B
4,D
2,D
To A:
A
B 8
C 4
D 2
E 0
To B:
A 1
B
C 4
D 2
E 0
To D:
A 1
B 8
C
D
E 0
if a path to a dest node Y is through
neighboring node X report to
node X for destination node
Note that this is not
the final vector!
24
The distance vector routing
- Two problems
1. Link bandwidth not taken into account for metric, only
the queue length
- all the lines at that time 56 Kbps
2. Too long time to converge
- QUEST!ON: when the algorithm converges?
- ANSWER: when every node knows about all other
nodes and networks and computes the shortest path to
them
- will the nodes know the exact network topology by then?
25
Dynamic algorithms
- Distance vector Routing
- Link State Routing
26
A Link-state routing algorithm
- link state broadcast - node learn about path costs
from its neighbors
- inform the neighbors whenever the link cost
changes
-hence the name link state
27
Link state routing
- Each router does the following (repeatedly):
- discover neighbors, particularly, learn their network
addresses
- A router learns about its neighbours by sending a special
HELLO packet to each point-to-point line. Routers on the
other end send a reply
- measure cost to each neighbor
- e.g. by exchanging a series of packets
- sending ECHO packets and measuring the average round-
trip-time
- include traffic-induced delay?
- construct a link state packets
- send this packet to all other routers
- using what route information? chicken f egg
- what if re-ordered? or delayed?
- compute locally the shortest path to every other router
when this information is received
28
Constructing link state packets
- When to build these packets?
- at regular time intervals
- on occurrence of some significant event
- link goes down (or comes back), cost change appreciably
subnet
link state packets for this subnet
sender
29
Distributing the link state
packets
- Typically, flooding
- routers recognize packets passed earlier
- sequence number incremented for each new packet sent
- routers keep track of the (source router, sequence) pair
- thus avoiding the exponential packet explosion
- first receivers start changes already while changes are being
reported
- sequence numbers wrap around or might be corrupted (a bit
inversed - 655+0 instead of +)
- 32 bit sequence number (137 years to wrap)
- To avoid corrupted sequences (or a router reboot) and therefore
prevent any update, the state at each router has an age field
that is decremented once a second
- but, need additional robustness in order to deal with errors on
router-to-router lines
- acknowledgements
30
Routing in the nternet
- What would happen if hundreds of millions of
routers execute the same routing algorithm to
compute routing paths through the network?
- Scale
-large overhead
-enormous memory space in the routers
-no bandwidth left for data transmission
-would Dv algorithm converge?
- Administrative autonomy
-an organization should run and administer its networks
as wishes but must be able to connect it to outside"
networks
31
Hierarchical routing
- The !nternet uses hierarchical routing
- it is split into Autonomous Systems {AS)
- routers at the border: gateways
- gateways must run both intra 8 inter AS routing protocols
- routers within AS run the same routing algorithm
- the administrator can chose any !nterior Gateway Protocol
- Routing !nformation Protocol {RIP)
- Open Shortest Path First {OSPF)
- between AS gateways use Exterior Gateway Protocol
- Border Gateway Protocol {BGP)
Why do we have different
protocols for inter & intra AS
routing?
32
Autonomous systems
- gateways (R1, R2, R3, R+) use both interior 8 exterior routing
- other routers use only interior routing
- Note: AS routing protocols in A, B, C 8 D not need to be the
same!
network
router
gateway
BGP
BGP
BGP RIP &
OSPF
A B
C
D
H2
H1
33
Routing within A8
- The gateways are exit points
- routers use default routing
-each router knows all netid's within AS
-packets destined to another AS are sent to the default
router
-default router is the border gateway to the next AS
34
Routing nformation Protocol
- Based on Distance vector Routing
- Distance metric = hop count
- each link have cost = 1
- maximum cost path = 15 - limited to AS < 15 hops in
diameter
1. each router shares its knowledge about the entire AS
- it is unimportant how much it knows, it sends whatever it
has
2. sharing only with neighbours
3. updates exchanged among neighbours every 30 sec
- R!P response message
- Send the distance to networks within AS
35
RP - routing table
- Other information
-subnet mask
-the time a table was updated
6
4
5
7
Hop
Count
131.4.7.19 115.0.0.0
200.5.1.6 1S9.45.0.0
176.3.6.17 197.5.13.0
172.6.23.4 163.5.0.0
Other
information
Next
Router
Destination
36
RP updating algorithm
Receive: a response RIP message
1. Add one hop to the hop count for each advertised destination.
2. Repeat the following steps for each advertised destination:
a. If (destination not in the routing table)
I. Add the advertised information to the table.
b. Else
I. If (next-hop field is the same)
i. Replace entry in the table with the advertised one.
II. Else
i. If (advertised hop count smaller than one in the table)
- Replace entry in the routing table.
3. Return.
37
RP - updating the table
38
RP - an example
initial routing tables
destination hop next
counter router
39
RP - an example {cnt'd}
final routing tables
destination hop next
counter router
40
Routing protocols
41
Open 8hortest Path First
{O8PF}
- Open" - resources assumed to be freely usable
- Uses Link State algorithm
-Link state (LS) packet spreading
-Topology map at each node
-Route computation using Dijkstra algorithm
-link costs set up by the administrator
- Separates policy from mechanism
42
O8PF - advances to RP
- Security: all messages between routers (for
example link state updates) are authenticated
- Nultiple same-cost path: allowed
- Nultiple cost metric: for each link, multiple cost
for each type of link (satellite connection, fiber,
etc.)
- Support for hierarchy: AS is divided into areas to
handle routing efficiently
43
Areas in A8
- intra area routing involves only routers within the same area
- area border router - routs the packet outside the area
- exactly 1 area configured to be backbone area
- backbone routers run OSPF within backbone area
- AS bound. router - exchanges routing info with routers in
other AS's
44
Routing protocols
Intra AS
routing
Inter AS
routing
45
nter A8 routing
Border Gateway Protocol
- it is de facto standard interdomain routing
protocol in today's !nternet
network
router
gateway
BGP
BGP
BGP RIP &
OSPF
A B
C
D
H2
H1
46
BGP
- Why are Distance vector Routing 8 Link State
Routing not good candidates?
-route with the smallest hop count not the preferred one
- AS not secure
-DvR: only number of hops known to destination not
path to get there
-LSR: !nternet too big for this routing method
- huge databases
- long time to run Dijsktra's algorithm
47
BGP- {cnt'd}
- Path vector Routing (Dv based)
- A path: an ordered list of AS that a packet should travel
through to reach the destination"
- Path information rather than cost information!
- AS #'s assigned by !nternet Corporation for Assigned
Names and Numbers (!CANN) regional registries
R12
R06
R05
R01
Next Router
AS62, AS02, AS09 N04
AS67, ASS9, AS09, AS34 N03
AS22, AS67, AS05, ASS9 N02
AS14, AS23, AS67 N01
Path Network
CIDRized
destination
network address
(128.119.40/24)
offers control to the
administrator!
48
BGP- path vector messages
1. router R1 sends a path vector advertising the
detachability of N1
2. router R2 receives the message, updates its table,
replaces the router # with its own, adds its AS # and
sends a message to R3
3. .
network next router path
49
BGP activities
1. receiving 8 filtering route advertisement from
directly attached neighbors
- Filtering: ignore advs that contain its own number in
the AS path (avoid looping)
2. route selection
- distinguish between routing mechanism 8 routing
policy
3. sending its route advertisement to neighbors
- only provides mechanism - not policy
50
BGP - an example
- W, X, Y - sourcefdestination off all traffic leavingfentering
AS
- How will X be prevented from forwarding traffic from B to
C?
- controlled routes advertisement
- X advertises to its neighbors B 8 C that it has no paths to C or Y
even though he knows that path!
- B will not send packets for C through X
- Should B advertise path AW via B to C or only to X?
- Traffic from C should go directly via A
W
B
C
X
Y
A
provider
network
(ISP)
customer
network
AS
AS
51
Types of BGP packets
- Open: create a neighbor relationship
- a router running BGP opens a connection and sends an open
message
- if a neighbour accepts the relationship its responds with a
keep-alive
- Update: heart of BGP
- used to redraw destinations advertised previously
- Keep-alive: routers tell each other that they are active
- Notification: in case of error or when router wants to
close the connection
52
Network Address Translation
{NAT}
- Number of home users and small business that want to use
the !nternet ever increases
-always on-line (ADSL, cable,.)
- !Pv+ address space limited
- Solution: NAT
-large number of internal addresses and limited number
of external addresses
- Addresses for private use (no permission required)
2
16
2
20
2
24
Total addresses
192.168.0.0 to 192.168.255.255
172.16.0.0 to 172.31.255.255
10.0.0.0 to 10.255.255.255
Private address range
53
NAT {cnt'd}
address translation
54
NAT {cnt'd}
communication is always initiated by the private network
only 1 private-network host can access the same external host
55
NAT {cnt'd}
- Using pool of addresses (example: + external
addresses instead of 1)
-drawback: no more than + connections can be made to
the same destination
- Using both !P addresses and port numbers
...
25.8.3.2
25.8.3.2
External
Address
...
1+01
1+00
Private
Port
... ... ...
TCP 80 172.18.3.2
TCP 80 172.18.3.1
Transport
Protocol
External
Port
Private
Address
56
Exercises
1. How can flooding and broadcast be said to be similar to each
other? How do they differ? Name one way in which they are
similarfdifferent.
2. Explain how looping can be avoided in distance-vector routing.
3. How does static routing differs from dynamic routing? Name
two static and two dynamic algorithms used in routing
packets.
+. Explain the operation of Dijkstra's algorithm.
5. By means of appropriate diagrams explain how labeling in
shortest path routing works.
6. Which problems are encountered with distance-vector routing?
7. Which actions does a router perform in link-state routing?
8. Contrast R!P, OSPF and BGP routing algorithms.
9. What is NAT and why is it used?
57
References
- F. Halsall, Data Communications, Computer
Networks and Open Systems, +
th
edition, Addison
Wesley, 1995
- A.S. Tanenbaum, Computer Networks, +
th
edition,
Pearson Education !nternational, 2003

Você também pode gostar