1 Computer Networks Lecture 5: Network Layer June 2009.

Slides:



Advertisements
Similar presentations
4: Network Layer4a-1 IP Addressing: introduction r IP address: 32-bit identifier for host, router interface r interface: connection between host, router.
Advertisements

Data Communication and Networks Lecture 11 Internet Routing Algorithms and Protocols December 5, 2002 Joseph Conron Computer Science Department New York.
10/28/ /30/2003 Network Layer, Routing, IP October 28-30, 2003.
Routing - I Important concepts: link state based routing, distance vector based routing.
Network Layer-11 CSE401N: Computer Networks Lecture-9 Network Layer & Routing.
Network Layer4-1 Computer Networking (Datakom) Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing.
Announcement r Project 2 due Fri. midnight r Homework 3 out m Due 2/29 Sun. r Advertisement for my CS395/495 course next quarter: Computer Network Security:
Chapter 4 Network Layer slides are modified from J. Kurose & K. Ross CPE 400 / 600 Computer Communication Networks Lecture 14.
11- IP Network Layer4-1. Network Layer4-2 The Internet Network layer forwarding table Host, router network layer functions: Routing protocols path selection.
Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with.
Network Layer Design Isues Store-and-Forward Packet Switching Services Provided to the Transport Layer The service should be independent of the router.
Network Layer4-1 Chapter 4 Network Layer Computer Networking: A Top Down Approach Featuring the Internet, 3 rd edition. Jim Kurose, Keith Ross Addison-Wesley,
Katz, Stoica F04 EECS 122: Introduction to Computer Networks Link State and Distance Vector Routing Computer Science Division Department of Electrical.
Network Layer4-1 Chapter 4 Network Layer Computer Networking: A Top Down Approach Featuring the Internet, 2 nd edition. Jim Kurose, Keith Ross Addison-Wesley,
Network Layer4-1 Data Communication and Networks Lecture 6 Networks: Part 1 Circuit Switching, Packet Switching, The Network Layer October 13, 2005.
4: Network Layer4a-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing.
Announcement r Project 2 extended to 2/20 midnight r Project 3 available this weekend r Homework 3 available today, will put it online.
Rensselaer Polytechnic Institute © Shivkumar Kalvanaraman & © Biplab Sikdar1 ECSE-4730: Computer Communication Networks (CCN) Network Layer (Routing) Shivkumar.
Lecture 7 Overview. Two Key Network-Layer Functions forwarding: move packets from router’s input to appropriate router output routing: determine route.
4: Network Layer4a-1 14: Intro to Routing Algorithms Last Modified: 7/12/ :17:44 AM.
Announcement r Project 2 Extension ? m Previous grade allocation: Projects 40% –Web client/server7% –TCP stack21% –IP routing12% Midterm 20% Final 20%
Network Layer4-1 Chapter 4: Network Layer r 4. 1 Introduction r 4.2 Virtual circuit and datagram networks r 4.5 Routing algorithms m Link state m Distance.
Announcement r Project 2 due next week! r Homework 3 available soon, will put it online r Recitation tomorrow on Minet and project 2.
EE 122: Intra-domain routing Ion Stoica September 30, 2002 (* this presentation is based on the on-line slides of J. Kurose & K. Rose)
Network Layer4-1 Network layer r transport segment from sending to receiving host r on sending side encapsulates segments into datagrams r on rcving side,
Network Layer4-1 Network layer r transport segment from sending to receiving host r on sending side encapsulates segments into datagrams r on rcving side,
Chapter 4 Network Layer slides are modified from J. Kurose & K. Ross CPE 400 / 600 Computer Communication Networks Lecture 15.
Computer Networking Intra-Domain Routing, Part I RIP (Routing Information Protocol)
Network Layer Goals: understand principles behind network layer services: –routing (path selection) –dealing with scale –how a router works –advanced topics:
4: Network Layer4a-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing.
Data Communications and Computer Networks Chapter 4 CS 3830 Lecture 18 Omar Meqdadi Department of Computer Science and Software Engineering University.
Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m network layer service models m forwarding.
Network Layer4-1 Chapter 4 Network Layer A note on the use of these ppt slides: We’re making these slides freely available to all (faculty, students, readers).
7-1 Last time □ Wireless link-layer ♦ Introduction Wireless hosts, base stations, wireless links ♦ Characteristics of wireless links Signal strength, interference,
1 CSE3213 Computer Network I Network Layer (7.1, 7.3, ) Course page: Slides modified from Alberto Leon-Garcia.
Chapter 4 Network Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012 Network Layer introduction.
Chapter 4 Network Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012 A note on the use of these.
Network Layer4-1 Chapter 4: Network Layer r 4. 1 Introduction r 4.2 Virtual circuit and datagram networks r 4.3 What’s inside a router r 4.4 IP: Internet.
Internet Protocol ECS 152B Ref: slides by J. Kurose and K. Ross.
4: Network Layer4-1 Schedule Today: r Finish Ch3 r Collect 1 st Project r See projects run r Start Ch4 Soon: r HW5 due Monday r Last chance for Qs r First.
The Network Layer & Routing
1 Week 5 Lecture 2 IP Layer. 2 Network layer functions transport packet from sending to receiving hosts transport packet from sending to receiving hosts.
Network Layer4-1 Chapter 4 roadmap 4.1 Introduction and Network Service Models 4.2 Routing Principles 4.3 Hierarchical Routing 4.4 The Internet (IP) Protocol.
Overview of Internet Routing (I) Fall 2004 CS644 Advanced Topics in Networking Sue B. Moon Division of Computer Science Dept. of EECS KAIST.
Network Layer4-1 The Internet Network layer forwarding table Host, router network layer functions: Routing protocols path selection RIP, OSPF, BGP IP protocol.
Transport Layer3-1 Chapter 4: Network Layer r 4. 1 Introduction r 4.2 Virtual circuit and datagram networks r 4.3 What’s inside a router r 4.4 IP: Internet.
Network Layer4-1 Datagram networks r no call setup at network layer r routers: no state about end-to-end connections m no network-level concept of “connection”
Routing 1 Network Layer Network Layer goals:  understand principles behind network layer services:  routing (path selection)  how a router works  instantiation.
Internet Routing r Routing algorithms m Link state m Distance Vector m Hierarchical routing r Routing protocols m RIP m OSPF m BGP.
Switching, Forwarding and Routing. Network layer functions r transport packet from sending to receiving hosts r network layer protocols in every host,
Network Layer4-1 Chapter 4 Network Layer Computer Networking: A Top Down Approach Featuring the Internet, 2 nd edition. Jim Kurose, Keith Ross Addison-Wesley,
The Internet Network layer
4: Network Layer4a-1 Distance Vector Routing Algorithm iterative: r continues until no nodes exchange info. r self-terminating: no “signal” to stop asynchronous:
Data Communications and Computer Networks Chapter 4 CS 3830 Lecture 19 Omar Meqdadi Department of Computer Science and Software Engineering University.
4: Network Layer4-1 Chapter 4: Network Layer Last time: r Chapter Goals m Understand network layer principles and Internet implementation r Started routing.
Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m network layer service models m forwarding.
@Yuan Xue A special acknowledge goes to J.F Kurose and K.W. Ross Some of the slides used in this lecture are adapted from their.
4: Network Layer4a-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing.
IP tutorial - #2 Routing KAIST Dept. of CS NC Lab.
INTRODUCTION NETWORKING CONCEPTS AND ADMINISTRATION CSIS 3723
Network Layer Goals: Overview:
Distance Vector Routing: overview
Network layer functions
Chapter 4 – The Network Layer & Routing
Road Map I. Introduction II. IP Protocols III. Transport Layer
ECE453 – Introduction to Computer Networks
Chapter 4: Network Layer
ECSE-4730: Computer Communication Networks (CCN)
Chapter 4: Network Layer
Chapter 4: Network Layer
Presentation transcript:

