Sie sind auf Seite 1von 57

Chapter 4: outline

4.5 routing algorithms


link state
distance vector
hierarchical routing
4.6 routing in the
Internet
RIP
OSPF
BGP
4.7 broadcast and
multicast routing

Network Layer 4-1


A Link-State Routing Algorithm
Dijkstras algorithm notation:
net topology, link costs c(x,y): link cost from
known to all nodes node x to y; = if not
accomplished via link direct neighbors
state broadcast D(v): current value of
all nodes have same info cost of path from
computes least cost source to dest. v
paths from one node p(v): predecessor
(source) to all other node along path from
nodes source to v
gives forwarding table for N': set of nodes whose
that node least cost path
iterative: after k definitively known
iterations, know least
cost path to k dest.s
Network Layer 4-2
Dijkstra algorithm
Example of formation of shortest path tree
Dijkstras algorithm: another
example
Step N' D(v),p(v) D(w),p(w) D(x),p(x) D(y),p(y) D(z),p(z)
0 u 2,u 5,u 1,u
1 ux 2,u 4,x 2,x
2 uxy 2,u 3,y 4,y
3 uxyv 3,y 4,y
4 uxyvw 4,y
5 uxyvwz

5
3
v w 5
2
u 2 1 z
3
1 2
x 1
y

Network Layer 4-5


Dijkstras algorithm: example
(2)
resulting shortest-path tree from u:

v w
u z
x y

resulting forwarding table in u:


destination link
v (u,v)
x (u,x)
y (u,x)
w (u,x)
z (u,x)
Network Layer 4-6
Chapter 4: outline
4.1 introduction 4.5 routing algorithms
4.2 virtual circuit and link state
distance vector
datagram networks
hierarchical routing
4.3 whats inside a
router 4.6 routing in the
Internet
4.4 IP: Internet Protocol RIP
datagram format
OSPF
IPv4 addressing
BGP
ICMP
IPv6
4.7 broadcast and
multicast routing

Network Layer 4-7


Bellman-Ford Algorithm
Define distances at each node x
dx(y) = cost of least-cost path from x to
y
Update distances based on neighbors
dx(y)
v = 2min {c(x,v)
y + dv(y)} over all
3 1
neighbors
1 v
u
x 4 z
2 1
5 t
du(z) = min{c(u,v) + dv(z),
w 4 3
s c(u,w) + dw(z)}
8
Distance Vector Algorithm
c(x,v) = cost for direct link from x to v
Node x maintains costs of direct links c(x,v)
Dx(y) = estimate of least cost from x to y
Node x maintains distance vector Dx = [Dx(y): y N ]
Node x maintains its neighbors distance vectors
For each neighbor v, x maintains Dv = [Dv(y): y N ]
Each node v periodically sends Dv to its neighbors
And neighbors update their own distance vectors
Dx(y) minv{c(x,v) + Dv(y)} for each node y N
Over time, the distance vector Dx converges

9
Distance vector algorithm
Bellman-Ford equation (dynamic
programming)

let
dx(y) :=v
cost of least-cost path from
x to y
cost from neighbor v to destination
then
dx(y) = cost {c(x,v)
min to neighbor
+ vd (y) }
v v of x
min taken over all neighbors
Network Layer 4-10
Bellman-Ford example
5
3
clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3
v w 5
2
u 2 1 z B-F equation says:
3
1 2 du(z) = min { c(u,v) + dv(z),
x 1
y
c(u,x) + dx(z),
c(u,w) + dw(z) }
= min {2 + 5,
1 + 3,
5 + 3} = 4
ode achieving minimum is next
op in shortest path, used in forwarding table
Network Layer 4-11
Distance vector algorithm
Dx(y) = estimate of least cost from x
to y
x maintains distance vector Dx = [Dx(y):
yN]
node x:
knows cost to each neighbor v: c(x,v)
maintains its neighbors distance
vectors. For each neighbor v, x
maintains
Dv = [Dv(y):Network
y Layer
N] 4-12
Distance vector algorithm
key idea:
from time-to-time, each node sends its own
distance vector estimate to neighbors
when x receives new DV estimate from
neighbor, it updates its own DV using B-F
equation:
Dx(y) minv{c(x,v) + Dv(y)} for each node y N

