View
233
Download
0
Tags:
Embed Size (px)
Citation preview
Ch.2: Link Layer &LAN
Chapter 5Network Layer:
Routing
1
Chapter 5: Network Layer: Routing
#2
Network Layer: Protocols
forwarding
Network layer functions:
Routing protocols•path selection•e.g., RIP, OSPF, BGP
Network layer protocol (e.g., IP)•addressing conventions•packet format•packet handling conventions
Control protocols•error reporting e.g. ICMP
Transport layer
Link layer
physical layer
Networklayer
Control protocols- router “signaling” e.g. RSVP
Chapter 5: Network Layer: Routing
#3
Control: ROUTING algorithms
Chapter 5: Network Layer: Routing
#4
Control Plane: Routing
Graph abstraction for the routing problem:
graph nodes are routers graph edges are
physical links links have properties:
delay, capacity, $ cost, policy
Goal: determine “good” paths(sequences of routers) thru
network from sources to dest.
Routing
A
ED
CB
F2
21
3
1
12
53
5
Chapter 5: Network Layer: Routing
#5
Key Desired Properties of a Routing Algorithm
Robustness
Optimalityfind good path
(for user/provider)
Simplicity
Chapter 5: Network Layer: Routing
#6
Routing Design Space Routing has a large design space
who decides routing?• source routing: end hosts make decision• network routing: networks make decision
– centralized control : one node builds tables for all routers– distributed control : each router builds own routing table
how many paths from source s to destination d?• multi-path routing (several alternatives used)• single path routing
will routing adapt to network traffic demand or to topology changes?
• dynamic routing : tables adapt to state changes• static routing : tables configured manually
…
- Robustness- Optimality- Simplicity
Chapter 5: Network Layer: Routing
#7
Routing Algorithm classification(distributed control network)
Global or decentralized information?
Global information: all routers have complete
topology, link-cost info “link state” algorithms
Decentralized information: router knows physically-
connected neighbors, link costs to neighbors
iterative process of computation, exchange of info with neighbors
“distance vector” algorithms
Centralized of distributed control?
Centralized control: one central node in the
network builds tables for all routers and sends to them
collects data from routers
Distributed control: every router builds its
own table based on information
exchange with other routers
Chapter 5: Network Layer: Routing
#8
A Link-State Routing Algorithm
Dijkstra’s algorithm net topology, link costs
known to all nodes accomplished via “link
state broadcast” all nodes have same
info computes least cost paths
from one node (“source”) to all other nodes gives routing table for
that node iterative: after k iterations,
know least cost path to k destinations
Notation: c(i,j): link cost from node
i to j. cost infinite if not direct neighbors
D(v): current value of cost of path from source to dest. V
p(v): immediate predecessor node along path from source to v,
N: set of nodes whose least cost path definitively known
Chapter 5: Network Layer: Routing
#9
Dijsktra’s Algorithm
1 Initialization: 2 N = {A} 3 for all nodes v 4 if v adjacent to A 5 then D(v) = c(A,v) , p(v)=A6 else D(v) = ∞7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N: 12 D(v) = min( D(v), D(w) + c(w,v) ) , adjust p(v)13 /* new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v */ 15 until all nodes in N
Chapter 5: Network Layer: Routing
#10
Dijkstra’s algorithm: example
Step012345
start NA
ADADE
ADEBADEBC
ADEBCF
D(B),p(B)2,A2,A2,A
D(C),p(C)5,A4,D3,E3,E
D(D),p(D)1,A
D(E),p(E)infinity
2,D
D(F),p(F)infinityinfinity
4,E4,E4,E
A
ED
CB
F
2
2
13
1
1
2
53
5
Chapter 5: Network Layer: Routing
#11
Dijkstra’s algorithm, discussion
Algorithm complexity: n nodes each iteration: need to check all nodes, w, not in N n(n+1)/2 comparisons: O(n2)
more efficient implementations possible: O(nlogn)
Chapter 5: Network Layer: Routing
#12
Distance Vector Routing Algorithm
iterative: continues until no
nodes exchange info. self-terminating: no
“signal” to stop
asynchronous: nodes need not
exchange info/iterate in lock step!
distributed: each node
communicates only with directly-attached neighbors
Distance Table data structure each node has its own table row for each possible destination column for each directly-
attached neighbor to node example: in node X, for dest. Y
via neighbor Z:
D (Y,Z)X
distance from X toY, via Z as next hop
c(X,Z) + min {D (Y,w)}Z
w
=
=
Chapter 5: Network Layer: Routing
#13
Distance Vector Routing
Basis of RIP, IGRP, EIGRP routing protocols
Based on the Bellman-Ford algorithm (BFA)
Conceptually, runs for each destination separately
Chapter 5: Network Layer: Routing
#14
Distance Vector Routing: Basic Idea At node i, the basic update rule
where - di denotes the distance
estimation from i to the destination,
- N(i) is set of neighbors of node i, and
- dij is the distance of the direct link from i to j;assumed positive
)(min )( jijiNji ddd
i
jid
jdijd
destination
reported by j
Chapter 5: Network Layer: Routing
#15
Distance Table: ExampleA
E D
CB7
8
10
2
1
2
d ()
A
B
C
D
E
dist. tables recv’d from neighbors
dest
inat
ions
computation at E
E’s computeddistance
tabledistance
table E sends to its neighbors
A: 10
B: 8
C: 4
D: 2
E: 0
Table below shows just one step done by EThe algorithm repeats forever!
10 15
A B D
0 7
A B D
10 8 2
7 0
1 2
0
A: 10
B: 8
C: 4
D: 2
17 8
9 4
2
E
Chapter 5: Network Layer: Routing
#16
Distance Table: example
A
E D
CB7
8
1
2
1
2
D ()
A
B
C
D
A
1
7
6
4
B
14
8
9
11
D
5
5
4
2
Ecost to destination via
dest
inat
ion
D (C,D)E
c(E,D) + min {D (C,w)}D
w== 2+2 = 4
D (A,D)E
c(E,D) + min {D (A,w)}D
w== 2+3 = 5
D (A,B)E
c(E,B) + min {D (A,w)}B
w== 8+6 = 14
loop!
(why not 15?)
Chapter 5: Network Layer: Routing
#17
Distance table gives routing table
D ()
A
B
C
D
A
1
7
6
4
B
14
8
9
11
D
5
5
4
2
Ecost to destination via
dest
inat
ion
A
B
C
D
A,1
D,5
D,4
D,2
Outgoing link to use, cost to dest
dest
inat
ion
Distance table Routing table
Chapter 5: Network Layer: Routing
#18
Distance Vector Routing: overview
Iterative, asynchronous: each local iteration caused by:
local link cost change message from neighbor:
its least cost path change from neighbor
Distributed: each node notifies
neighbors only when its least cost path to any destination changes neighbors then notify
their neighbors if necessary
wait for (change in local link cost or msg from neighbor)
recompute distance table
if least cost path to any dest
has changed, notify all neighbors
Each node:
Chapter 5: Network Layer: Routing
#19
Distance Vector Algorithm:
1 Initialization: 2 for all adjacent nodes v: 3 DX(*,v) = ∞ /* “*” means "for all rows" */ 4 DX(v,v) = c(X,v) 5 for all destinations, y 6 send minw DX(y,w) to each neighbor /* w over all X's neighbors */
At all nodes, X:
Chapter 5: Network Layer: Routing
#20
Distance Vector Algorithm (cont.):8 loop 9 wait (until a link cost C(X,V) change to neighbor V 10 or until receive update from neighbor V) 11 12 if (c(X,V) changes by d) 13 /* change cost to all dest's via neighbor v by adding d */ 14 /* note: d could be positive or negative */ 15 for all destinations y: DX(y,V) = DX(y,V) + d 16 17 else if (update received from V wrt destination Y) 18 /* shortest path from V to some Y has changed */ 19 /* V has sent a new value for its minw DV(Y,w) */ 20 /* call this received new value is "newval" */ 21 for the single destination Y, D (Y,V) = c(X,V) + newval 22 23 if minw DX(Y,w) for any destination Y changed,24 send new value of minw DX(Y,w) to all neighbors 25 26 forever
X
Chapter 5: Network Layer: Routing
#21
Distance Vector Algorithm: example
X Z12
7
Y
D (Y,Z)X
c(X,Z) + min {D (Y,w)}w=
= 7+1 = 8
Z
D (Z,Y)X
c(X,Y) + min {D (Z,w)}w=
= 2+1 = 3
Y
Chapter 5: Network Layer: Routing
#22
Distance Vector Algorithm: example
X Z12
7
Y
Chapter 5: Network Layer: Routing
#23
Distance Vector: link cost changes
Link cost changes: node detects local link cost
change updates distance table (line 15) if cost change in least cost path,
notify neighbors (lines 23,24)
we show distance to X only
X Z14
50
Y1
algorithmterminates“good
news travelsfast”
report 1 report 2
Chapter 5: Network Layer: Routing
#24
Distance Vector: link cost changes
Link cost changes: good news travels fast bad news travels slow -
“count to infinity” problem!
we show distance to X only
X Z14
50
Y60
algorithmcontinues
on!
Y Y Y
report 6report 7
Chapter 5: Network Layer: Routing
#25
Distance Vector: poisoned reverseIf Z routes through Y to get to X
(= Z learned its best dist. to X from Y):
Z tells Y its (Z’s) distance to X is infinite (so Y won’t route to X via Z)
will this completely solve count to infinity problem?
X Z14
50
Y60
algorithmterminatesY Y Y Y
Chapter 5: Network Layer: Routing
#26
Comparison of LS and DV algorithms
Message complexity LS: with n nodes, E links,
O(nE) msgs sent DV: exchange between
neighbors only but larger msgs
Speed of Convergence LS: requires O(nE) msgs
may have oscillations
DV: convergence time varies may have routing loops count-to-infinity problem
Robustness: what happens if router malfunctions?
LS: node can advertise
incorrect link cost each node computes only
its own table
DV: DV node can advertise
incorrect path cost each node’s table used by
others • error propagates thru
network
Broadcast and Multicast Routing
Chapter 5: Network Layer: Routing
#27
R1
R2
R3 R4
sourceduplication
R1
R2
R3 R4
in-networkduplication
duplicatecreation/transmissionduplicate
duplicate
Broadcast Routing Deliver packets from source to all other nodes Source duplication is inefficient:
Source duplication: how does source determine recipient addresses
Chapter 5: Network Layer: Routing
#28
In-network duplication
Flooding: when node receives brdcst pckt, sends copy to all neighbors Problems: cycles & broadcast storm
Controlled flooding: node only brdcsts pkt if it hasn’t brdcst same packet before Node keeps track of pckt ids already brdcsted Or reverse path forwarding (RPF): only forward
pckt if it arrived on shortest path between node and source
Spanning tree No redundant packets received by any node
Chapter 5: Network Layer: Routing
#29
A
B
G
DE
c
F
A
B
G
DE
c
F
(a) Broadcast initiated at A (b) Broadcast initiated at D
Spanning Tree
First construct a spanning tree Nodes forward copies only along
spanning tree
Chapter 5: Network Layer: Routing
#30
A
B
G
DE
c
F1
2
3
4
5
(a) Stepwise construction of spanning tree
A
B
G
DE
c
F
(b) Constructed spanning tree
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
Chapter 5: Network Layer: Routing
#31
Multicast Routing: Problem Statement Goal: find a tree (or trees) connecting
routers having local mcast group members tree: not all paths between routers used source-based: different tree from each sender to rcvrs shared-tree: same tree used by all group members
Shared tree Source-based treesChapter 5: Network Layer:
Routing#32
Approaches for building mcast treesApproaches: source-based tree: one tree per source
shortest path trees reverse path forwarding
group-shared tree: group uses one tree minimal spanning (Steiner) center-based trees
…we first look at the basic approaches
Chapter 5: Network Layer: Routing
#33
Shortest Path Tree
mcast forwarding tree: tree of shortest path routes from source to all receivers Dijkstra’s algorithm
R1
R2
R3
R4
R5
R6 R7
21
6
3 4
5
i
router with attachedgroup member
router with no attachedgroup member
link used for forwarding,i indicates order linkadded by algorithm
LEGENDS: source
Chapter 5: Network Layer: Routing
#34
Reverse Path Forwarding
if (mcast datagram received on incoming link on shortest path back to center)
then flood datagram onto all outgoing links else ignore datagram
rely on router’s knowledge of unicast shortest path from it to sender
each router has simple forwarding behavior:
Chapter 5: Network Layer: Routing
#35
Reverse Path Forwarding: example
• result is a source-specific reverse SPT– may be a bad choice with asymmetric links
R1
R2
R3
R4
R5
R6 R7
router with attachedgroup member
router with no attachedgroup member
datagram will be forwarded
LEGENDS: source
datagram will not be forwarded
Chapter 5: Network Layer: Routing
#36
Reverse Path Forwarding: pruning forwarding tree contains subtrees with no mcast
group members no need to forward datagrams down subtree “prune” msgs sent upstream by router with
no downstream group members
R1
R2
R3
R4
R5
R6 R7
router with attachedgroup member
router with no attachedgroup member
prune message
LEGENDS: source
links with multicastforwarding
P
P
P
Chapter 5: Network Layer: Routing
#37
Shared-Tree: Steiner Tree
Steiner Tree: minimum cost tree connecting all routers with attached group members
problem is NP-complete excellent heuristics exists not used in practice:
computational complexity information about entire network needed monolithic: rerun whenever a router needs
to join/leave
Chapter 5: Network Layer: Routing
#38
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
Chapter 5: Network Layer: Routing
#39
Center-based trees: an example
Suppose R6 chosen as center:
R1
R2
R3
R4
R5
R6 R7
router with attachedgroup member
router with no attachedgroup member
path order in which join messages generated
LEGEND
21
3
1
Chapter 5: Network Layer: Routing
#40
Hierarchical Routing
Chapter 5: Network Layer: Routing
#41
Hierarchical Routing
scale: with 200 million destinations:
can’t store all dest’s in routing tables!
routing table exchange would swamp links!
administrative autonomy
internet = network of networks
each network admin may want to control routing in its own network
Our routing study thus far - idealization all routers identical network “flat”… not true in practice
Chapter 5: Network Layer: Routing
#42
Hierarchical Routing
aggregate routers into regions, “autonomous systems” (AS)
routers in same AS run same routing protocol “intra-AS” routing
protocol routers in different AS
can run different intra-AS routing protocol
Gateway router Direct link to router
in another AS
Chapter 5: Network Layer: Routing
#43
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
Forwarding table is configured by both intra- and inter-AS routing algorithm Intra-AS sets entries
for internal dests Inter-AS & Intra-As
sets entries for external dests
Chapter 5: Network Layer: Routing
#44
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
3c
Inter-AS tasks Suppose router in
AS1 receives datagram for which dest is outside of AS1 Router should forward
packet towards on of the gateway routers, but which one?
AS1 needs:1. to learn which dests
are reachable through AS2 and which through AS3
2. to propagate this reachability info to all routers in AS1
Job of inter-AS routing!
Chapter 5: Network Layer: Routing
#45
Example: Setting forwarding table in router 1d
Suppose AS1 learns from the inter-AS protocol that subnet x is reachable from AS3 (gateway 1c) but not from 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.
Puts in forwarding table entry (x,I).
Chapter 5: Network Layer: Routing
#46
Learn from inter-AS protocol that subnet x is reachable via multiple gateways
Use routing infofrom intra-AS
protocol to determine
costs of least-cost paths to each
of the gateways
Hot potato routing:Choose the
gatewaythat has the
smallest least cost
Determine fromforwarding table the interface I that leads
to least-cost gateway. Enter (x,I) in
forwarding table
Example: Choosing among multiple ASes
Now suppose AS1 learns from the 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 the job on inter-AS routing protocol! Hot potato routing: send packet towards closest
of two routers.
Chapter 5: Network Layer: Routing
#47
Chapter 5: Network Layer: Routing
#48
Intra-AS and Inter-AS routing
Gateways:•perform inter-AS routing amongst themselves•perform intra-AS routers with other routers in their AS
inter-AS, intra-AS routing in
gateway A.c
network layer
link layer
physical layer
a
b
b
aaC
A
Bd
A.a
A.c
C.bB.a
cb
c
Chapter 5: Network Layer: Routing
#49
Intra-AS and Inter-AS routing
Host h2
a
b
b
aaC
A
Bd c
A.a
A.c
C.bB.a
cb
Hosth1
Intra-AS routingwithin AS A
Inter-AS routingbetween A and B
Intra-AS routingwithin AS B
We’ll examine specific inter-AS and intra-AS Internet routing protocols shortly
Chapter 5: Network Layer: Routing
#50
Routing: Example
AS A(OSPF)
AS B(OSPF intra routing)
AS D
AS Ci
b
b->i: I can reach hosts
in D; my path: BCD
a1
a2
d
d->a2: I
can re
ach
hosts in
D; m
y path: D
a1->i: I can reach hosts
in D; my path: AD
E
F
Export to E: i->e: I can
reach hosts in D; path: IBCD
AS I
a2->a1: I can reach
hosts in D; path: D
choose BCD
using i2
b->i2: I can reach hosts
in D; my path: BCD
i2
i2->i: I can reach
hosts in D; path: BCD
No Exportto F
Chapter 5: Network Layer: Routing
#51
Routing: Example
AS A(OSPF)
AS B(OSPF intra routing)
AS D
AS C
i
b
How to specify?
a1
a2
d
a1->i: I can
reachhosts in D; my
path: AD
E
F
AS I
d1
d2
Chapter 5: Network Layer: Routing
#52
Routing in the Internet
The Global Internet consists of Autonomous Systems (AS) interconnected with each other: Stub AS: small corporation Multihomed AS: large corporation (no transit) Transit AS: provider
Two-level routing: Intra-AS: administrator is responsible for choice Inter-AS: unique standard
Chapter 5: Network Layer: Routing
#53
Internet AS HierarchyInter-AS border (exterior gateway) routers
Intra-AS interior (gateway) routers
Chapter 5: Network Layer: Routing
#54
Intra-AS Routing
Also known as Interior Gateway Protocols (IGP) Most common IGPs:
RIP: Routing Information Protocol
OSPF: Open Shortest Path First
IGRP: Interior Gateway Routing Protocol (Cisco propr.)
Chapter 5: Network Layer: Routing
#55
RIP ( Routing Information Protocol)
Distance vector algorithm RIP messages sent using UDP Included in BSD-UNIX Distribution in 1982 Distance metric: # of hops (max = 15 hops)
why?
Distance vectors: exchanged every 30 sec via Response Message (also called advertisement)
Each advertisement: route to up to 25 destination nets
Chapter 5: Network Layer: Routing
#56
RIP (Routing Information Protocol)
Destination Network Next Router Num. of hops to dest. w A 2
y B 2 z B 7
x -- 1…. …. ....
w x y
z
A
C
D B
Routing table in D
Chapter 5: Network Layer: Routing
#57
RIP: Link Failure and 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)
Chapter 5: Network Layer: Routing
#58
OSPF (Open Shortest Path First)
“open”: publicly available Uses Link State algorithm
LS packet dissemination Topology map at each node Route computation using Dijkstra’s algorithm
OSPF advertisement carries one entry per neighbor router
Advertisements disseminated to entire AS (via flooding)
Chapter 5: Network Layer: Routing
#59
OSPF “advanced” features (not in RIP)
Security: all OSPF messages authenticated (to prevent malicious intrusion); TCP connections used
Multiple same-cost paths allowed only one path in RIP
For each link, multiple cost metrics for different ToS (eg, satellite link cost set “low” for best effort; high for real time)
Integrated uni- and multicast support: Multicast OSPF (MOSPF) uses same topology data base
as OSPF
Hierarchical OSPF in large domains.
Chapter 5: Network Layer: Routing
#60
Hierarchical OSPF
Chapter 5: Network Layer: Routing
#61
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.
Chapter 5: Network Layer: Routing
#62
IGRP (Interior Gateway Routing Protocol) CISCO proprietary; successor of RIP (mid 80s) Distance Vector, like RIP several cost metrics (delay, bandwidth,
reliability, load etc) uses TCP to exchange routing updates Loop-free routing via Distributed Updating Alg.
(DUAL) based on diffused computation
Chapter 5: Network Layer: Routing
#63
Inter-AS routing
Chapter 5: Network Layer: Routing
#64
Internet inter-AS routing: BGP
BGP (Border Gateway Protocol): the de facto standard
Path Vector protocol: similar to Distance Vector protocol each Border Gateway broadcast to
neighbors (peers) entire path (i.e., sequence of ASs) to destination
E.g., Gateway X may send its path to dest. Z:
Path (X,Z) = X,Y1,Y2,Y3,…,Z
Chapter 5: Network Layer: Routing
#65
Internet inter-AS routing: BGP
Suppose: gateway X sends its path to peer gateway W
W may or may not select path offered by X cost, policy (don’t route via competitor’s AS),
loop prevention reasons.
If W selects path advertised by X, then:Path (W,Z) = W, Path (X,Z)
Note: X can control incoming traffic by controlling its route advertisements to peers: e.g., don’t want to route traffic to Z -> don’t
advertise any routes to Z
Chapter 5: Network Layer: Routing
#66
Internet inter-AS routing: BGP
BGP messages exchanged using TCP. BGP messages:
OPEN: opens TCP connection to peer and authenticates sender
UPDATE: advertises new path (or withdraws old)
KEEPALIVE keeps connection alive in absence of UPDATES; also ACKs OPEN request
NOTIFICATION: reports errors in received msg; also used to close connection
Chapter 5: Network Layer: Routing
#67
Why different Intra- and Inter-AS routing ?
Policy: Inter-AS: admin wants control over how its traffic
routed, who routes through its net. Intra-AS: single admin, so no policy decisions
needed
Scale: hierarchical routing saves table size, reduced
update traffic
Performance: Intra-AS: can focus on performance Inter-AS: policy may dominate over performance