1 computer networks network layer (part 1). 2 last classes data-link layer –functions –specific...
Post on 19-Dec-2015
223 views
TRANSCRIPT
3
Next classes
• Network layer– Functions
• Addressing• Security• Fragmentation• Delivery semantics• Quality of service• Routing• Demux to upper layer• Error detection
– Specific implementations• IP• Router devices, implementations
4
Network layer functions• Transport packet from
sending to receiving hosts
• Network layer protocols in every host, router
• Important functions:– Addressing: address assignment– Security: provide privacy,
authentication, etc. at the network layer
– Fragmentation: break-up packets based on data-link layer properties
– Delivery semantics: unicast, multicast, anycast, broadcast, ordering
– Quality-of-service: provide predictable performance
– Routing: path selection and packet forwarding
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
application
transportnetworkdata linkphysical
application
transportnetworkdata linkphysical
5
NL: Addressing
• Hierarchical vs. flat– Routing table size
• Global vs. local– Applications (NAT)– Processing speed
• Variable-length vs. fixed-length– Flexibility– Processing costs – Header size
6
NL: Security
• Secrecy– No eavesdropping
• Integrity– No man-in-the-middle attacks
• Authenticity– Ensure identity of source
• If time permits, we will look at network security at the end of course…..
7
NL: Fragmentation
• Different link-layers have different MTUs • Split packets into multiple fragments• Where to do reassembly?
– End nodes – avoids unnecessary work– Dangerous to do at intermediate nodes
• Buffer space• Must assume single path through network• May be re-fragmented later on in the route again
• Path MTU Discovery– Network layer does no fragmentation– Host does Path MTU discovery
8
NL: Fragmentation is Harmful
• Uses resources poorly– Forwarding costs per packet– Best if we can send large chunks of data– Worst case: packet just bigger than MTU
• Poor end-to-end performance– Loss of a fragment
• Reassembly is hard– Buffering constraints
9
NL: Fragmentation
• References– Characteristics of Fragmented IP Traffic on Internet Links.
Colleen Shannon, David Moore, and k claffy -- CAIDA, UC San Diego. ACM SIGCOMM Internet Measurement Workshop 2001. http://www.aciri.org/vern/sigcomm-imeas-2001.program.html
– C. A. Kent and J. C. Mogul, "Fragmentation considered harmful," in Proceedings of the ACM Workshop on Frontiers in Computer Communications Technology, pp. 390--401, Aug. 1988. http://www.research.compaq.com/wrl/techreports/abstracts/87.3.html
10
NL: Delivery semantics
• Communication modes– Unicast (One source to one destination)
– Anycast (One source to any of a set of destinations)
– Multicast (One or more sources to a set of destinations)
– Broadcast (One source to all destinations)
• Ordering– In-order vs. out-of-order delivery
• If time permits, we will look at multicast at the end of the course.
11
NL: Quality-of-Service
Q: What service model for “channel” transporting packets from sender to receiver?
• guaranteed bandwidth?• preservation of inter-packet
timing (no jitter)?• loss-free delivery?• in-order delivery?• congestion feedback to
sender?
? ??virtual circuit
or datagram?
The most important abstraction provided
by network layer:
serv
ice a
bst
ract
ion
12
NL: Virtual circuits
• call setup, teardown for each call before data can flow• each packet carries VC identifier (not destination host OD)• every router on source-dest path s maintain “state” for each passing
connection– transport-layer connection only involved two end systems
• link, router resources (bandwidth, buffers) may be allocated to VC– to get circuit-like perf.
“source-to-dest path behaves much like telephone circuit”– performance-wise
– network actions along source-to-dest path
13
NL: Virtual circuits: signaling protocols
• used to setup, maintain teardown VC
• used in ATM, frame-relay, X.25
• not used in today’s Internet on an end-to-end basis
application
transportnetworkdata linkphysical
application
transportnetworkdata linkphysical
1. Initiate call 2. incoming call
3. Accept call4. Call connected5. Data flow begins 6. Receive data
14
NL: Datagram networks: the Internet model
• no call setup at network layer
• routers: no state about end-to-end connections– no network-level concept of “connection”
• packets typically routed using destination host ID– packets between same source-dest pair may take different paths
application
transportnetworkdata linkphysical
application
transportnetworkdata linkphysical
1. Send data 2. Receive data
15
NL: Network layer service models:
NetworkArchitecture
Internet
ATM
ATM
ATM
ATM
ServiceModel
best effort
CBR
VBR
ABR
UBR
Bandwidth
none
constantrateguaranteedrateguaranteed minimumnone
Loss
no
yes
yes
no
no
Order
no
yes
yes
yes
yes
Timing
no
yes
yes
no
no
Congestionfeedback
no (inferredvia loss)nocongestionnocongestionyes
no
Guarantees ?
• Internet model being extended: Intserv, Diffserv– Chapter 6
16
NL: Datagram or VC network: why?
Internet• data exchange among computers
– “elastic” service, no strict timing req.
• “smart” end systems (computers)
– can adapt, perform control, error recovery
– simple inside network, complexity at “edge”
• many link types
– different characteristics
– uniform service difficult
ATM• evolved from telephony
• human conversation:
– strict timing, reliability requirements
– need for guaranteed service
• “dumb” end systems
– telephones
– complexity inside network
17
NL: Routing
• Routing algorithms and architectures– Link state algorithms– Distance vector algorithms
• Routing hierarchies– Area routing– Landmark routing
18
NL: Routing algorithms
Graph abstraction for routing algorithms:
• graph nodes are routers
• graph edges are physical links– link cost: delay, $ cost,
or congestion level
Goal: determine “good” path
(sequence of routers) thru network from source to
dest.
Routing protocol
A
ED
CB
F
2
2
13
1
1
2
53
5
• “good” path:– typically means
minimum cost path
– other def’s possible
19
NL: Routing algorithms
Global or decentralized information?
Global:• all routers have complete
topology, link cost info• “link state” algorithmsDecentralized: • router knows physically-
connected neighbors, link costs to neighbors
• iterative process of computation, exchange of info with neighbors
• “distance vector” algorithms
Static or dynamic?Static:
• routes change slowly over time
Dynamic:
• routes change more quickly
– periodic update
– in response to link cost changes
20
NL: What to look for in routing algorithms
• Communication costs
• Processing costs
• Optimality
• Stability– Convergence time– Loop freedom– Oscillation damping
21
NL: Link state routing algorithms
• Used in OSPF (intra-domain routing protocol)• Basic steps• Start condition
– Each node assumed to know state of links to its neighbors
• Step 1– Each node broadcasts its state to all other nodes– Reliable flooding mechanism
• Step 2– Each node locally computes shortest paths to all other nodes
from global state– Dijkstra’s shortest path tree (SPT) algorithm
22
NL: Step 1
• Link State Packets (LSPs) to broadcast state to all nodes
• Periodically, each node creates a link state packet containing:– Node ID– List of neighbors and link cost– Sequence number– Time to live (TTL)– Node outputs LSP on all its links
23
NL: Step 1
• Reliable Flooding – When node J receives LSP from node K
• If LSP is the most recent LSP from K that J has seen so far, J saves it in database and forwards a copy on all links except link LSP was received on
• Otherwise, discard LSP
– How to tell more recent• Use sequence numbers
• Same method as sliding window protocols
• Needed to avoid stale information from flood
• Sequence number wrap-around
• Lollipop sequence space
24
NL: Step 1 and wrapped sequence numbers
• Wrapped sequence numbers– 0-N where N is large– If difference between numbers is large, assume a
wrap– A is older than B if….
• A < B and |A-B| < N/2 or…• A > B and |A-B| > N/2
• What about new nodes out of sync with sequence number space?
• Lollipop sequence (Perlman 1983)
25
NL: Step 1 and lollipop sequence numbers
• Divide sequence number space• Special negative sequence for recovering from reboot• When receiving an old number, nodes inform new node of current sequence number• A older than B if
– A < 0 and A < B– A > 0, A < B and (B – A) < N/4– A > 0, A > B and (A – B) > N/4
0-N/2
N/2 - 1
26
NL: Step 2
Dijkstra’s algorithm• all link costs on the network
are known• 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): predecessor node along path from source to v, that is next v
• N: set of nodes whose least cost path definitively known
A Link-state routing algorithm
27
NL: Step 2 (Dijkstra’s algorithm example)
1 Initialization: 2 N = {A} 3 for all nodes v 4 if v adjacent to A 5 then D(v) = c(A,v) 6 else D(v) = infinity 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) ) 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
28
NL: Step 2 (Dijkstra’s algorithm example)
A F
B
D E
C2
2
2
3
1
1
1
3
5
step SPT D(b), P(b) D(c), P(c) D(d), P(d) D(e), P(e) D(f), P(f)0 A 2, A 5, A 1, A ~ ~
5
B C D E F
29
NL: Step 2 (Dijkstra’s algorithm example)
A F
B
D E
C2
2
2
3
1
1
1
3
5
step SPT D(b), P(b) D(c), P(c) D(d), P(d) D(e), P(e) D(f), P(f)0 A 2, A 5, A 1, A ~ ~1 AD 2, A 4, D 2, D ~
5
B C D E F
30
NL: Step 2 (Dijkstra’s algorithm example)
A F
B
D E
C2
2
2
3
1
1
1
3
5
step SPT D(b), P(b) D(c), P(c) D(d), P(d) D(e), P(e) D(f), P(f)0 A 2, A 5, A 1, A ~ ~1 AD 2, A 4, D 2, D ~2 ADE 2, A 3, E 4, E
5
B C D E F
31
NL: Step 2 (Dijkstra’s algorithm example)
A F
B
D E
C2
2
2
3
1
1
1
3
5
step SPT D(b), P(b) D(c), P(c) D(d), P(d) D(e), P(e) D(f), P(f)0 A 2, A 5, A 1, A ~ ~1 AD 2, A 4, D 2, D ~2 ADE 2, A 3, E 4, E3 ADEB 3, E 4, E
5
B C D E F
32
NL: Step 2 (Dijkstra’s algorithm example)
A F
B
D E
C2
2
2
3
1
1
1
3
5
step SPT D(b), P(b) D(c), P(c) D(d), P(d) D(e), P(e) D(f), P(f)0 A 2, A 5, A 1, A ~ ~1 AD 2, A 4, D 2, D ~2 ADE 2, A 3, E 4, E3 ADEB 3, E 4, E4 ADEBC 4, E
5
B C D E F
33
NL: Step 2 (Dijkstra’s algorithm example)
A F
B
D E
C2
2
2
3
1
1
1
3
5
step SPT D(b), P(b) D(c), P(c) D(d), P(d) D(e), P(e) D(f), P(f)0 A 2, A 5, A 1, A ~ ~1 AD 2, A 4, D 2, D ~2 ADE 2, A 3, E 4, E3 ADEB 3, E 4, E4 ADEBC 4, E5 ADEBCF
5
B C D E F
34
NL: Link State Characteristics
• With consistent LSDBs, all nodes compute consistent loop-free paths
• Limited by Dijkstra computation overhead, space requirements
• Can still have transient loops
A
B
C
D
1
3
5 2
1
Packet from CAmay loop around BDCif B knows about failureand C & D do not
X
35
NL: 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(n**2)• more efficient implementations possible: O(nlogn)
Oscillations possible:• e.g., link cost = amount of carried traffic
A
D
C
B1 1+e
e0
e
1 1
0 0
A
D
C
B2+e 0
001+e1
A
D
C
B0 2+e
1+e10 0
A
D
C
B2+e 0
e01+e1
initially… recompute
routing… recompute … recompute
36
NL: Distance vector routing algorithms
• Variants used in– Early ARPAnet– RIP (intra-domain routing protocol)– BGP (inter-domain routing protocol)
• Distributed next hop computation
• Unit of information exchange– Vector of distances to destinations
37
NL: Distance vector routing algorithms
• Exchange known distance information iteratively• Example (Bellman 1957)
– Start with link table (as with Dijkstra), calculate distance table iteratively through table exchanges with adjacent nodes– Distance table data structure
• table of known distances and next hops kept per node• 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
=
=
D (Y,*)X Minimum known
distance from X to Y=
H (Y)X
=Next hop node from X to Y
38
NL: 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!
loop! H (Y) = X
39
NL: 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,4
Outgoing link to use, cost
dest
inat
ion
Distance table Routing table
H (Y)X
40
Dj(k,*)
NL: Bellman algorithm
i j
k
j’ k’
c(i,j)
c(i,j’)
while there is a change in D {
for all k not neighbor of i { for each j neighbor of i {
Di(k,j) = c(i,j) + Dj(k,*)
if Di(k,j) < Di(k,*) {
Di(k,*) = Di(k,j)
Hi(k) = j } } }}
Dj’(k,*)
Di(k,*)
41
NL: Distributed Bellman-Ford
• Make Bellman algorithm distributed (Ford-Fulkerson 1962)– Each node i knows part of link table– Iterative
• Each node sends around and recalculates D[i,*]• continues until no nodes exchange info.• self-terminating: no “signal” to stop
– Asynchronous• nodes need not exchange info/iterate in lock step!• “triggered updates”
– Distributed• each node communicates only with directly-attached neighbors
42
NL: Distributed Bellman-Ford 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 of msg from neighbor)
recompute distance table
if least cost path to any dest
has changed, notify neighbors
Each node:
43
NL: Distributed Bellman-Ford algorithm
1 Initialization: 2 for all adjacent nodes v: 3 D (*,v) = infinity /* the * operator means "for all rows" */ 4 D (v,v) = c(X,v) 5 for all destinations, y 6 send min D (y,w) to each neighbor /* w over all X's neighbors */
XX
Xw
At all nodes, X:
44
NL: Distributed Bellman-Ford algorithm (cont.):8 loop 9 wait (until I see a link cost change to neighbor V 10 or until I 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 d */ 14 /* note: d could be positive or negative */ 15 for all destinations y: D (y,V) = D (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 min 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 we have a new min D (Y,w)for any destination Y 24 send new value of min D (Y,w) to all neighbors 25 26 forever
w
XX
XX
X
w
w
45
NL: DBF example
A
B
E
C
D
Info atNode
A
B
C
D
A B C
0 7 ~
7 0 1
~ 1 0
~ ~ 2
7
1
1
2
28
Distance to Node
D
~
~
2
0
E 1 8 ~ 2
1
8
~
2
0
E
Initial Distance Vectors
46
NL: DBF example
Info atNode
A
B
C
D
A B C
0 7 ~
7 0 1
~ 1 0
~ ~ 2
Distance to Node
D
~
~
2
0
E 1 8 4 2
1
8
~
2
0
E
A
B
E
C
D
7
1
1
2
28
E Receives D’s Routes; Updates Cost
47
NL: DBF example
Info atNode
A
B
C
D
A B C
0 7 8
7 0 1
~ 1 0
~ ~ 2
Distance to Node
D
~
~
2
0
E 1 8 4 2
1
8
~
2
0
E
A
B
E
C
D
7
1
1
2
28
A receives B’s; Updates Cost
48
NL: DBF example
Info atNode
A
B
C
D
A B C
0 7 5
7 0 1
~ 1 0
~ ~ 2
Distance to Node
D
3
~
2
0
E 1 8 4 2
1
8
~
2
0
E
A
B
E
C
D
7
1
1
2
28
A receives E’s routes; Updates Costs
49
NL: DBF example
Info atNode
A
B
C
D
A B C
0 6 5
6 0 1
5 1 0
3 3 2
Distance to Node
D
3
3
2
0
E 1 5 4 2
1
5
4
2
0
E
A
B
E
C
D
7
1
1
2
28
Final Distances
50
NL: DBF example
dest
A
B
C
D
A B D
1 14 5
7 8 5
6 9 4
4 11 2
Next hop
E’s routing table
A
B
E
C
D
7
1
1
2
28
E’s routing table
52
NL: DBF (another 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