under minor, natural conditions, the


estimate Dx(y) converge to the actual
least cost dx(y)

Network Layer 4-13


Distance vector algorithm
iterative, each node:
asynchronous: each
local iteration caused
wait for (change in local link
by:
cost or msg from neighbor)
local link cost change
DV update message
from neighbor recompute estimates
distributed:
each node notifies
if DV to any dest has
neighbors only when its
changed, notify neighbors
DV changes
neighbors then notify their
neighbors if necessary

Network Layer 4-14


Dx(z) = min{c(x,y) +
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)}
= min{2+0 , 7+1} = 2 Dy(z), c(x,z) + Dz(z)}
= min{2+1 , 7+0} = 3
node x cost to cost to
table x y z x y z
x 0 2 7 x 0 2 3

from
from

y y 2 0 1
z z 7 1 0

node y cost to
table x y z y
2 1
x x z
from

y 2 0 1 7
z

node z cost to
table x y z
x
from

y
z 7 1 0
time
Network Layer 4-15
Dx(z) = min{c(x,y) +
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)}
= min{2+0 , 7+1} = 2 Dy(z), c(x,z) + Dz(z)}
= min{2+1 , 7+0} = 3
node x cost to cost to cost to
table x y z x y z x y z
x 0 2 7 x 0 2 3 x 0 2 3

from
from

y y 2 0 1 y 2 0 1

from
z z 7 1 0 z 3 1 0

node y cost to cost to cost to


table x y z x y z x y z y
2 1
x x 0 2 7 x 0 2 3 x z
from

y y 2 0 1 7
from

2 0 1 y 2 0 1

from
z z 7 1 0 z 3 1 0

node z cost to cost to cost to


x y z x y z x y z
table
x x 0 2 7 x 0 2 3
from

from

y 2 0 1 y 2 0 1
from

y
z z 3 1 0 z 3 1 0
7 1 0
time
Network Layer 4-16
Distance Vector Example:
Step 0
Optimum 1-hop paths
Table for A Table for B
E 3 C
Dst Cst Hop Dst Cst Hop 1
A 0 A A 4 A
F 1
B 4 B B 0 B 2
6
C C
1
D D 3 D 3 D
A 4
E 2 E E
B
F 6 F F 1 F
Table for C Table for D Table for E Table for F
Dst Cst Hop Dst Cst Hop Dst Cst Hop Dst Cst Hop
A A A 2 A A 6 A
B B 3 B B B 1 B
C 0 C C 1 C C C 1 C
D 1 D D 0 D D D
E E E 0 E E 3 E
F 1 F F F 3 F F 0 F
17
Distance Vector Example:
Step 2
Optimum 2-hop paths
Table for A Table for B
E 3 C
Dst Cst Hop Dst Cst Hop 1
A 0 A A 4 A
F 1
B 4 B B 0 B 2
6
C 7 F C 2 F
1
D 7 B D 3 D 3 D
A 4
E 2 E E 4 F
B
F 5 E F 1 F
Table for C Table for D Table for E Table for F
Dst Cst Hop Dst Cst Hop Dst Cst Hop Dst Cst Hop
A 7 F A 7 B A 2 A A 5 B
B 2 F B 3 B B 4 F B 1 B
C 0 C C 1 C C 4 F C 1 C
D 1 D D 0 D D D 2 C
E 4 F E E 0 E E 3 E
F 1 F F 2 C F 3 F F 0 F
18
Distance Vector Example:
Step 3
Optimum 3-hop paths
Table for A Table for B
E 3 C
Dst Cst Hop Dst Cst Hop 1
A 0 A A 4 A
F 1
B 4 B B 0 B 2
6
C 6 E C 2 F
1
D 7 B D 3 D 3 D
A 4
E 2 E E 4 F
B
F 5 E F 1 F
Table for C Table for D Table for E Table for F
Dst Cst Hop Dst Cst Hop Dst Cst Hop Dst Cst Hop
A 6 F A 7 B A 2 A A 5 B
B 2 F B 3 B B 4 F B 1 B
C 0 C C 1 C C 4 F C 1 C
D 1 D D 0 D D 5 F D 2 C
E 4 F E 5 C E 0 E E 3 E
F 1 F F 2 C F 3 F F 0 F
19
Comparison of LS and DV algorithms