1 Computer Networks Lecture 5: Network Layer June 2009

2 References r Text books: m Computer Networking: A Top-Down Approach Featuring the Internet, 2/e by Kurose and Ross

3 Lecture 5: Network Layer Chapter goals: r understand principles behind network layer services: m routing (path selection) m dealing with scale m how a router works r instantiation and implementation in the Internet Overview: r network layer services r IP (Internet Protocol) r routing principles: path selection

4 Outline 4.1 Introduction and Network Service Models 4.2 The Internet (IP) Protocol 4.3 Routing Principles

5 Network layer functions r deliver packets from sending to receiving hosts r network layer protocols in every host, router three important functions: r path determination: route taken by packets from source to dest. Routing algorithms r forwarding: move packets from router’s input to appropriate router output r call setup: some network architectures require router call setup along path before data flows 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

6 Key Network-Layer Functions r forwarding: move packets from router’s input to appropriate router output r routing: determine route taken by packets from source to dest. m Routing algorithms analogy: r routing: process of planning trip from source to dest r forwarding: process of getting through single interchange

value in arriving packet’s header routing algorithm local forwarding table header value output link Interplay between routing and forwarding

8 Network service model Q: What service model for “channel” transporting packets from sender to receiver? r guaranteed bandwidth? r preservation of inter-packet timing (no jitter)? r loss-free delivery? r in-order delivery? r congestion feedback to sender? ? ? ? virtual circuit or datagram? The most important abstraction provided by network layer: service abstraction The complexity of the network layer depends on the service model it provides:

