1 / 35

Chap. 11 Protocol Layering (I)

Chap. 11 Protocol Layering (I). Protocols allow one to specify or understand communication without knowing the details of a particular vendor’s network

xanthe
Télécharger la présentation

Chap. 11 Protocol Layering (I)

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. Chap. 11 Protocol Layering (I) • Protocols allow one to specify or understand communication without knowing the details of a particular vendor’s network • Complex data communication systems do not use a single protocol to handle all transmission tasks. Instead, they require a set of cooperative protocols, sometimes called a protocol suite • Let’s think of the problems that arise when machines communicate over a data network • hardware failure • network congestion • packet delay or loss • data corruption • data duplication or sequence error • Recall programming language : compiler, assembler, link editor, and loader => 1) support multiple language, 2) linear sequence

  2. Protocol Layering (II) (pp. 161) • The modules of protocol software on each machine as being stacked vertically into layers; each layer takes responsibility for handling one part of the problem Sender Receiver Layer n Layer n . . . . . . Layer 2 Layer 2 Layer 1 Layer 1 Network

  3. Protocol Layering (III) (pp. 162) Software Organization Conceptual Layers Protocol 1 Protocol 2 Protocol 3 High Level Layer IP Module IP Layer NI Layer NI 1 NI 2 NI 3 Sender Receiver Others... Others... IP Layer IP Layer IP Layer IP Layer N.I N.I N.I N.I Net 1 Net 2 Net 3

  4. OSI 7-Layer Reference Model vs. TCP/IP Internet Layering Model (pp 163, 166) • Once the decision has been made to partition the communication problem into sub-problems and organize the protocol software into modules that each handle a sub-problem Layer Functionality 7 Application Objects Passed Between Layers 6 Presentation Conceptual Layer 5 Session Application Message or Stream 4 Transport Transport Transport Protocol Packet Network Internet 3 IP Datagram Data Link (H/W Interface) Network Interface 2 Network Specific Frames Physical H/W Connection Hardware 1

  5. Protocol Layering Principle(pp. 169, 170) • Independent of the functions of the layers, the operation of layered protocols is based on a fundamental idea: Layered protocols are designed so that layer n at the destination receives exactly the same object sent by layer n at the source • It allows the protocol designer to focus attention on one layer at a time, without worrying about how lower layers perform Host A Host B Application Application Identical message Transport Transport Identical packet Internet Internet Identical datagram N. I. N. I. Identical frame Physical Network

  6. Two Boundaries in the TCP/IP Model(pp. 173) • The conceptual protocol layering includes two boundaries • a protocol address boundary that separates high-level and low-level addressing • an operating system boundary that separates the system from application programs Conceptual Layer Boundary Application Software outside the operating system Software inside the operating system Transport Internet Only IP addresses used Physical addresses used Network Interface Hardware

  7. Multiplexing and Demultiplexing(pp. 176) • Communication protocol uses techniques of multiplexing and demultiplexing throughout the layered hierarchy • when sending a message, the source includes extra bit that encode the msg. type, originating program, and protocol used • all messages are placed into network frames for transfer and combined into a stream of packets • at the receiving end, the destination uses the extra information to guide processing ICMP UDP TCP IP: multiplexing demultiplexing Datagram arrives

  8. Chap. 12 (13) UDP, TCP General (I) • Two transport protocols utilized by most application processes are TCP and UDP, to indicate that both use IP also • The main issue with transport layer is QoS(Quality of Service) to be provided to applications, whilst IP considers the internetworking issues, such as address and routing • Six characteristics determines the type of service provided by a particular protocol, that is TCP or UDP • 1) connection-oriented or connectionless • 2) sequencing • 3) error control • 4) flow control • 5) byte stream or messages • 6) full-duplex or half-duplex Application Reliable Stream (TCP) User Datagram (UDP) Internet (IP) Network Interface

  9. UDP, TCP General (II) • A connection-oriented service requires that the two application programs establish a logical connection with each other before communication can take place • there is some overhead involved in establishing this connection • virtual circuit is used to describe this service, since it appears to the application that they have a dedicated circuit between them, even through the actual data flow usually takes place using a packet switched network • often used when more than one message is to be exchanged between the two peer entities • involves three steps - connection establishment - data transfer (may be lengthy) - connection termination

  10. UDP, TCP General (III) • the converse of a connection-oriented service is a connectionless service, also called a datagram service • in the datagram model, one message at a time is transmitted from one system to the other • since each message is transmitted independently, each must contain all information required for its delivery • TCP provides a connection-oriented virtual circuit, while UDP provides a connectionless datagram facility • Sequencing means the data is received in the same order as it is transmitted by the sender • in a packet switched network, it is possible for two consecutive packets to take different routes from the source to the destination, so the destination may receive in a different order • TCP sequences the data, providing it to the receiver in the same order as it was transmitted, while UDP datagrams are not sequenced

  11. UDP, TCP General (IV) • Error control means error-free data is received by the application program • there are two conditions that can generate errors: the data gets corrupted, or the data gets lost • a technique to detect data corruption is for the sender to include a checksum so the receiver can verify, with a high probability, that the data does not get modified • if the data does get corrupted, the receiver has to ask the sender to retransmit the data • checksum are usually combined with positive acknowledgment - the receiver notifies the sender each time a data message is received, either correctly or with errors • if the data was received correctly the sender can discard it, otherwise it must be retransmitted

  12. UDP, TCP General (V) • to handle the loss of data somewhere in the network requires that the sender starts a timer after it has sent a data message, and if the timer expires the sender must retransmit • when positive ack. and timeout are being used, it is possible not only for data to get lost but for ack. to also be lost • if this happens, the original sender will retransmit the data, causing the other end to receive the same data twice • this requires the receiver to perform duplicate detection - determine when data has already been received and ignore the duplicated message • TCP provides an end-to-end checksum, positive ack., and duplicate detection • UDP does not provide positive ack. Or duplicate detection. An end-to-end checksum is optional with UDP

  13. UDP, TCP General (VI) • Flow control assures that the sender does not overwhelm the receiver by sending data at a rate faster than the receiver can process the data • if flow control is not provided, it is possible for the receiver to lose data because of a lack of resources • TCP provides an end-to-end flow control, while UDP does not • A byte-stream service does not provide any record boundaries to the data stream • the converse of this feature is a message-oriented service that preserves the sender’s message boundaries for the receiver • TCP is a byte-stream, while UDP provides message boundaries • A full-duplex connection allows data to be transferred in both directions at the same time between the two peer entities • half-duplex protocols allow only one side to transfer at a time • TCP is full duplex

  14. UDP, TCP (Summary) • Since the IP provides an unreliable, connectionless service for TCP, it is the TCP module that contains the logic necessary to provide a reliable, virtual circuit for a user process IP UDP TCP port numbers? no yes yes connection-oriented? no no yes message boundaries? yes yes no data checksum? no opt. yes positive acknowledgment? no no yes timeout and retransmit? no no yes duplicate detection? no no yes sequencing? no no yes flow control? no no yes

  15. Chap. 12 UDP (I) • Current operating system support multiprogramming • multiple applications would be executed simultaneously • = multitask • A process is the ultimate destination for a message, but IP delivers a datagram to only the destination host, and • processes are created and destroyed dynamically • process identifier would be changed in times • much reasonable to identify destinations from the functions • Instead of thinking of a process as the ultimate destination, Internet provides a set of abstract destination points called protocol port, which is • possible for more than one user process at a time to be using either TCP or UDP • consist of 16-bit integer

  16. UDP (II) • UDP datagram format • UDP encapsulation 0 8 16 24 31 UDP Source Port UDP Destination Port UDP Message Length UDP Checksum (0 or …) Data ... UDP Header UDP data area IP Header IP data area Frame Header Frame Data Area

  17. UDP (III) • The IP is responsible only for transferring data between a pair of hosts, while the UDP is responsible only for differentiating among multiple source or destinations within one host • Multiplexing and demultiplexing between UDP software and application programs occur through the port mechanism Port 1 Port 2 Port 3 UDP: multiplexing demultiplexing UDP Datagram arrives IP layer

  18. UDP (IV) • When a client process wants to contact a server, the client must have a way of identifying the server that it wants • Assuming that the client knows the server’s IP address, how does the client identify the particular server process • To solve this problem, a group of well-known ports are defined • the port 1 - 255 (1 - 1023 for BSD UNIX) are reserved • Now, the hierarchical addressing scheme is: • IP datagram contains the two 32-bit IP addresses • also IP header contains a protocol identifier • UDP or TCP header contains the two 16-bit port # for identifying a user process (TCP ports are independent of UDP port) • If the length of the IP datagram (the data, UDP header, IP header) is greater than the MTU of the network, then the IP layer has to fragment the packet

  19. UDP (V) • Reserved UDP Port Number (pp. 187) • Hierarchical addressing scheme IP address identifies this machine Protocol “06” is the TCP protocol 06 TCP 203.234.18.72 21 25 Port determines which application gets incoming data FTP SMTP Network IP 17 UDP 69 7 ECHO TFTP

  20. Chap. 13 TCP (I) • At the lowest level, computer communication networks provide unreliable packet delivery; lost, error, delay, disorder, duplicate • However, at the highest level, application programs often need to send large volumes of data from one to another • it requires programmers to build error detection and recovery into each application program • A general purpose solutions to the problems of providing reliable stream delivery := TCP (Transmission Control Protocol) • TCP properties • stream orientation • virtual circuit connection • buffered transfer • unstructured stream • full duplex connection

  21. TCP (II) • How can protocol software provide reliable transfer if the underlying communication system offers only unreliable packet delivery? • A single common fundamental technique : positive acknowledgement with retransmission • the sender sends data, saves the data, and starts a timer • the receiver sends back ACK message as it receives data • if the sender receives the ACK within the timeout, • it sends the next data • else it will send the data again • A simple positive acknowledgement protocol wastes a substantial amount of network bandwidth because it must delay sending a new packet until it receives an acknowledgement for the previous packet := sliding window system

  22. TCP (III) • Sliding window system ... initial window 1 2 3 4 5 6 7 8 9 10 ... 1 2 3 4 5 6 7 8 9 10 Window slides ... 1 2 3 4 5 6 7 8 9 10 sent, but not ACKed can’t send until window moves sent and ACKed can send ASAP

  23. TCP (VI) • Transmission control protocol (TCP) is a communication protocol, not a piece of software • TCP uses the connection, not the protocol port, as its fundamental abstraction; connections are identified by a pair of endpoints, that is, a pair of integers (host, port) • cf) in the UDP, each endpoint matches a single object • (18.26.0.36, 1069) and (128.10.2.3, 25) • (128.9.0.32, 1184) and (128.10.2.3, 53) • (128.2.254.139, 1184) and (128.10.2.3, 53) • TCP identifies a connection by a pair of endpoints, a given TCP port number can be shared by multiple connections on the same machine

  24. TCP (V) • Passive open (initiator) and active open (responder) • unlike UDP, TCP is a connection oriented protocol that requires both endpoints to agree to participate • Data stream : a sequence of octets or bytes • Segment : a unit of transmission, it usually matches with a single IP datagram • Sliding window mechanism • efficient transmission (throughput) • flow control (busy, buffer …) • operates at the octet level

  25. TCP (VI) • Segment are exchanged to: • establish/close connections • transfer data • send acknowledgement 0 8 16 24 31 Source Port Destination Port Sequence number Acknowledgement number Hlen Reserved Code bits Window Checksum Urgent Pinter Option (if any) Padding Data ...

  26. TCP (VII) • A user process will be assigned a unique port number (that is short lived) per connection • Let’s assume that a client sends a message to the FTP server on some host by sending a message to port 21. How does the FTP server know where to send its response? • the server can obtain the 32-bit Internet address of the client from the IP datagram • the client process also has its TCP module assign it some unique port number to identify it on the client’s host • the server can obtain the 16-bit port number from the TCP header • as long as the client’s TCP module does not reassign this port number to some other process, until the first client is finished, there won’t be any conflict

  27. TCP (VIII) • When a connection is established, the two ends can optionally agree on the maximum segment size (MSS), if this is not performed, the default must be 536 (cf. 576 + 20 + 20) • For performance reasons, however, most TCP implementation try to prevent IP fragmentation with making MSS under MTU • TCP presents a byte-stream service to the user process; there are no explicit or implicit record boundaries • Data is usually buffered by both the transmitter and the receiver • The TCP may aggregate the data internally before sending it to network, or before passing it to the receiving process User process Send buffer Receive buffer User process network Byte-stream service layer Byte-stream service layer

  28. TCP (IX) • When a user process wants to disable this buffering, consider a terminal emulation program that has the remote system doing the echoing • The UNIX interrupt key is one example of this, as are the terminal flow control characters, such as ^S or ^Q : this type of information is termed out-of-band data out-of-band data out-of-band data User process Send buffer Receive buffer User process network Byte-stream service layer Byte-stream service layer

  29. TCP (X) • TCP does not have true out-of-band data, but it provides what it calls urgent data • To send urgent data, TCP provides a bit in the TCP header along with a pointer in the TCP header (pp. 205) • When the urgent bit is set, the pointer specifies the byte position in the data stream of the last byte of urgent data • does not provide a way to specify where the urgent data begins • All that TCP provides is a notification from the sender to the receiver that urgent mode has started, and the urgent data ends • It is possible for the receiver to be notified that urgent mode has started, before it can read the last byte of urgent data • The most common use of urgent data is by the telnet and rlogin applications

  30. TCP (XI) • When to retransmit? • after waiting significantly longer than the average (“smoothed”) roundtrip time • What if one retransmission does not do it? • transmit again … • When? • use exponential backoff • When does one give up? • after 12 tries in Digital UNIX

  31. TCP (XII) • TCP maintains two windows for each connection, one for the data being sent and another for the data being received • Flow control is achieved by varying the window size • There are wide variations in the round-trip times associated with a given connection. If a network is running at 50% capacity, the round-trip time can vary by a factor of 4 • It is essential that the protocol measure and keep track of the average round-trip time and its variation • Jacobson’s algorithm maintains both the average and the mean deviation of the round-trip times

  32. TCP (XIII) • 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 acknowledgement for original transmission comes in • the sender think that the ack is for the retransmission, so it concludes that the first segment was lost, but the second segment actually was acknowledged very quickly, so it should reduce the average roundtrip time! • This is the retransmission ambiguity problem • Karn’s algorithm specifies what to do when a timeout occurs and a reply is eventually received to a retransmission • measure the roundtrip time for a packet only if it is not retransmitted

  33. TCP (XIV) • Consider two gateways connected by a slow leased phone line and each also connected to an Ethernet LAN • If host #1 starts sending data as fast as it can to gateway #1, eventually the gateway will run out of buffers since the data transfer across the slower WAN is far less than the transfer across the Ethernet • With the slow start algorithm a new connection starts out with a limit of a single segment if the destination is not on a directly connected network LAN (Ethernet) WAN LAN (Ethernet) Gateway #1 Gateway #2 (phone line) Host #1 Host #2

  34. TCP (XV) • Each time an acknowledgement is received, the limit is increased by one segment • The ack, is an end-to end ack. from the other host’s TCP software, hence it takes into account the slowest link between the two end systems • In addition to this slow-start algorithm, TCP also adapts to changes along the path using a congestion avoidance algorithm • Congestion avoidance is triggered by a timeout occurring • Both the slow-start algorithm and the congestion avoidance algorithm require two additional state variable: a congestion window and a threshold size • The sender’s output routine always sends the minimum of the receiver’s advertised window and the congestion window

  35. TCP (XVI) • If timeout occurs, one-half of the current window size is recorded in the threshold variable and the congestion window is reset to one segment (to initiate slow start) • When new data is acknowledged, if we’re in the slow-start algorithm the congestion window is opened exponentially. • otherwise we want to avoid congestion so we open the congestion window by one segment • Hence, slow start opens the window quickly to what it thinks is a safe point, then congestion avoidance takes over and slowly increases the window size to see if more bandwidth is available • Sow start is a form of flow control used by the sender • Windows are a form of flow control used by the receiver

More Related