message complexity robustness: what happens


LS: with n nodes, E links, if router malfunctions?
O(nE) msgs sent LS:
DV: exchange between
node can advertise
neighbors only
incorrect link cost
convergence time varies
each node computes only
its own table
speed of convergence
LS: O(n2) algorithm requires DV:
O(nE) msgs DV node can advertise
may have oscillations incorrect path cost
DV: convergence time varies each nodes table used
may be routing loops by others
error propagate thru
count-to-infinity problem network

Network Layer 4-20


Chapter 4: outline
4.1 introduction 4.5 routing algorithms
4.2 virtual circuit and link state
distance vector
datagram networks
hierarchical routing
4.3 whats inside a
router 4.6 routing in the
Internet
4.4 IP: Internet Protocol RIP
datagram format
OSPF
IPv4 addressing
BGP
ICMP
IPv6
4.7 broadcast and
multicast routing

Network Layer 4-21


Hierarchical
routing
our routing study thus far -
idealization
all routers identical
network flat

not true in practice


administrative
scale: with 600 million autonomy
destinations: internet = network of
cant store all dests in
routing tables!
networks
routing table exchange each network admin
would swamp links! may want to control
routing in its own
network
Network Layer 4-22
Hierarchical
routing
aggregate routers into
regions, autonomous
systems (AS)
routers in same AS
run same routing gateway router:
protocol at edge of its own
intra-AS routing AS
protocol has link to router in
routers in different AS another AS
can run different intra-
AS routing protocol

Network Layer 4-23


Interconnected ASes

3c
3a 2c
3b 2a
AS3 2b
1c AS2
1a 1b AS1
1d
forwarding table
configured by both
Intra-AS
intra- and inter-AS
Inter-AS
Routing Routing routing algorithm
algorithm algorithm
intra-AS sets entries
Forwarding
table
for internal dests
inter-AS & intra-AS
sets entries for
external dests
Network Layer 4-24
Inter-AS tasks
suppose router in
AS1 receives
AS1 must:
datagram destined
outside of AS1: 1. learn which dests
are reachable
router should
through AS2, which
forward packet to
through AS3
gateway router,
but which one? 2. propagate this
reachability info to
3c
all routers in AS1
3a
3b job of inter-AS
2c
routing!
AS3 1c
other
2a networks
other 1a 2b
networks 1b AS2
AS1 1d
Network Layer 4-25
Example: setting forwarding table in
router 1d
suppose AS1 learns (via inter-AS protocol) that
subnet x reachable via AS3 (gateway 1c), but not
via AS2
inter-AS protocol propagates reachability
info to all internal routers
router 1d determines from intra-AS routing info that
its interface I is on the least cost path to 1c
installs
3c forwarding table entry (x,I)
x
3a
3b
AS3 2c other
1c 2a networks
other 1a 2b
networks 1b AS2
AS1 1d
Network Layer 4-26
Example: choosing among multiple
ASes
now suppose AS1 learns from inter-AS protocol
that subnet x is reachable from AS3 and from
AS2.
to configure forwarding table, router 1d must
determine which gateway it should forward
packets towards for dest x
this is also job of inter-AS routing
protocol!
3c x
3b
3a
AS3 2c other
1c 2a networks
other 1a 2b
networks 1b AS2
AS1 1d
?
Network Layer 4-27
Example: choosing among multiple
ASes
now suppose AS1 learns from inter-AS protocol
that subnet x is reachable from AS3 and from
AS2.
to configure forwarding table, router 1d must
determine towards which gateway it should
forward packets for dest x
this is also job of inter-AS routing
protocol!
hot potato routing: send packet towards closest
of two routers.
use routing info determine from
learn from inter-AS hot potato routing: forwarding table the
from intra-AS
protocol that subnet choose the gateway interface I that leads
protocol to determine
x is reachable via that has the to least-cost gateway.
costs of least-cost
multiple gateways smallest least cost Enter (x,I) in
paths to each
of the gateways forwarding table

