1 / 48

Communication Protocols

Communication Protocols. Outline. Basics IP UDP TCP. Communication. Circuits vs. Packets. Circuit switching reserve a circuit between communicating entities Packet switching break data into packets transmit each packet separately—each packet could travel a different route.

annick
Télécharger la présentation

Communication Protocols

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. Communication Protocols

  2. Outline • Basics • IP • UDP • TCP

  3. Communication

  4. Circuits vs. Packets • Circuit switching • reserve a circuit between communicating entities • Packet switching • break data into packets • transmit each packet separately—each packet could travel a different route

  5. ISO OSI Reference Model application application 7 6 presentation presentation session session 5 4 transport transport network link network link network link network link 3 data link data link data link data link 2 physical physical physical physical 1

  6. Application Application End-to-End End-to-End Internet Internet Internet Internet Net Interface Net Interface Net Interface Net Interface Internet Architecture OSI Layer 5-7 OSI Layer 4 OSI Layer 3 OSI Layers 1-2

  7. IP i/f i/f i/f i/f IP IP i/f i/f Internetworking with TCP/IP user user TCP TCP IP LAN LAN WAN

  8. LAN LAN LAN LAN LAN WAN WAN WAN WAN Navigating the Internet

  9. Internet Addresses 0 network host Class A 7 bits 24 bits 10 network host Class B 14 bits 16 bits 110 network host Class C 21 bits 8 bits 1110 multicast group ID Class D 28 bits

  10. Internet Addresses Written as sequence of octets Example: 144.16.11.1 Different from the name: linux-2.ece.iastate.edu

  11. Subnetting 10 network host subnet mask & 10 institution network host

  12. Example A machine has IP address 16.15.15.1 and subnet mask 255.0.0.0 16.15.15.1 = 00010000.00001111.00001111.00000001 255.0.0.0 = 11111111.00000000.00000000.00000000 net id | host id Net id = 00010000 = 16 Host id = 00001111.00001111.00000001 = 15.15.1 http://www.cisco.com/warp/public/701/3.html

  13. IP Routing • How to get the packet from source to destination? • (Loose) Analogy with USPS routing • Network address = zip code • Host address = street + house # • Major conceptual difference between postal and internet routing • Role of a central organization (such as USPS) is limited

  14. Network vs Subnetwork • Network • A logical grouping of computers • Share a common address prefix • Physically “quite close” to each other • Subnetwork • A single physical network • All computers are very close to each other • A single network might consist of many subnetworks

  15. IP Routing • Two options: • sender supplies entire route • “source routing” • sender supplies the first hop • each intermediate host determines the next host

  16. Types of Routes • Direct vs. Indirect Routes • Host-Specific vs. Network-Specific vs. Default Routes • Generate Strategy: • Find a host-specific route • Find a network-specific route • Try the default route

  17. Direct Route Example spenser 128.148.128.2 128.148.32.1 holmes 128.148.32.33

  18. Host-Specific Route Example spenser 128.148.128.2 128.148.32.1 holmes 128.148.32.33 128.148.128.3:128.148.32.1 routing table archy 128.148.128.3

  19. Network-Specific Route Example spenser 128.148.128.2 128.148.32.1 holmes 128.148.32.33 16.0.0.0: 128.148.128.3 128.148.128.3:128.148.32.1 routing table routing table archy 128.148.128.3 16.0.0.111 sloth 16.0.0.234

  20. Default Route Example spenser 128.148.128.2 128.148.32.1 holmes 128.148.32.33 16.0.0.0: 128.148.128.3 128.148.128.3:128.148.32.1 routing table routing table archy 128.148.128.3 16.0.0.111 sloth 16.0.0.234 0.0.0.0: 16.0.0.111 routing table

  21. vers hlen type of serv total length identification flags fragment offset time-to-live protocol header checksum source address destination address options padding data IP Header

  22. Time-to-Live

  23. Fragmentation and Reassembly

  24. Broadcasting • Broadcast: no filtering done at net interface • limited: to local net • address: 255.255.255.255 • net: to all on specified net • address: netid.x, where x is the all ones host portion of the address • subnet: to all on specified subnet • address: netid.subnetid.x • all subnets: to all on subnets of one net • address: the host portion of the address is all ones

  25. Multicasting (1) • Like broadcasting, but: • multicast messages are sent to multicast group addresses • individual interfaces can select group addresses of interest • Distribution handled by collection of multicast routers • IGMP (internet group management protocol) used to manage group membership

  26. Multicasting (2) Routers Source Potential Receivers

  27. User Datagram Protocol (UDP) • A multiplexing service built on top of IP • Extends IP packet-level communication to individual user processes • No guarantees about reliability • Checksumming is (optionally) performed on • the UDP header and data, and • portion of the IP header

  28. Source Port Destination Port Length UDP Checksum UDP Header

  29. Transmission Control Protocol (TCP) • Another multiplexing service built on top of IP • A full-duplex reliable stream protocol • Provides reliable data transfer • Packet boundaries are not seen by the application • it sees a sequence of bytes, not a sequence of packets • A connection must be established for communication to take place • connections are flow-controlled • connections are congestion-controlled

  30. TCP Header Components source port destination port sequence number acknowledgment sequence number offset reserved flags window size checksum urgent pointer options padding data

  31. Sliding-Window Protocol • Used for: • reliable delivery • flow control • Windows • send • receive

  32. Send and Receive Windows send sequence space ack’d data unack’d data ok to xmit not ok to xmit send_una send_next send_una + send_window size receive sequence space already rcv’d and ack’d ok to receive throw away recv_next + recv_window size recv_next

  33. 1024 1024 0-511 512 512 511-767 0-511 768 256 1024 768-1023 Ack 512 1024 512 512 Ack 512 768-1023 512 512 512 512 Sending Data via TCP (1)

  34. 512 512 512 512 511-767 1024 Ack 1024 Win 512 Ack 1024 Win 512 1024 512 1024 512 1024-1279 1280 256 Sending Data via TCP (2)

  35. active open: init state send SYN passive open: init state closed closed recv SYN: send ACK recv SYN: send SYN,ACK syn sent closed syn rcvd closed closed listen recv ACK of SYN recv SYN, ACK: send ACK closed estab CLOSE: send FIN recv FIN: send ACK fin wait 1 close wait recv FIN: send ACK CLOSE: send FIN recv ACK recv FIN, ACK: send ACK fin wait 2 closing last ack recv ACK recv ACK of FIN timeout recv FIN: send ACK time wait closed TCP State Diagram

  36. closed listen seq=100 ctl=syn syn-sent listen seq=100 ctl=syn syn-rcvd seq=300 ack=101 ctl=syn,ack syn-sent seq=300 ack=101 ctl=syn,ack estab seq=101 ack=301 ctl=ack seq=101 ack=301 ctl=ack syn-rcvd estab Connection Initiation

  37. closed seq=100 ctl=syn syn-sent listen seq=90 ctl=syn old transmission syn-rcvd seq=300 ack=91 ctl=syn,ack syn-sent seq=300 ack=91 ctl=syn,ack syn-sent seq=91 ctl=rst syn-rcvd seq=100 ctl=syn syn-rcvd seq=300 ack=91 ctl=ack syn-rcvd seq=91 ctl=rst listen syn-sent seq=300 ack=91 ctl=ack syn-sent . seq=100 ctl=syn . . (retransmission) Coping with Problems

  38. estab seq=100 ack=300 ctl=fin,ack close fin-wait -1 estab seq=100 ack=300 ctl=fin,ack close-wait seq=300 ack=101 ctl=ack fin-wait-1 seq=300 ack=101 ctl=ack fin-wait-2 close-wait seq=300 ack=101 ctl=fin,ack close last-ack fin-wait-2 seq=300 ack=101 ctl=fin,ack time-wait seq=101 ack=301 ctl=ack last-ack 2MSL seq=101 ack=301 ctl=ack delay closed time-wait closed Shutdown

  39. Coping With Lost Data

  40. When to Retransmit? • After waiting significantly longer than the average (“smoothed”) roundtrip time • How much longer? • significantly longer than the average deviation • What if one retransmission doesn’t do it? • transmit again … • When? • use exponential backoff • When does one give up? • after 12 retries in some systems

  41. Computing SRTT, Etc.A Little (Sketchy) Math ... • srtt = (1g)srtt + grtt • = srtt + g(rtt  srtt) • = srtt + gEr + gEe • 0.1  g  0.2 • Err = rtt  srtt • srtt = srtt + g1Err • g1 = .125 • dev = dev + g2(|Err|  dev) • g2 = .25 • rto = srtt + 4dev

  42. Measuring RTT • Consider a case in which the average roundtrip time is too small • a timeout occurs on a segment, so the segment is retransmitted • immediately thereafter, the acknowledgment for the original transmission comes in • the sender “thinks” that the ack is for the retransmission, so it concludes that the first segment was lost, but the second segment was acknowledged very quickly, so it should further reduce the average roundtrip time! • Solution: measure the roundtrip time for a packet only if it is not retransmitted

  43. Ack Clocking

  44. Fast Start

  45. Slow Start

  46. 1) 2) 3) Congestion Control (1)

  47. 4) 5) Congestion Control (2)

  48. Fast Retransmit and Recovery • Waiting an entire RTO before retransmitting causes the “pipeline” to become empty • must slow-start to get going again • If one receives three acks that all repeat the same sequence number: • some data is getting through • one segment is lost • immediately retransmit the lost segment • halve the congestion window (i.e., perform congestion control) • don’t slow-start (there is still data in the pipeline)

More Related