800 likes | 940 Views
Announcements:. ECE/CS 372 – introduction to computer networks Lecture 13. Acknowledgement: slides drawn heavily from Kurose & Ross. network layer protocols run at end systems & routers Sender side: get segments from transport layer encapsulates segments into IP datagrams
E N D
Announcements: ECE/CS 372 – introduction to computer networksLecture 13 Chapter 4, slide: Acknowledgement: slides drawn heavily from Kurose & Ross
network layer protocols run at end systems & routers Sender side: get segments from transport layer encapsulates segments into IP datagrams router examines header fields in all IP datagrams Receiver side: delivers segments to transport layer 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 network data link physical network data link physical network data link physical application transport network data link physical application transport network data link physical Network layer Chapter 4, slide:
Interplay between routing and forwarding • routing algorithm: constructs routing tables • forwarding table: a lookup table for figuring out output port for each input pkt routing algorithm local forwarding table header value output link • forwarding process: move pkts from input to output 0100 0101 0111 1001 3 2 2 1 value in arriving packet’s header 1 0111 2 3 Destination • routing process: find route taken by packets from source to dest. Chapter 4, slide:
Two Key Network-Layer Functions • forwarding: move packets from router’s input to appropriate router output • routing: determine route taken by packets from source to dest. • routing algorithms • analogy: • routing: process of planning trip from source to dest • forwarding: process of getting through single interchange Chapter 4, slide:
Example services for individual datagrams: Reliability Guaranteed delivery End-to-end delay guaranteed delivery within 40 msec delay Example services for a flow of datagrams: In-order in-order datagram delivery Throughput guaranteed minimum bandwidth to flow Jitter delay restrictions on changes in inter-packet spacing Network service model Q: What services are needed/offered to transportdatagrams from sender to receiver? Chapter 4, slide:
Network layer: connection and connection-less services • Network-layer versus transport-layer services • datagram network provides network-layer connectionless service • Virtual Circuit (VC) network provides network-layer connection service Chapter 4, slide:
Datagram data exchange among computers (Internet) “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 Virtual Circuit (VC) evolved from telephony voice conversation: strict timing, reliability requirements need for guaranteed service “dumb” end systems telephones complexity inside network Datagram or VC network: why? Chapter 4, slide:
no call setup at network layer no state about end-to-end connections is kept in routers no network-level concept of “connection” packets forwarded using dest. host address packets (same source-dest pair) may take different paths application transport network data link physical application transport network data link physical Datagram networks 1. Send data 2. Receive data Chapter 4, slide:
Forwarding table 4 billion possible entries Destination Address RangeLink Interface 11001000 00010111 00010000 00000000 through 0 11001000 00010111 00010111 11111111 11001000 00010111 00011000 00000000 through 1 11001000 00010111 00011000 11111111 11001000 00010111 00011001 00000000 through 2 11001000 00010111 00011111 11111111 otherwise 3 Chapter 4, slide:
Longest prefix matching Prefix MatchLink Interface 11001000 00010111 00010 0 11001000 00010111 00011000 1 11001000 00010111 00011 2 otherwise 3 Examples Which interface? DA: 11001000 00010111 00010110 10100001 Which interface? DA: 11001000 00010111 00011000 10101010 Chapter 4, slide:
Introduction IP: Internet Protocol IPv4 addressing NAT, IPv6 Routing algorithms Link state Distance Vector Routing in the Internet RIP, OSPF, BGP Chapter 4: Network Layer Chapter 4, slide:
Host, router network layer functions: ICMP protocol • error reporting • router “signaling” IP protocol • addressing conventions • datagram format • packet handling conventions Routing protocols • path selection • RIP, OSPF, BGP forwarding table The Internet Network layer Transport layer: TCP, UDP Network layer Link layer physical layer Chapter 4, slide:
network links have MTU (max.transfer size) - largest possible link-level frame. different link types, different MTUs large IP datagram divided (“fragmented”) within net one datagram becomes several datagrams “reassembled” only at final destination IP header bits used to identify, order related fragments IP Fragmentation & Reassembly fragmentation: in: one large datagram out: 3 smaller datagrams reassembly Chapter 4, slide:
length =4000 ID =x fragflag =0 offset =0 One large datagram becomes several smaller datagrams IP Fragmentation & Reassembly (ctd) • Example • 4000 byte datagram • = 20 (header) + 3980 (data) • MTU = 1500 bytes Chapter 4, slide:
length =1040 length =4000 length =1500 length =1500 ID =x ID =x ID =x ID =x fragflag =1 fragflag =1 fragflag =0 fragflag =0 offset =370 offset =185 offset =0 offset =0 One large datagram becomes several smaller datagrams IP Fragmentation & Reassembly (ctd) • Example • 4000 byte datagram • = 20 (header) + 3980 (data) • MTU = 1500 bytes 1480 bytes in data field offset = 1480/8 1040= 20 (header) + 1020 (data) 1020 (data) =3980 – 1480 -1480 Chapter 4, slide:
IP address: 32-bit identifier for host, router interface interface: connection between host/router and physical link multiple interfaces per router one interface per host one IP address per interface 223.1.1.2 223.1.1.1 223.1.2.2 223.1.2.1 223.1.3.2 223.1.3.1 223.1.3.27 223.1.2.9 223.1.1.4 223.1.1.3 223.1.1.1 = 11011111 00000001 00000001 00000001 223 1 1 1 IP Addressing: introduction Chapter 4, slide:
IP address: subnet part (higher bits) host part (lower bits) What’s a subnet ? device interfaces with same subnet part of IP address can physically reach each other without intervening router 223.1.1.1 host part subnet part 223.1.2.1 223.1.1.2 11001000 0001011100010000 00000000 223.1.2.9 223.1.1.4 200.23.16.0/23 223.1.2.2 223.1.1.3 223.1.3.27 subnet 223.1.3.2 223.1.3.1 Subnets network consisting of 3 subnets Chapter 4, slide:
Recipe To determine the subnets, detach each interface from its host or router, creating islands of isolated networks. Each isolated network is called a subnet. 223.1.1.0/24 223.1.2.0/24 223.1.3.0/24 Subnets Subnet mask: /24 Chapter 4, slide:
How many? Subnets 223.1.1.2 223.1.1.1 223.1.1.4 223.1.1.3 223.1.7.0 223.1.9.2 223.1.9.1 223.1.7.1 223.1.8.1 223.1.8.0 223.1.2.6 223.1.3.27 223.1.2.1 223.1.2.2 223.1.3.1 223.1.3.2 Chapter 4, slide:
host part subnet part 11001000 0001011100010000 00000000 200.23.16.0/23 IP addressing: CIDR (only 28 subnets, but 224 hosts per subnet) (216 subnets, and 216 hosts per subnet) (224 subnets, but only 28 hosts per subnet) Classful addressing: A, B, C • A: /8 • B: /16 • C: /24 CIDR:Classless InterDomain Routing • subnet portion of address of arbitrary length • address format: a.b.c.d/x, where x is # bits in subnet portion of address Chapter 4, slide:
IP addresses: how to get one? Q: How does host get IP address? • hard-coded by system admin in a file • DHCP:Dynamic Host Configuration Protocol: • dynamically get IP address from as server when joining the network • IP address can be reused by other hosts if released • Can renew IP addresses if stayed connected Chapter 4, slide:
E B A DHCP client-server scenario 223.1.2.1 DHCP 223.1.1.1 server 223.1.1.2 223.1.2.9 223.1.1.4 223.1.2.2 arriving DHCP client needs address in this network 223.1.1.3 223.1.3.27 223.1.3.2 223.1.3.1 Chapter 4, slide:
IP addresses: how to get one? Q: How does network get subnet part of IP addr? A: gets allocated portion of its provider ISP’s address space ISP's block 11001000 00010111 00010000 00000000 200.23.16.0/20 Organization 0 11001000 00010111 00010000 00000000 200.23.16.0/23 Organization 1 11001000 00010111 00010010 00000000 200.23.18.0/23 Organization 2 11001000 00010111 00010100 00000000 200.23.20.0/23 ... ….. …. …. Organization 7 11001000 00010111 00011110 00000000 200.23.30.0/23 Chapter 4, slide:
IP addressing: the last word... Q: How does an ISP get block of addresses? A: ICANN: Internet Corporation for Assigned Names and Numbers • allocates addresses • manages DNS • assigns domain names, resolves disputes Chapter 4, slide:
Announcements: Lab 4 is posted and is due next Wednesday ECE/CS 372 – introduction to computer networksLecture 14 Chapter 4, slide: Acknowledgement: slides drawn heavily from Kurose & Ross
Three subnets All interfaces in all these subnets are required to have prefix: 223.1.13.0/24 Subnet 1 is required to support 125 interfaces Subnet 2 & 3 are each required to support 60 interfaces Question: Provide 3 network addresses in the form: a.b.c.d/x 1 , 2 and 3 Subnet 1 Subnet 2 Subnet 3 Example Chapter 4, slide:
Introduction IP: Internet Protocol IPv4 addressing NAT, IPv6 Routing algorithms Link state Distance Vector Routing in the Internet RIP, OSPF, BGP Chapter 4: Network Layer Chapter 4, slide:
NAT: Network Address Translation rest of Internet local network (e.g., home network) 10.0.0/24 10.0.0.1 10.0.0.4 10.0.0.2 138.76.29.7 10.0.0.3 Datagrams with source or destination in this network have 10.0.0/24 address for source, destination (as usual) All datagrams leaving local network have same single source NAT IP address: 138.76.29.7, different source port numbers Chapter 4, slide:
NAT: Network Address Translation Motivation: • local network uses just one IP address as far as outside world is concerned • range of addresses not needed from ISP: just one IP address for all devices • can change addresses of devices in local network without notifying outside world • can change ISP without changing addresses of devices in local network • devices inside local net not explicitly addressable, visible by outside world (a security plus). Chapter 4, slide:
2 4 1 3 S: 138.76.29.7, 5001 D: 128.119.40.186, 80 S: 10.0.0.1, 3345 D: 128.119.40.186, 80 1: host 10.0.0.1 sends datagram to 128.119.40.186, 80 2: NAT router changes datagram source addr from 10.0.0.1, 3345 to 138.76.29.7, 5001, updates table S: 128.119.40.186, 80 D: 10.0.0.1, 3345 S: 128.119.40.186, 80 D: 138.76.29.7, 5001 NAT: Network Address Translation NAT translation table WAN side addr LAN side addr 138.76.29.7, 5001 10.0.0.1, 3345 …… …… 10.0.0.1 10.0.0.4 10.0.0.2 138.76.29.7 10.0.0.3 4: NAT router changes datagram dest addr from 138.76.29.7, 5001 to 10.0.0.1, 3345 3: Reply arrives dest. address: 138.76.29.7, 5001 Chapter 4, slide:
IPv6 • Initial motivation: • 32-bit address space soon to be completely allocated. • Additional motivation: • header changes to facilitate QoS • Major changes from IPv4: • Fragmentation: no longer allowed; drop packet if too big; send an ICMP msg back • Checksum: removed to reduce processing time; already done at transport and link layers Chapter 4, slide:
Transition From IPv4 To IPv6 • Can all routers be upgraded simultaneously ?? • Answer: it can’t; no “flag days” • Analogy: (IP for Internet) ~ (foundation for House) • To change the foundation, you need to tear down the house!! • Solution gradually incorporate IPv6 (may take few years) • How will the network operate with mixed IPv4 and IPv6 routers? • Tunneling?? Chapter 4, slide:
Flow: X Src: A Dest: F data E F A B E F A B tunnel Logical view: IPv6 IPv6 IPv6 IPv6 Physical view: IPv6 IPv6 IPv6 IPv6 IPv4 IPv4 Tunneling D C What is the problem here? • Be aware that: • IPv6 nodes have both IPv4 & IPv6 addresses • Nodes know which nodes are IPv4 and which ones are IPv6 (use for e.g. DNS) Why can’t B just send an IPv4 packet to C ? Problem: D won’t be able to send an IPv6 packet to E? Why? A-to-B: IPv6 Chapter 4, slide:
Flow: X Src: A Dest: F data Flow: X Src: A Dest: F data Flow: X Src: A Dest: F data Flow: X Src: A Dest: F data E B A F F A B E C D Src:B Dest: E Src:B Dest: E E-to-F: IPv6 B-to-C: IPv6 inside IPv4 B-to-C: IPv6 inside IPv4 Tunneling tunnel Logical view: IPv6 IPv6 IPv6 IPv6 Physical view: IPv6 IPv6 IPv6 IPv6 IPv4 IPv4 • Be aware that: • IPv6 nodes have both IPv4 & IPv6 addresses • Nodes know which nodes are IPv4 and which one are IPv6 (use for e.g. DNS) A-to-B: IPv6 Chapter 4, slide:
Introduction IP: Internet Protocol IPv4 addressing NAT, IPv6 Routing algorithms Link state Distance Vector Routing in the Internet RIP, OSPF, BGP Chapter 4: Network Layer Chapter 4, slide:
routing algorithm local forwarding table header value output link 0100 0101 0111 1001 3 2 2 1 value in arriving packet’s header 1 0111 2 3 Routing versus forwarding Chapter 4, slide:
5 3 5 2 2 1 3 1 2 1 x z w u y v Graph abstraction Graph: G = (N,E) N = set of routers = { u, v, w, x, y, z } E = set of links ={ (u,v), (u,x), (v,x), (v,w), (x,w), (x,y), (w,y), (w,z), (y,z) } Chapter 4, slide:
5 3 5 2 2 1 3 1 2 1 x z w y u v Graph abstraction: costs • c(x,x’) = cost of link (x,x’) - e.g., c(w,z) = 5 • cost could always be 1, or inversely related to bandwidth, or inversely related to congestion Cost of path (x1, x2, x3,…, xp) = c(x1,x2) + c(x2,x3) + … + c(xp-1,xp) Question: What’s the least-cost path between u and z ? The routing algorithm’s job is to find this least-cost path Chapter 4, slide:
Introduction IP: Internet Protocol IPv4 addressing NAT, IPv6 Routing algorithms Link state Distance Vector Routing in the Internet RIP, OSPF, BGP Chapter 4: Network Layer Chapter 4, slide:
Dijkstra’s algorithm Each node computes least cost paths from it to all other nodes Each node knows entire net topology, all link costs Each node broadcasts “link state” of its neighbors only, butto all iterative: after k iterations, know least cost path to k dest.’s Notation: c(x,y): link cost from node x to y; = ∞ 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 N': set of nodes whose least cost path definitively known A Link-State Routing Algorithm Chapter 4, slide:
5 3 5 2 2 1 3 1 2 1 x z w y u v Dijkstra’s algorithm: example D(v),p(v) 2,u D(x),p(x) 1,u D(w),p(w) 5,u D(y),p(y) ∞ Step 0 1 2 3 4 5 N' u \N’ - D(z),p(z) ∞ 1 Initialization: 2 N' = {u} 3 for all nodes b 4 if b adjacent to u 5 then D(b) = c(u,b) 6 else D(b) = ∞ Chapter 4, slide:
5 3 5 2 2 1 3 1 2 1 x z w y u v Dijkstra’s algorithm: example D(v),p(v) 2,u 2,u D(x),p(x) 1,u D(w),p(w) 5,u 4,x D(y),p(y) ∞ 2,x Step 0 1 2 3 4 5 N' u ux \N’ - vwy D(z),p(z) ∞ 8 Loop • find c not in N' such that D(c) is a minimum 10 add c to N' 11 update D(b) for all b adjacent to c & not in N' : 12 D(b) = min( D(b), D(c) + c(c,b) ) 15 until all nodes in N' Chapter 4, slide:
5 3 5 2 2 1 3 1 2 1 x z w u y v Dijkstra’s algorithm: example D(v),p(v) 2,u 2,u 2,u D(x),p(x) 1,u D(w),p(w) 5,u 4,x 3,y D(y),p(y) ∞ 2,x Step 0 1 2 3 4 5 N' u ux uxy \N’ - vwy wz D(z),p(z) ∞ ∞ 4,y 8 Loop • find c not in N' such that D(c) is a minimum 10 add c to N' 11 update D(b) for all b adjacent to c & not in N' : 12 D(b) = min( D(b), D(c) + c(c,b) ) 15 until all nodes in N' Chapter 4, slide:
5 3 5 2 2 1 3 1 2 1 x z w u y v Dijkstra’s algorithm: example D(v),p(v) 2,u 2,u 2,u D(x),p(x) 1,u D(w),p(w) 5,u 4,x 3,y 3,y D(y),p(y) ∞ 2,x Step 0 1 2 3 4 5 N' u ux uxy uxyv \N’ - vwy wz w D(z),p(z) ∞ ∞ 4,y 4,y 8 Loop • find c not in N' such that D(c) is a minimum 10 add c to N' 11 update D(b) for all b adjacent to c & not in N' : 12 D(b) = min( D(b), D(c) + c(c,b) ) 15 until all nodes in N' Chapter 4, slide:
5 3 5 2 2 1 3 1 2 1 x z w u y v Dijkstra’s algorithm: example D(v),p(v) 2,u 2,u 2,u D(x),p(x) 1,u D(w),p(w) 5,u 4,x 3,y 3,y D(y),p(y) ∞ 2,x Step 0 1 2 3 4 5 N' u ux uxy uxyv uxyvw \N’ - vwy wz w z D(z),p(z) ∞ ∞ 4,y 4,y 4,y 8 Loop • find c not in N' such that D(c) is a minimum 10 add c to N' 11 update D(b) for all b adjacent to c & not in N' : 12 D(b) = min( D(b), D(c) + c(c,b) ) 15 until all nodes in N' Chapter 4, slide:
5 3 5 2 2 1 3 1 2 1 x z w u y v Dijkstra’s algorithm: example D(v),p(v) 2,u 2,u 2,u D(x),p(x) 1,u D(w),p(w) 5,u 4,x 3,y 3,y D(y),p(y) ∞ 2,x Step 0 1 2 3 4 5 N' u ux uxy uxyv uxyvw uxyvwz \N’ - vwy wz w z - D(z),p(z) ∞ ∞ 4,y 4,y 4,y 8 Loop • find c not in N' such that D(c) is a minimum 10 add c to N' 11 update D(b) for all b adjacent to c & not in N' : 12 D(b) = min( D(b), D(c) + c(c,b) ) 15 until all nodes in N' Chapter 4, slide:
Dijkstra’s Algorithm 1 Initialization: 2 N' = {a} 3 for all nodes b 4 if b adjacent to a 5 then D(b) = c(a,b) 6 else D(b) = ∞ 7 8 Loop 9 find c not in N' such that D(c) is a minimum 10 add c to N' 11 update D(b) for all b adjacent to c and not in N' : 12 D(b) = min( D(b), D(c) + c(c,b) ) 13 /* new cost to b is either old cost to b or known 14 shortest path cost to c plus cost from c to b */ 15 until all nodes in N' Chapter 4, slide:
x z w u y v destination link (u,v) v (u,x) x y (u,x) (u,x) w z (u,x) Dijkstra’s algorithm: example Resulting shortest-path tree from u: • To remember ! • Each node must have complete knowledge of entire network • Broadcast all link states • Each node constructs its own table Resulting forwarding table in u: Chapter 4, slide:
Algorithm complexity: n nodes each iteration: need to check all nodes, w, not in N’ n(n+1)/2 comparisons: O(n2) Oscillations possible: e.g., link cost = amount of carried traffic Here: D, C, and B all send to A A A A A D D D D B B B B C C C C 1 1+e 2+e 0 2+e 0 2+e 0 0 0 1 1+e 0 0 1 1+e e 0 0 0 0 1 1+e 0 1 1 e … recompute … recompute routing … recompute initially Dijkstra’s algorithm, discussion Chapter 4, slide:
Announcements: HW3 is posted and is due next Thursday Lab 4 is posted and is due next Thursday ECE/CS 372 – introduction to computer networksLecture 15 Chapter 4, slide: Acknowledgement: slides drawn heavily from Kurose & Ross