9 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 ? r Internet model being extended: IntServ, DiffServ m multimedia networking ATM: Asynchronous Transfer Mode; CBR: Constant Bit Rate; V: Variable; A: available; U: User

10 Virtual circuits “source-to-dest path behaves much like telephone circuit” m performance-wise m network actions along source-to-dest path 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

11 Virtual circuits r call setup, teardown for each call before data can flow r each packet carries VC identifier (not destination host ID) r every router on source-dest path maintains “state” for each passing connection m transport-layer connection only involved two end systems r link, router resources (bandwidth, buffers) may be allocated to VC m to get circuit-like perf. r used to setup, maintain teardown VC r used in ATM, frame-relay, X.25 r not used in today’s Internet

12 Datagram networks: Internet’s model r no call setup at network layer r routers: no state about end-to-end connections m no network-level concept of “connection” r Forwarded: using destination host address m 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

13 Datagram or VC network: why? Internet (Datagram) r data exchange among computers m “elastic” service, no strict timing req. r “smart” end systems (computers) m can adapt, perform control, error recovery m simple inside network, complexity at “edge” r heterogeneous link types m different characteristics m uniform service difficult Asynchronous Transfer Mode - ATM (VC) r evolved from telephony r human conversation: m strict timing, reliability requirements m need for guaranteed service r “dumb” end systems m telephones m complexity inside network

14 Outline 4.1 Introduction and Network Service Models 4.2 The Internet (IP) Protocol m IPv4 addressing m Moving a datagram from source to destination m Datagram format m IP fragmentation 4.3 Routing Principles

15 The Internet Network layer forwarding table Host, router network layer functions: Routing protocols path selection RIP, OSPF, BGP IP protocol addressing conventions datagram format packet handling conventions ICMP protocol error reporting router “signaling” Transport layer: TCP, UDP Link layer physical layer Network layer

16 IP Addressing: introduction r IP address: 32-bit identifier for host, router interface r interface: connection between host/router and physical link m router’s typically have multiple interfaces m host may have multiple interfaces m IP addresses associated with each interface =

17 IP Addressing r IP address: m network part (high order bits) m host part (low order bits) r What’s a network ? ( from IP address perspective) m device interfaces with same network part of IP address m can physically reach each other without intervening router network consisting of 3 IP networks (for IP addresses starting with 223, first 24 bits are network address) LAN

18 IP Addresses 0 network host 10 network host 110 networkhost 1110 multicast address A B C D class to to to to bits given notion of “network”, let’s re-examine IP addresses: “classful” addressing:

19 IP addressing: CIDR r Classful addressing: m inefficient use of address space, address space exhaustion m e.g., class B net allocated enough addresses for 65K hosts, even if only 2K hosts in that network r CIDR: Classless InterDomain Routing (“cider”) m network portion of address of arbitrary length m address format (1): a.b.c.d/x, where x is # bits in network portion of address network part host part /23

20 IP addressing: CIDR r CIDR: Classless InterDomain Routing m network portion of address of arbitrary length m address format (2): address + mask network part host part / network part host part IP address IP mask

21 Network partitioning r You are given a pool of /24 IP addresses to assign to hosts and routers in the system (right): r How many separate networks are there in the system? r Partition the given address space and assign addresses to the networks.

22 Network partitioning r You are given a pool of /24 IP addresses to assign to hosts and routers in the system (right): r How many separate networks are there in the system? 6 r Partition the given address space and assign addresses to the networks.

