1 / 54

Achieving Reliability (cont.) ✧ Intro to Internetworking

Achieving Reliability (cont.) ✧ Intro to Internetworking. GZ01 Networked Systems Kyle Jamieson Lecture 6 Department of Computer Science University College London. Today. Achieving reliability GBN review Selective Repeat Intro to Internetworking Intro to the Transport Layer.

Télécharger la présentation

Achieving Reliability (cont.) ✧ Intro to Internetworking

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Achieving Reliability (cont.)✧Intro to Internetworking GZ01 Networked Systems Kyle Jamieson Lecture 6 Department of Computer Science University College London

  2. Today • Achieving reliability • GBN review • Selective Repeat • Intro to Internetworking • Intro to the Transport Layer

  3. Review: GBN (N = 4) in operation Sender Receiver Send packet 0 Receive 0; send ACK 0 Send packet 1 Receive 1; send ACK 1 Send packet 2 Send packet 3 (wait) Receive 3; discard; send ACK 1 Receive ACK 0; send 4 Receive 4; discard; send ACK 1 Receive ACK 1; send 5 (wait) Receive 5; discard; send ACK 1 Timeout; resend 2 Receive 2; send ACK 2 Resend packet 3 Receive 3; send ACK 3 Resend packet 4 Receive 4; send ACK 4 Resend packet 5 Receive 5; send ACK 5

  4. Selective Repeat: Introduction • Go Back N • Allows sender to fill pipeline with packets, for high channel utilization • Receiver sends cumulative acknowledgements ACK(n) acknowledging packet n and all those before • Large pipeline means that a single packet error results in many duplicate packet transmissions • Selective Repeat (SR) • Main idea: sender retransmits only packets that don’t reach the receiver correctly • Receiver individually acknowledges each packet • One retransmission timer per packet • GBN and SR are both examples of sliding window protocols • Window size N • k-bit sequence number for a sequence number space of size 2k

  5. Selective Repeat: Sequence numbers Already ACKed Out of order but ACKed Usable, not yet sent Acceptable nextseqnum send_base Sender’s view: • Window size N limits number of unacked packets in pipeline • send_base: lowest unacked packet • nextseqnum: last sent packet sequence number, plus 1 • rcv_base: last frame delivered, plus 1 Sent, not yet ACKed Expected, not yet received Not usable Not usable Window size N rcv_base Receiver’s view: Window size N

  6. SR sender: Data received from above Already ACKed Out of order but ACKed Usable, not yet sent Acceptable send_base nextseqnum Sender’s view: • Sender checks nextseqnum: • If in sender window, transmit, increment nextseqnum by one • If not in sender window, refuse data from above Sent, not yet ACKed Expected, not yet received Not usable Not usable Window size N rcv_base Receiver’s view: Window size N

  7. SR sender: Timeout event Already ACKed Out of order but ACKed Usable, not yet sent Acceptable nextseqnum send_base Sender’s view: • Recall: each packet has its own retransmission timer • Only packets’ timers in send window will be active • Sender retransmits packet then restarts that packet’s timer Sent, not yet ACKed Expected, not yet received Not usable Not usable Window size N rcv_base Receiver’s view: Window size N

  8. SR receiver: packet reception Already ACKed Out of order but ACKed Usable, not yet sent Acceptable nextseqnum send_base Sender’s view: • Correct packet reception with received seqno r. Three cases: • seqno r in receiver window: deliver data, send ACK, advance window • seqno r in [rcv_base − N, rcv_base − 1]: resend ACK • Otherwise: ignore the packet Sent, not yet ACKed Expected, not yet received Not usable Not usable Window size N rcv_base Receiver’s view: [rcv_base − N, rcv_base − 1] [rcv_base, rcv_base + N - 1]

  9. SR sender: ACK received Already ACKed Out of order but ACKed Usable, not yet sent Acceptable send_base nextseqnum Sender’s view: • Sender marks packet as already ACKed, stops retransmit timer • Sender compares send_base and ACK sequence number: • If ACK is not for send_base, keep window where it is • If ACK is for send_base, advance send_base and send window by one Sent, not yet ACKed Expected, not yet received Not usable Not usable Window size N rcv_base Receiver’s view: Window size N

  10. SR (N = 4) in operation Sender Receiver Send packet 0 [01 2 3] 4 5 6 7 8 9 Send packet 1 [0 12 3] 4 5 6 7 8 9 Send packet 2 [0 1 23] 4 5 6 7 8 9 Send packet 3 [0 1 2 3] 4 5 6 7 8 9 Recv ACK 0, send 4 0 [1 2 3 4] 5 6 7 8 9 Recv ACK 1, send 5 0 1 [2 3 4 5] 6 7 8 9 Timeout 2, resend 2 0 1 [2 3 4 5] 6 7 8 9 Recv ACK 3, send − 0 1 [234 5] 6 7 8 9 Recv 0, deliver, ACK 0 0 [1 2 3 4] 5 6 7 8 9 Recv 1, deliver, ACK 1 0 1 [2 3 4 5] 6 7 8 9 Recv 3, buffer, ACK 3 0 1 [234 5] 6 7 8 9 Recv 4, buffer, ACK 4 0 1 [23 45] 6 7 8 9 Recv 5, buffer, ACK 5 0 1 [23 4 5] 6 7 8 9 Recv 2, deliver 2−5, ACK 2 0 1 2 3 4 5 [6 7 8 9]

  11. Window size vs sequence number spaceN = 3, k=2 (4 sequence numbers) Sender Receiver Send 0 [0 1 2] 3 0 1 2 Send 1 [0 1 2] 3 0 1 2 Send 2 [0 12] 3 0 1 2 Timeout, resend 0 Recv 0, deliver, ACK 0 0 [1 2 3] 0 1 2 Recv 1, deliver, ACK 1 0 1 [2 3 0] 1 2 Recv 0 ➠ suppress duplicate Send 0 [0 1 2] 3 0 1 2 Send 1 [0 1 2] 3 0 1 2 Send 2 [0 12] 3 0 1 2 Recv ACK 0, send 3 0 [1 2 3] 0 1 2 Recv ACK 1, send 0 0 1 [2 3 0] 1 2 3 Recv 0, deliver, ACK 0 0 [1 2 3] 0 1 2 Recv 1, deliver, ACK 1 0 1 [2 3 0] 1 2 Recv 0 ➠ deliver up

  12. Window size vs sequence number space Already ACKed Out of order but ACKed Usable, not yet sent Acceptable send_base Sender’s view: • N > 2k−1: window too large • Right edge of receiver’s window can wrap past left edge of sender’s window • N ≤ 2k−1: no overlap Sent, not yet ACKed Expected, not yet received Not usable Not usable Window size N rcv_base Receiver’s view: Window size N

  13. Today • Achieving reliability • GBN review • Selective Repeat • Intro to Internetworking • Switching: Virtual circuits, datagrams, source routing • Addressing • Forwarding • Intro to the Transport Layer

  14. Building bigger networks: bridging A • We saw how bridges could interconnect many Ethernets (STP) • Problems: • Scaling # of networks, efficiently routing and addressing • Link layer heterogeneity: users on one type of network want to communicate with users on other type • Want to interconnect large, heterogeneous networks 3 5 C D 2 1 E

  15. Virtual circuit-based switching • Connection setup, establishing a virtual circuit (VC) • Data transfer • E.g. X.25 network allocates buffers as VCs are initialized, runs sliding-window protocol between each pair of nodes

  16. Source routing • Source host provides all information about the network topology required to switch the packet across the network • E.g.: place switch ports in list in the packet header; rotate list such that next switch’s output port is at head of list

  17. Datagram switching • Make sure every packet contains enough information to allow any switch to decide how to get it to its destination • Every packet contains complete destination address • Switch consults forwarding table (a.k.a. routing table) • Process of building of forwarding tables: routing (later)

  18. Internetworking • internetwork (small i): arbitrary collection of networks interconnected to provide host-to-host packet delivery service • Internet (big I): the widely-used internetwork • internetworking principles, apply to Internet • Routers/gateways: nodes that connect networks • Key tool: Internet Protocol (IP) • Originally Cerf-Kahn protocol • Scalable, heterogeneous

  19. Internetworking: Context • 1969: four-node ARPAnet • 1970s: more networks:CYCLADES effort in France; Telenet (BBN), ALOHAnet (Abramson) • 1973-75: DARPA internetworking effort: Cerf-Kahn Protocol • 1978: TCP and IP split (end-to-end principle) Vint Cerf and Robert Kahn

  20. IP service model • Service model: what does the network provide? • Compare, telephone network service model • Limited by underlying link layers: undemanding • The IP service model has two parts: • Datagram model of data delivery (best effort) • Addressing scheme: identify all hosts

  21. Virtual circuit and datagram networks • Transport layer can offer connection-based (TCP) or connectionless (UDP) service • Network layer can also offer connection-based or connectionless service • Virtual circuit (VC) networks • Computer networks that provide only a connection-based service at the network layer (e.g. ATM, frame relay, X.25) • VCs implemented in the network, not at ends as a transport-layer connection-based service like TCP • Datagram networks • Computer networks that provide only a connectionless service at the network layer

  22. Datagram model of data delivery • Every datagram carries enough information to let the network make best-effort to deliver it; no advance setup • Best effort makes network as simple as possible―it does nothing to recover from packet: • Corruption (bit errors) • Loss • Misdirection • Reordering • Duplication • Also called unreliable model of service • Connectionless network • Simplest model of service • Simplifies routers • “Runs over everything” • “Narrow waist” • Accommodates networks that offer more sophistication Application Transport Network (IP) Link Physical

  23. IP packet format Version: dispatch on version number (current: 4) HLen: header length; no options  20 bytes TOS: type of service Length: datagram len. (bytes) Ident, Flags, Offset: support fragmentation (next) TTL: time to live (hops): discard packets in routing loops Protocol: demultiplexes the transport layer protocol above Checksum: IP checksum, taken over the header only SourceAddr, DestinationAddr: forwarding decisions at routers

  24. Fragmentation and reassembly • Key to addressing heterogeneity • Problem: each link layer has a maximum packet size or maximum transmission unit (MTU); want to come near MTU to reduce overhead • e.g. 802.3 Ethernet: 1492 bytes • e.g. PPP: 532 bytes • e.g. FDDI fiber: 4500 bytes • Don’t want to take lowest common MTU: inefficient, unknown, and always changing • Fragmentation: break one IP packet into many smaller • Same Ident field in resulting fragments, for reassembly • Set M bit in the Flags field (more fragments to follow) • Offset field contains 8-byte chunk offset of fragment in packet • Each fragment is its own self-contained IP datagram

  25. Fragmentation and reassembly (2) • Not all fragments arrived at destination host? Give up, discard received fragments. (Best effort service) • To fragment, set M bit in Flags of all but last fragment; offset field of all fragments • Fragmentation can be repeated at further downstream hops • Contains its own offset in original IP datagram • Subsequent fragmentations can update offsets • Reassembly happens at the receiving host, not in intermediate routers

  26. Fragmentation example M; offset=0 M; offset=64 Offset=128 Ethernet MTU: 1492 bytes FDDI MTU: 4500 bytes PPP MTU: 532 bytes

  27. Basic datagram forwarding in IP • Every IP datagram contains the IP address of the destination host • The “network part” of an IP address uniquely identifies a single physical network • All hosts and routers that share the same network part of their address are connected to the same physical network • Every physical network has at least one router that is also connected to at least one other physical network • Forwarding table: <NetworkNum, NextHop> pairs Forwarding algorithm: if (NetworkNum of dest = NetworkNum of one of my interfaces) then deliver packet to destination over that interface else if (NetworkNum of dest in forwarding table) then deliver packet to NextHop route else deliver packet to default router

  28. Basic datagram forwarding in IP • H1 to H2: same network number, can deliver directly over Ethernet • H1 to H8: different network numbers, so H1 sends to R1 • Routers only need to store network numbers (not all host addresses) because of hierarchical addressing

  29. IP service model • Service model: what does the network provide? • Compare, telephone network service model • Limited by underlying link layers: undemanding • The IP service model has two parts: • Datagram model of data delivery (best effort) • Addressing scheme: identify all hosts

  30. Addressing in the Internet • 32-bit address • Dotted quad notation: a.b.c.d where each component is an eight-bit decimal number (between 0-255) • Global uniqueness (shared goal with Ethernet) • Hierarchical structure (network, host parts) Class A: Class B: Class C: • Networks Hosts/network • 16 million • 16,384 65,534 • 2 million 254

  31. [xkcd comics, Randall Munroe]

  32. IP addressing: Subnetting • Problem: address assignment inefficiency • Every network needs a class C, no matter how small • Many will need a class B, wasting up to 65,534 addresses • Problem: too many networks (routing tables grow large) • Subnetting: let many physical networks (subnets) share a single network number • Requirement: subnets are physically close (routing) • All hosts on same physical network share a subnet number • Reduces the total number of networks

  33. IP addressing: Subnetting • Adds another level of hierarchy to addresses: Subnet ID • Subnet number = IP address & subnet mask

  34. Subnetting: Example

  35. Subnetting: Example • H1’s subnet number: 128.96.34.15 & 255.255.255.128 = 128.96.34.0 • H1 sending to H2: 128.96.34.139 & 255.255.255.128 = 128.96.34.128 != 128.96.34.0 so H1 sends to R1 • Routing tables change to hold entries of the form <SubnetNumber, SubnetMask, NextHop> • For each entry, bitwise AND destination address with each SubnetMask, test if matches SubnetNumber • H1 sending to H2: R1 computes: 128.96.34.139 & 255.255.255.128 != 128.96.34.0 (no match) 128.96.34.139 & 255.255.255.128 = 128.96.34.128 (match)  Intf. 1 • ARP is largely unaffected: once you know you want to deliver a packet to a network to which you are directly attached, ARP gets MAC address.

  36. IP datagram forwarding (with subnetting) • Forwarding table: <SubnetNumber, SubnetMask, NextHop> triples • Suppose router is delivering a packet to IP address DestAddr • Forwarding algorithm (with subnetting): for each entry (SubnetNumber, SubnetMask, NextHop) do D1 = SubnetMask & DestAddr if D1 = SubnetNumber then if NextHop is an interface then deliver datagram directly to destination else deliver datagram to NextHop (a router)

  37. Classless Interdomain routing (CIDR) • IP address space exhaustion: class B’s running out • Any site with more than 255 hosts wants a class B • Subnetting doesn’t get around this • Could just allocate many class C’s • Problem: route by network number: routing tables fill up • Idea: instead allocate contiguous class C’s and aggregate • Single entry in forwarding table tells how to get to many networks • Example: 200.23.16.0/23: 11001000 00010111 00010000 00000000 200.23.18.0/23: 11001000 00010111 00010010 00000000 200.23.20.0/23: 11001000 00010111 00010100 00000000 200.23.16.0/20: 11001000 00010111 00010000 00000000

  38. 200.23.16.0/23 200.23.18.0/23 200.23.30.0/23 200.23.20.0/23 . . . . . . CIDR: Route aggregation Hierarchical addressing allows efficient advertisement of routing information: Customer #0 “Send me anything with addresses beginning 200.23.16.0/20” Customer #1 Customer #2 Fly-By-Night-ISP Internet Customer #7 “Send me anything with addresses beginning 199.31.0.0/16” ISPs-R-Us

  39. 200.23.16.0/23 200.23.30.0/23 200.23.20.0/23 200.23.18.0/23 . . . . . . CIDR adds flexibility ISPs-R-Us has a more specific route to Customer #1: router prefers that route Customer #0 “Send me anything with addresses beginning 200.23.16.0/20” Customer #2 Fly-By-Night-ISP Internet Customer #7 “Send me anything with addresses beginning 199.31.0.0/16 or 200.23.18.0/23” ISPs-R-Us Customer #1

  40. IP datagram forwarding (with CIDR) Prefix Interface 199.31.0.0/16 1 200.23.16.0/20 0 200.23.18.0/23 1 • Multiple entries may match an address • Prefixes may be of any length • Algorithm: Choose the entry with the longest prefix in common with the address • Next time in GZ01: “Small forwarding tables for fast routing lookups” describes current practice on the Internet Fly-By-Night-ISP 0 1 ISPs-R-Us

  41. IP addressing: the last word How does an Internet Service Provider get a block of IP addresses? ICANN:Internet Corporation for Assigned Names and Numbers • Allocates IP addresses • Manages the Domain Name System (DNS) • Assigns domain names, resolves disputes

  42. Today • Achieving reliability • Intro to Internetworking • Intro to the Transport Layer • User Datagram Protocol (UDP) • Transport Control Protocol (TCP)

  43. Logical communication between application processes running on different hosts Transport protocols run at the ends (at hosts) Sender: breaks application messages into segments, passes to network layer Receiver: reassembles segments into messages, passes to app layer application transport network data link physical application transport network data link physical Transport services and protocols logical end-end transport

  44. Network layer: logical communication between hosts Transport layer: logical communication between processes Relies on and enhances network layer services Doesn’t have any say about what happens in the network Transport layer versus network layer Household analogy (K&R): 12 kids sending letters to 12 kids; two of them (Ann and Bill) responsible for mail collection • Processes = kids • Application messages = Letters in envelopes • Hosts = houses • Transport protocol = Ann and Bill • Network layer protocol = Postal service

  45. User Datagram Protocol (UDP): Unreliable, unordered delivery No-frills extension of “best-effort” IP Transmission Control Protocol (TCP): Reliable, in-order delivery Congestion control Flow control Connection setup Services not available: Delay guarantees bandwidth guarantees application transport network data link physical application transport network data link physical Internet transport-layer protocols logical end-end transport

  46. Multiplexing at send host: Demultiplexing at receiving host: Transport layer multiplexing Transport layer delivers received segments to the correct socket Transport layer gathers data from multiple sockets, encapsulating with transport header (later used for demultiplexing) Socket Process Application P4 Application Application P1 P2 P3 P1 Transport Transport Transport Network Network Network Link Link Link Physical Physical Physical Host 1 Host 2 Host 3

  47. Network layer passes up IP datagrams Each datagram has source IP address, destination IP address Each datagram carries one transport-layer segment Each segment has source, destination port number Transport layer uses IP addresses and port numbers to direct segment to appropriate socket How demultiplexing works SrcPort DestPort Other header fields Data TCP/UDP segment format

  48. Extends host-to-host IP delivery to process-to-process “Best effort” service, UDP segments may be lost or delivered out of order No congestion control: UDP can send as fast as desired Connectionless no handshaking between UDP sender, receiver User Datagram Protocol (UDP) • Uses of UDP • Streaming multimedia • Domain Name System • Simple Network Management Protocol UDP segment format

  49. Create sockets with port numbers (Python): from socket import * s=socket(AF_INET, SOCK_DGRAM) s.bind((“127.0.0.1”, 8001)) UDP socket is identified by a two-tuple: (DestinationAddr, DestPort) When UDP receives an incoming segment: Checks DestinationAddress in IP datagram, DestPort in UDP segment Directs UDP segment to socket with that port number, IP address SourceAddress, SourcePort doesn’t influence demultiplexing in UDP UDP: Simple demultiplexer

  50. UDP socket listening on port 53 P3 P2 P1 P1 Client IP: A UDP communication: Example Socket Process Source IP: A Source IP: B Source IP: C Source IP: C Dest IP: C Dest IP: A Dest IP: B Dest IP: C Server IP: C Client IP: B SrcPort: 34002 SrcPort: 33001 SrcPort: 53 SrcPort: 53 DestPort: 34002 DestPort: 33001 DestPort: 53 DestPort: 53 SrcPort provides a “return address” for communication in the other direction

More Related