Download presentation
Presentation is loading. Please wait.
1
1 Computer Networks Network Layer (Part 1)
2
2 Last classes Data-link layer –Functions –Specific implementations, devices
3
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
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 network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical application transport network data link physical application transport network data link physical
5
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
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
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
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
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.htmlCharacteristics of Fragmented IP Traffic on Internet Linkshttp://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 http://www.research.compaq.com/wrl/techreports/abstracts/87.3.html
10
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
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: service abstraction
12
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
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 transport network data link physical application transport network data link physical 1. Initiate call 2. incoming call 3. Accept call 4. Call connected 5. Data flow begins 6. Receive data
14
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 transport network data link physical application transport network data link physical 1. Send data 2. Receive data
15
15 NL: Network layer service models: Network Architecture Internet ATM Service Model best effort CBR VBR ABR UBR Bandwidth none constant rate guaranteed rate guaranteed minimum none Loss no yes no Order no yes Timing no yes no Congestion feedback no (inferred via loss) no congestion no congestion yes no Guarantees ? Internet model being extended: Intserv, Diffserv –Chapter 6
16
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
17 NL: Routing Routing algorithms and architectures –Link state algorithms –Distance vector algorithms Routing hierarchies –Area routing –Landmark routing
18
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 E D CB F 2 2 1 3 1 1 2 5 3 5 “good” path: –typically means minimum cost path –other def’s possible
19
19 NL: Routing algorithms Global or decentralized information? Global: all routers have complete topology, link cost info “link state” algorithms Decentralized: 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
20 NL: What to look for in routing algorithms Communication costs Processing costs Optimality Stability –Convergence time –Loop freedom –Oscillation damping
21
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
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
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
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
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
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
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
28 NL: Step 2 (Dijkstra’s algorithm example) AF B DE C 2 2 2 3 1 1 1 3 5 5 B CDEF
29
29 NL: Step 2 (Dijkstra’s algorithm example) AF B DE C 2 2 2 3 1 1 1 3 5 5 B CDEF
30
30 NL: Step 2 (Dijkstra’s algorithm example) AF B DE C 2 2 2 3 1 1 1 3 5 5 B CDEF
31
31 NL: Step 2 (Dijkstra’s algorithm example) AF B DE C 2 2 2 3 1 1 1 3 5 5 B CDEF
32
32 NL: Step 2 (Dijkstra’s algorithm example) AF B DE C 2 2 2 3 1 1 1 3 5 5 B CDEF
33
33 NL: Step 2 (Dijkstra’s algorithm example) AF B DE C 2 2 2 3 1 1 1 3 5 5 B CDEF
34
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 52 1 Packet from C A may loop around BDC if B knows about failure and C & D do not X
35
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 B 1 1+e e 0 e 1 1 0 0 A D C B 2+e 0 0 0 1+e 1 A D C B 0 2+e 1+e 1 0 0 A D C B 2+e 0 e 0 1+e 1 initially … recompute routing … recompute
36
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
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 to Y, 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
38 NL: Distance Table: example A E D CB 7 8 1 2 1 2 D () A B C D A1764A1764 B 14 8 9 11 D5542D5542 E cost to destination via destination 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! H (Y) = X
39
39 NL: Distance table gives routing table D () A B C D A1764A1764 B 14 8 9 11 D5542D5542 E cost to destination via destination ABCD ABCD A,1 D,5 D,4 Outgoing link to use, cost destination Distance table Routing table H (Y) X
40
40 D j (k,*) NL: Bellman algorithm ij 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 { D i (k,j) = c(i,j) + D j (k,*) if D i (k,j) < D i (k,*) { D i (k,*) = D i (k,j) H i (k) = j } D j’ (k,*) D i (k,*)
41
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
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
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 */ X X X w At all nodes, X:
44
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 D V (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 X X X X X w w
45
45 NL: DBF example A B E C D Info at Node A B C D ABC 07~ 701 ~10 ~~2 7 1 1 2 28 Distance to Node D ~ ~ 2 0 E18~2 1 8 ~ 2 0 E Initial Distance Vectors
46
46 NL: DBF example Info at Node A B C D ABC 07~ 701 ~10 ~~2 Distance to Node D ~ ~ 2 0 E1842 1 8 ~ 2 0 E A B E C D 7 1 1 2 28 E Receives D’s Routes; Updates Cost
47
47 NL: DBF example Info at Node A B C D ABC 078 701 ~10 ~~2 Distance to Node D ~ ~ 2 0 E1842 1 8 ~ 2 0 E A B E C D 7 1 1 2 28 A receives B’s; Updates Cost
48
48 NL: DBF example Info at Node A B C D ABC 075 701 ~10 ~~2 Distance to Node D 3 ~ 2 0 E1842 1 8 ~ 2 0 E A B E C D 7 1 1 2 28 A receives E’s routes; Updates Costs
49
49 NL: DBF example Info at Node A B C D ABC 065 601 510 332 Distance to Node D 3 3 2 0 E1542 1 5 4 2 0 E A B E C D 7 1 1 2 28 Final Distances
50
50 NL: DBF example dest A B C D ABD 1145 785 694 4112 Next hop E’s routing table A B E C D 7 1 1 2 28
51
51 NL: DBF (another example) X Z 1 2 7 Y See book for explanation of this example
52
52 NL: DBF (another example) X Z 1 2 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
53
53 NL: DBF (good news example) 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) See book for explanation of this example X Z 1 4 50 Y 1 algorithm terminates “good news travels fast”
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.