23 Getting a datagram from source to dest. IP datagram: A B E misc fields source IP addr dest IP addr data r datagram remains unchanged, as it travels source to destination r addr fields of interest here Dest. Net. next router Nhops forwarding table in A

24 Getting a datagram from source to dest. Starting at A, send IP datagram addressed to B: r look up net. address of B in forwarding table r find B is on same net. as A r link layer will send datagram directly to B inside link-layer frame m B and A are directly connected Dest. Net. next router Nhops misc fields data A B E forwarding table in A

25 Getting a datagram from source to dest. Dest. Net. next router Nhops Starting at A, dest. E: r look up network address of E in forwarding table r E on different network m A, E not directly attached r routing table: next hop router to E is r link layer sends datagram to router inside link- layer frame r datagram arrives at r continued….. misc fields data A B E forwarding table in A

26 Getting a datagram from source to dest. Arriving at , destined for r look up network address of E in router’s forwarding table r E on same network as router’s interface m router, E directly attached r link layer sends datagram to inside link-layer frame via interface r datagram arrives at !!! (hooray!) misc fields data Dest. Net router Nhops interface A B E forwarding table in router

27 IP addresses: how to get one – host ? Q: How does host get IP address? r hard-coded by system admin in a file m Wintel: control-panel->network->configuration- >tcp/ip->properties m UNIX: /etc/rc.config r DHCP: Dynamic Host Configuration Protocol: dynamically get address from as server m “plug-and-play”

28 DHCP: Dynamic Host Configuration Protocol Goal: allow host to dynamically obtain its IP address from network server when it joins network m Allows reuse of addresses (only hold address while connected an “on” m Support for mobile users who want to join network

29 DHCP client-server scenario A B E DHCP server arriving DHCP client needs address in this network m host broadcasts “DHCP discover” msg m DHCP server responds with “DHCP offer” msg m host requests IP address: “DHCP request” msg m DHCP server sends address: “DHCP ack” msg

30 IP datagram format ver length 32 bits data (variable length, typically a TCP or UDP segment) 16-bit identifier Internet checksum time to live 32 bit source IP address IP protocol version number header length (bytes) max number remaining hops (decremented at each router) for fragmentation/ reassembly total datagram length (bytes) upper layer protocol to deliver payload to head. len type of service “type” of data flgs fragment offset upper layer 32 bit destination IP address Options (if any) E.g. timestamp, record route taken, specify list of routers to visit. how much overhead with TCP? r 20 bytes of TCP r 20 bytes of IP r = 40 bytes + app layer overhead

31 IP Fragmentation & Reassembly r network links have MTU (max.transfer size) - largest possible link-level frame. m different link types, different MTUs r large IP datagram divided (“fragmented”) within net m one datagram becomes several datagrams m “reassembled” only at final destination m IP header bits used to identify, order related fragments fragmentation: in: one large datagram out: 3 smaller datagrams reassembly

32 IP Fragmentation and Reassembly ID =x offset =0 fragflag =0 length =4000 ID =x offset =0 fragflag =1 length =1500 ID =x offset =1480 fragflag =1 length =1500 ID =x offset =2960 fragflag =0 length =1040 One large datagram becomes several smaller datagrams Example r 4000 byte datagram r MTU = 1500 bytes

33 Outline 4.1 Introduction and Network Service Models 4.2 The Internet (IP) Protocol 4.3 Routing Principles m Link state routing m Distance vector routing

34 Routing Graph abstraction for routing algorithms: r graph nodes are routers r graph edges are physical links m link cost: delay, $ cost, or congestion level Goal: determine a “good” path (sequence of routers) thru network from source to dest. Routing protocol A E D CB F r “good” path: m typically means minimum cost path m other def’s possible

35 Routing Algorithm classification Global or decentralized information? Global: r all routers have complete topology, link cost info r “link state” algorithms Decentralized: r router knows physically- connected neighbors, link costs to neighbors r iterative process of computation, exchange of info with neighbors r “distance vector” algorithms Static or dynamic? Static: r routes change slowly over time Dynamic: r routes change more quickly m periodic update m in response to link cost changes

36 A Link-State Routing Algorithm Dijkstra’s algorithm r net topology, link costs known to all nodes m accomplished via “link state broadcast” m all nodes have same info r computes least cost paths from one node (‘source”) to all other nodes m gives routing table for that node 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

37 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) 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