Network Layer 4-28


Chapter 4: outline
4.1 introduction 4.5 routing algorithms
4.2 virtual circuit and link state
distance vector
datagram networks
hierarchical routing
4.3 whats inside a
router 4.6 routing in the
Internet
4.4 IP: Internet Protocol RIP
datagram format
OSPF
IPv4 addressing
BGP
ICMP
IPv6
4.7 broadcast and
multicast routing

Network Layer 4-29


Intra-AS Routing
also known as interior gateway
protocols (IGP)
most common intra-AS routing
protocols:
RIP: Routing Information Protocol
OSPF: Open Shortest Path First
IGRP: Interior Gateway Routing Protocol
(Cisco proprietary)

Network Layer 4-30


RIP ( Routing Information
Protocol)
included in BSD-UNIX distribution in 1982
distance vector algorithm
distance metric: # hops (max = 15 hops), each link has cost 1
DVs exchanged with neighbors every 30 sec in response message (aka
advertisement)
each advertisement: list of up to 25 destination subnets (in IP addressing sense)

from router A to destination subnets:


u v subnet hops
w u 1
A B
v 2
w 2
x x 3
z C D y 3
y z 2
Network Layer 4-31
RIP: example

z
w x y
A D B

C
routing table in router D
destination subnet next router # hops to
dest
w A 2
y B 2
z B 7
x -- 1
. . ....
Network Layer 4-32
RIP: example
A-to-D advertisement
dest next hops
w - 1
x - 1
z C 4
. ... z
w x y
A D B

C
routing table in router D
destination subnet next router # hops to
dest
w A 2
y B 2 A 5
z B 7
x -- 1
. . ....
Network Layer 4-33
RIP: link failure, recovery
if no advertisement heard after 180
sec --> neighbor/link declared dead
routes via neighbor invalidated
new advertisements sent to neighbors
neighbors in turn send out new
advertisements (if tables changed)
link failure info quickly (?) propagates to
entire net
poison reverse used to prevent ping-
pong loops (infinite distance = 16 hops)
Network Layer 4-34
RIP table processing
RIP routing tables managed by
application-level process called
route-d (daemon)
advertisements
routed sent in UDP packets,
routed
periodically repeated
transport transprt
(UDP) (UDP)
network forwarding forwarding network
(IP) table table (IP)
link link
physical physical

Network Layer 4-35


