Distance Vector Algorithm: Bellman-Ford Equation (Dynamic Programming)
Distance Vector Algorithm: Bellman-Ford Equation (Dynamic Programming)
4-1
Bellman-Ford example
5
2
v
2
w
3
5
2
4-2
c(x,v)
Node x maintains distance vector Dx =
[Dx(y): y N ]
Node x also maintains its neighbors
distance vectors
4-3
Network Layer
4-4
Distributed:
Each node:
Network Layer
node x table
cost to
x y z
Dx(z) = min{c(x,y) +
Dy(z), c(x,z) + Dz(z)}
= min{2+1 , 7+0} = 3
cost to
x y z
from
from
x 0 2 7
y
z
node y table
cost to
x y z
x 0 2 3
y 2 0 1
z 7 1 0
x
y 2 0 1
z
node z table
cost to
x y z
from
from
x
y
z 71 0
4-5
time
Network Layer
4-6
Dx(z) = min{c(x,y) +
Dy(z), c(x,z) + Dz(z)}
node x table
cost to
x y z
x
y
z 71 0
from
from
from
from
x 0 2 7
y 2 0 1
z 7 1 0
cost to
x y z
x 0 2 7
y 2 0 1
z 3 1 0
x 0 2 3
y 2 0 1
z 3 1 0
cost to
x y z
x 0 2 3
y 2 0 1
z 3 1 0
cost to
x y z
from
from
from
x
y 2 0 1
z
node z table
cost to
x y z
x 0 2 3
y 2 0 1
z 7 1 0
= min{2+1 , 7+0} = 3
cost to
x y z
cost to
x y z
from
from
x 0 2 7
y
z
node y table
cost to
x y z
cost to
x y z
x 0 2 3
y 2 0 1
z 3 1 0
time
Network Layer
4-7
distance vector
if DV changes, notify neighbors
good
news
travels
fast
y
50
Network Layer
4-8
60
y
50
Poisoned reverse:
If Z routes through Y to
get to X :
Network Layer
4-9
neighbors only
convergence time varies
Speed of Convergence
LS: O(n2) algorithm requires
O(nE) msgs
may have oscillations
DV: convergence time varies
may be routing loops
count-to-infinity problem
DV:
datagram networks
4.3 Whats inside a
router
4.4 IP: Internet
Protocol
Datagram format
IPv4 addressing
ICMP
IPv6
Internet
RIP
OSPF
BGP
multicast routing
Network Layer
4-11
Hierarchical Routing
Our routing study thus far - idealization
all routers identical
network flat
not true in practice
scale: with 200 million
destinations:
cant store all dests in
routing tables!
administrative autonomy
internet = network of
networks
each network admin may
want to control routing in its
own network
Hierarchical Routing
aggregate routers into
regions, autonomous
systems (AS)
routers in same AS run
same routing protocol
Gateway router
Direct link to router in
another AS
intra-AS routing
protocol
routers in different AS
can run different intraAS routing protocol
Interconnected ASes
3c
3b
3a
AS3
1a
2a
1c
1d
1b
Intra-AS
Routing
algorithm
2c
AS2
AS1
Inter-AS
Routing
algorithm
Forwarding
table
2b
forwarding table
configured by both
intra- and inter-AS
routing algorithm
Inter-AS tasks
AS1 must:
1. learn which dests
reachable through
AS2, which through
AS3
2. propagate this
reachability info to all
routers in AS1
Job of inter-AS routing!
receives datagram
dest outside of AS1
router should
forward packet to
gateway router, but
which one?
3c
3b
3a
AS3
1a
2a
1c
1b
1d
2c
AS2
2b
AS1
Network Layer 4-15
internal routers.
router 1d determines from intra-AS routing info that
its interface I is on the least cost path to 1c.
installs forwarding table entry (x,I)
3c
3b
3a
AS3
1a
x
2a
1c
1d
1b AS1
2c
2b
AS2
Network Layer 4-16
3c
3b
3a
AS3
1a
2a
1c
1d
1b
2c
AS2
2b
AS1
Network Layer 4-17
Determine from
forwarding table the
interface I that leads
to least-cost gateway.
Enter (x,I) in
forwarding table
datagram networks
4.3 Whats inside a
router
4.4 IP: Internet
Protocol
Datagram format
IPv4 addressing
ICMP
IPv6
Internet
RIP
OSPF
BGP
multicast routing
Intra-AS Routing
also known as Interior Gateway Protocols (IGP)
most common Intra-AS routing protocols:
10
datagram networks
4.3 Whats inside a
router
4.4 IP: Internet
Protocol
Internet
Datagram format
IPv4 addressing
ICMP
IPv6
RIP
OSPF
BGP
multicast routing
x
y
destination hops
u
1
v
2
w
2
x
3
y
3
z
2
11
RIP advertisements
distance
RIP: Example
z
w
C
Destination Network
w
y
z
x
Next Router
....
A
B
B
--
2
2
7
1
Routing table in D
Network Layer 4-24
12
RIP: Example
Dest
w
x
z
.
Next
C
hops
1
1
4
...
Advertisement
from A to D
z
x
Destination Network
w
y
z
x
Next Router
....
A
B
B A
--
Routing table in D
2
2
7 5
1
13
routed
Transprt
(UDP)
network
(IP)
Transprt
(UDP)
forwarding
table
forwarding
table
network
(IP)
link
link
physical
physical
Network Layer 4-27
datagram networks
4.3 Whats inside a
router
4.4 IP: Internet
Protocol
Datagram format
IPv4 addressing
ICMP
IPv6
Internet
RIP
OSPF
BGP
multicast routing
14
router
advertisements disseminated to entire AS (via
flooding)
15
datagram networks
4.3 Whats inside a
router
4.4 IP: Internet
Protocol
Datagram format
IPv4 addressing
ICMP
IPv6
Internet
RIP
OSPF
BGP
multicast routing
the de
facto standard
BGP provides each AS a means to:
1.
2.
3.
16
BGP basics
pairs of routers (BGP peers) exchange routing info
3c
3a
3b
AS3
1a
AS1
iBGP session
2a
1c
1d
2c
AS2
1b
2b
3c
3a
3b
AS3
1a
AS1
iBGP session
2a
1c
1d
1b
2c
AS2
2b
17
18
BGP messages
BGP messages exchanged using TCP.
BGP messages:
B
W
provider
network
customer
network:
C
Y
19
B
W
provider
network
customer
network:
C
Y
A advertises path AW to B
B advertises path BAW to X
Should B advertise path BAW to C?
Scale:
hierarchical routing saves table size, reduced update
traffic
Performance:
Intra-AS: can focus on performance
Inter-AS: policy may dominate over performance
20
datagram networks
4.3 Whats inside a
router
4.4 IP: Internet
Protocol
Internet
Datagram format
IPv4 addressing
ICMP
IPv6
RIP
OSPF
BGP
multicast routing
Broadcast Routing
deliver packets from source to all other nodes
source duplication is inefficient:
duplicate
duplicate
creation/transmission
R1
R1
duplicate
R2
R2
R3
R4
source
duplication
R3
R4
in-network
duplication
21
In-network duplication
flooding: when node receives brdcst pckt,
spanning tree
No redundant packets received by any node
Spanning Tree
First construct a spanning tree
Nodes forward copies only along spanning
tree
A
B
c
D
F
G
D
G
22
node
A
3
c
4
F
1
c
D
Shared tree
Source-based trees
23
Dijkstras algorithm
S: source
LEGEND
R1
1
R4
R2
3
R3
5
4
R6
R5
6
R7
24
LEGEND
R1
R4
R2
R5
R3
R6
R7
25
group members
no need to forward datagrams down subtree
prune msgs sent upstream by router with no
downstream group members
LEGEND
S: source
R1
R4
R2
P
R5
R3
R6
P
R7
26
Center-based trees
single delivery tree shared by all
one router identified as
center of tree
to join:
edge router sends unicast join-msg addressed
to center router
join-msg processed by intermediate routers
and forwarded towards center
join-msg either hits existing tree branch for
this center, or arrives at center
path taken by join-msg becomes new branch of
tree for this router
R4
3
2
R5
R3
R6
R7
27
protocol, RFC1075
flood and prune: reverse path forwarding,
source-based tree
RPF tree based on DVMRPs own routing tables
constructed by communicating DVMRP routers
no assumptions about underlying unicast
initial datagram to mcast group flooded
everywhere via RPF
routers not wanting group: send upstream prune
msgs
DVMRP: continued
soft
28
Tunneling
Q: How to connect islands of multicast
routers in a sea of unicast routers?
physical topology
logical topology
addressed) datagram
normal IP datagram sent thru tunnel via regular IP unicast to
receiving mcast router
receiving mcast router unencapsulates to get mcast datagram
Dense:
Sparse:
group members
densely packed, in
close proximity.
bandwidth more
plentiful
29
group membership by
Sparse:
no membership until
profligate
conservative
30
join msg
to rendezvous point
(RP)
R4
join
intermediate routers
update state and
forward join
R1
R2
join
R5
join
R3
R7
R6
rendezvous
point
no one is listening!
R1
R4
join
R2
R3
join
R5
join
R6
R7
rendezvous
point
31
Physical layer:
bit-level reception
Data link layer:
e.g., Ethernet
see chapter 5
Decentralized switching:
32
Memory
Output
Port
System Bus
33
34
Output Ports
35
N flows,
36