38 Dijkstra’s algorithm: example Step start N A AD ADE ADEB ADEBC ADEBCF D(B),p(B) 2,A D(C),p(C) 5,A 4,D 3,E D(D),p(D) 1,A D(E),p(E) infinity 2,D D(F),p(F) infinity 4,E A E D CB F

39 Use Dijkstra’s shortest path algorithm to compute the shortest path from A to all network nodes.

40 Dijkstra’s algorithm, discussion Algorithm complexity: n nodes r each iteration: need to check all nodes, w, not in N r n*(n+1)/2 comparisons: O(n**2) r more efficient implementations possible: O(nlogn)

41 Distance Vector Routing Algorithm iterative: r continues until no nodes exchange info. r self-terminating: no “signal” to stop asynchronous: r nodes need not exchange info/iterate in lock step! distributed: r each node communicates only with directly- attached neighbors Key Idea r Given my distance to a neighboring node r Given the distances from the neighboring nodes to remote nodes  My distances to remote nodes

42 Distance Vector Routing Algorithm Distance Table data structure r each node has its own r row for each possible destination r column for each directly- attached neighbor to node r 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 Z Y17Y17 Z25Z25 X via destination

43 Distance Table: example A E D CB D () A B C D A1764A1764 B 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! ? ?

44 Distance table gives routing table D () A B C D A1764A1764 B D5542D5542 E cost to destination via destination ABCD ABCD A,1 D,5 D,4 D,2 Outgoing link to use, cost destination Distance table Routing table

45 Distance Vector Routing: overview Iterative, asynchronous: each local iteration caused by: r message from neighbor: its least cost path change from neighbor Distributed: r each node notifies neighbors only when its least cost path to any destination changes m neighbors then notify their neighbors if necessary wait for (msg from neighbor) recompute distance table if least cost path to any dest has changed, notify neighbors Each node:

46 Distance Vector 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) /* direct neighbors */ 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:

47 Distance Vector Algorithm (cont.): 8 loop 9 wait (until I receive update from neighbor V) if (update received from V wrt destination Y) 12 /* shortest path from V to some Y has changed */ 13 /* V has sent a new value for its min D V (Y,w) */ 14 /* call this received new value is "newval" */ 15 for the single destination y: D (Y,V) = c(X,V) + newval if we have a new min D (Y,w) for any destination Y 18 send new value of min D (Y,w) to all neighbors forever w X X X w w

48 Distance Vector Algorithm: example X Z 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

49 Distance Vector Algorithm: example X Z Y ?

50 Distance Vector Algorithm: example X Z Y

51 DV Algorithm (with link cost change): 8 loop 9 wait (until I see a link cost change to neighbor V 10 or until I receive update from neighbor V) 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 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 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 forever w X X X X X w w

52 Distance Vector: link cost changes Link cost changes: r node detects local link cost change r updates distance table (line 15) r if cost change in least cost path, notify neighbors (lines 23,24) X Z Y 1 algorithm terminates “good news travels fast”

53 Distance Vector: link cost changes Link cost changes: r good news travels fast r bad news travels slow - “count to infinity” problem! X Z Y 60 algorithm continues on!

54 Distance Vector: Count-to-Infinity Problem 1 1 A B C 3 1

55 Distance Vector: poisoned reverse If Z routes through Y to get to X : r Z tells Y its (Z’s) distance to X is infinite (so Y won’t route to X via Z) r will this completely solve count to infinity problem? X Z Y 60 algorithm terminates

56 Distance Vector: Count-to-Infinity Problem 1 1 A B C D A Complex Case

57 Distance Vector: Negative Distance A B C

58 Comparison of LS and DV algorithms Message complexity r LS: with n nodes, E links, O(nE) msgs sent each r DV: exchange between neighbors only m convergence time varies Speed of Convergence r LS: O(n 2 ) algorithm requires O(nE) msgs m may have oscillations r DV: convergence time varies m may be routing loops m count-to-infinity problem Robustness: what happens if router malfunctions? LS: m node can advertise incorrect link cost m each node computes only its own table DV: m DV node can advertise incorrect path cost m each node’s table used by others error propagate thru network

59 Network Layer: summary Next stop: the Data link layer! What we’ve covered: r network layer services r routing principles: link state and distance vector r IP