OSPF (Open Shortest Path First)
open: publicly available
uses link state algorithm
LS packet dissemination
topology map at each node
route computation using Dijkstras algorithm
OSPF advertisement carries one entry
per neighbor
advertisements flooded to entire AS
carried in OSPF messages directly over IP
(rather than TCP or UDP
Network Layer 4-36
OSPF advanced features (not in
RIP)
security: all OSPF messages authenticated (to
prevent malicious intrusion)
multiple same-cost paths allowed (only one
path in RIP)
for each link, multiple cost metrics for
different TOS (e.g., satellite link cost set low
for best effort ToS; high for real time ToS)
integrated uni- and multicast support:
Multicast OSPF (MOSPF) uses same topology data
base as OSPF
hierarchical OSPF in large domains.

Network Layer 4-37


Hierarchical
OSPF
boundary router
backbone router

backbone
area
border
routers

area 3

internal
area 1 routers
area 2

Network Layer 4-38


Hierarchical
OSPF
two-level hierarchy: local area, backbone.
link-state advertisements only in area
each nodes has detailed area topology; only know
direction (shortest path) to nets in other areas.
area border routers: summarize distances to
nets in own area, advertise to other Area Border
routers.
backbone routers: run OSPF routing limited to
backbone.
boundary routers: connect to other ASs.

Network Layer 4-39


Chapter 4: outline
4.1 introduction 4.5 routing algorithms
4.2 virtual circuit and link state
datagram networks distance vector
4.3 whats inside a hierarchical routing
router 4.6 routing in the
4.4 IP: Internet Protocol Internet
datagram format RIP
IPv4 addressing OSPF
ICMP 4.7 broadcast and
IPv6 multicast routing

Network Layer 4-40


Delivery and comm type
A message delivery can be 3 types
Unicast
Multicast
Broadcast
Unicasting
In unicast communication, there is
one source and one destination
The relationship between the source
and the destination is one-to-one.
In this type of communication, both
the source and destination addresses
in the IP, are the unicast addresses
assigned to the hosts
Unicasting
multicasting
In multicast communication, there is
one source and a group of
destination.
The relationship is one-to-many.
Source address is a unicast. But the
destination address is a group
address (which defines one or more
destination)
Refer fig 22.34
Multicasting
Note

In multicasting, the router may


forward the received packet
through several of its interfaces.
Broadcasting
In broadcast comm., the relationship
between the source and the
destination is one-to-all.
There is only one source, but all the
other hosts are the destinations.
The internet does not explicitly
support broadcasting bcoz of the
huge amount of traffic it would
create and bcoz of the bandwidth it
would need.
Tv, radio broadcasting (not internet
Multicasting Vs multiple
unicasting
Multicasting starts with one single
packet from the source that is
duplicated by the routers. The
destination address in each packet is
the same for all duplicates.
In multiple unicasting, several
packets start from the source, if
there are 5 destination, for e.g., the
source sends 5 packets, each with a
different unicast destination address.
Multicasting versus multiple unicasting
e.g. multiple-unicasting in
email
The e-mail software creates replicas of the
message, each with a different destination
address and sends them one-by-one.
This is not multicasting; it is multiple
unicasting.
Multicasting application
Video teleconferencing
Distance learning lessons taught by one
single prof. can be received by a specific
group of students. (remote student)
Broadcast routing
deliver packets from source to all other nodes
source duplication is inefficient:
duplicate
duplicate R1 creation/transmission R1
duplicate
R2 R2

R3 R4 R3 R4

source in-network
duplication duplication

source duplication: how does source


determine recipient addresses?
Network Layer 4-51
In-network duplication
flooding: when node receives broadcast
packet, sends copy to all neighbors
problems: cycles & broadcast storm
controlled flooding: node only broadcasts pkt if
it hasnt broadcast same packet before
node keeps track of packet ids already broadacsted
or reverse path forwarding (RPF): only forward
packet if it arrived on shortest path between node
and source
spanning tree:
no redundant packets received by any node

Network Layer 4-52


Spanning tree
first construct a spanning tree
nodes then forward/make copies
only along spanning tree
A A

B B
c c

D D
F E F E

G G
(a) broadcast initiated at A (b) broadcast initiated at D

Network Layer 4-53


Spanning tree: creation
center node
each node sends unicast join message to
center node
message forwarded until it arrives at a node
already belonging to spanning tree

A A
3
B B
c c
4
2
D D
F E F E
1 5
G G
(a) stepwise construction of (b) constructed spanning
spanning tree (center: E) tree
Network Layer 4-54
Shortest path tree
mcast forwarding tree: tree of shortest
path routes from source to all receivers
Dijkstras algorithm
s: source LEGEND
R1 2 router with attached
1 R4
group member
R2 5 router with no attached
3 4 group member
R5
i link used for forwarding,
R3 6
i indicates order link
R6 R7 added by algorithm

Network Layer 4-55


Reverse path forwarding
rely on routers knowledge of unicast
shortest path from it to sender
each router has simple forwarding
behavior:
if (mcast datagram received on incoming
link on shortest path back to center)
then flood datagram onto all outgoing
links
else ignore datagram

Network Layer 4-56


Reverse path forwarding:
example
s: source LEGEND
R1
R4 router with attached
group member
R2
router with no attached
R5 group member
R3 datagram will be forwarded
R6 R7
datagram will not be
forwarded

result is a source-specific reverse SPT


may be a bad choice with asymmetric
links
Network Layer 4-57

Das könnte Ihnen auch gefallen