Telecommunication Protocols Laboratory Course G721 Lecture 1
Behind the name Telecommunication: the science and technology of transmitting information (words, sounds, images) over great distances, in the form of electromagnetic signals (telegraph, telephone, radio, TV) In short: communication at a distance Protocol: a set of conventions for the treatment and formatting of data in an electronic communications system Underlying framework : COMPUTER NETWORKS March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 2
Communication Application Application Network March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 3
Practicalities Schedule: Wednesdays 14-16 Components Lectures (10h), project work (weeks 12-21) 2 credits, no examination Registration Students should register to the course via https://www.it.abo.fi/anmalan/. Webpage http://www.abo.fi/~lpetre/teleprot06/ March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 4
The book We use as textbook Computer Networks, 4th edition, by Andrew Tanenbaum, Prentice Hall, 2003. March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 5
Project work During the lectures we study various network protocols Students group into teams (2-4 members) Each team chooses 3 protocols to simulate The programming environment is chosen by the team The work of the team is documented using a given format as well as a log The programs have to work There are deadlines March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 6
Networks Definition: autonomous computing systems (NODES) are interconnected Advantage resources are accessible independently of their physical location resource sharing and redundancy parallel processing improved reliability, availability, and performance Tradeoff: increased complexity March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 7
Network applications Business applications Resource sharing (e.g. printers, data), communication medium (interoffice and internet, online collaboration, videoconferencing), e-commerce Home applications Access to remote information (e.g. newspapers, online libraries, weather, internet radio) Person-to-person communication (email, instant messaging, chat rooms, newsgroups, peer-to-peer communication, telephony, tele-learning) Interactive entertainment (video-on-demand, games) E-commerce March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 8
Network applications 2 Wireless and mobile users Portable office: conference sites, campuses Trucks, taxis, delivery vehicles, repair persons Military March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 9
Network taxonomy Criterion: transmission technology Broadcast links Point-to-point links Criterion: scale (geographical extent) Very local area networks (personal area network) Local area networks LAN Metropolitan area networks MAN Wide area networks WAN Inter-networks Criterion: organization Private networks Public networks Other criterions Wireless networks Home networks March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 10
Networks for Communication Basic form of communications shared memory message exchange Networks are loosely coupled, they are links without memory there is no shared memory applications residing on different nodes cooperate ONLY by passing messages to each other March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 11
Network Layers Networks organized as stacks of layers Each layer is built upon the one below it offers certain services to the higher layers shields higher layers from the implementation of the services The number, contents, functions and names of layers depends on the network Layer n on one machine communicates with layer n on another machine Rules and conventions used in this: layer n protocol Entities comprising the corresponding layers on different machines: peers (processes, hardware devices, humans) March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 12
Interfaces Between each pair of adjacent layers The primitive operations and services the lower layer makes available to the upper one Clean and clear-cut interfaces Each layer performs a specific collection of wellunderstood functions Simplify the replacement of a layer implementation with a completely different implementation Minimize the amount of information that must be passed between layers March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 13
Layers, protocols, and interfaces March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 14
Network architecture Is a set of layers and protocols The specification of the architecture should contain enough information for building layers that obey the protocols Interfaces and details of implementation are not part of the architecture Protocol stack list of protocols, one per layer, used by a certain system March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 15
Protocol Stack 1 Location A Location B 3 I like rabbits Message Philosopher J'aime bien les lapins 3 2 L: Dutch Ik vind konijnen leuk Information for the remote translator Translator L: Dutch Ik vind konijnen leuk 2 1 Fax #--- L: Dutch Ik vind konijnen leuk Information for the remote secretary Secretary Fax #--- L: Dutch Ik vind konijnen leuk 1 The philosopher-translator-secretary architecture.
Protocol Stack 2 Example information flow supporting virtual communication in layer 5.
Design Issues for the Layers Addressing Layers need to identify senders and receivers Data Transfer Rules Directions of data travel, logical channels Error Control Many error-detecting and error-controlling codes exist The peers have to agree on which ones are used The receiver has to inform the sender about correctly received messages Flow Control Keep a faster sender from swamping a slow receiver Arbitrarily long messages Multiplexing and de-multiplexing Using the same connection for multiple, unrelated communications Routing If multiple paths between source and destination exist, a route must be chosen
Types of services Layers offer 2 types of services to the layers above them Connection-oriented Connectionless Connection-oriented network service Service user establishes connection, uses it, then releases it Connection tube Negotiation between sender, receiver, subnet on parameters such as: maximum message size, quality of service, etc Connectionless network service Each message carries the full destination address and is routed through the system independently of all the others March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 19
Quality of service Usually refers to reliability of services (not losing data) implemented by having the receiver acknowledge the receipt of each message so the sender is sure it arrived acknowledgement process introduces overhead and delays March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 20
Reference models Network architectures OSI reference model Open System Interconnection TCP/IP reference model Transmission Control Protocol/Internet Protocol OSI The associated protocols are not really used The model is quite general and still valid Features discussed at each layer are still important TCP/IP The model is not of much use The protocols are widely used March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 21
OSI/ISO reference model Based on a proposal of ISO (International Standards Organization) Intended as a first step toward international standardization of protocols used in the various layers (1983, revised 1995) It deals with connecting open systems (systems open for communication with other systems) March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 22
OSI model
Physical layer Concerned with transmitting raw bits over a communication channel When a 1-bit is sent, a 1-bit has to be received, not a 0-bit Typical questions How many volts used to represent a 1, how many for a 0 How many ns a bit lasts Whether transmission can proceed simultaneously in both directions How the initial connection is established and how is it then torn down How many pins the network connector has and what are their uses Design issues Mechanical, electrical and timing interfaces Physical transmission medium March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 24
Data Link Layer Transforms a raw transmission facility into a line that appears free of undetected transmission errors to the above network layer Obliges the sender to break up input data into data frames (few hundred or thousands bytes each) and transmit frames sequentially If service reliable => receiver confirms correct receipt of each frame by sending back an acknowledgement frame Flow control regulations and error handling are integrated Medium access control sub-layer Controls access to a shared channel (for broadcast networks) March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 25
Network layer Controls the operation of a subnet Key design issue: how are packets routed from source to destination Routes: static / determined at initialization / highly dynamic Controls the bottlenecks in the subnet Handles quality of service issues: delay, transit time, jitter, etc Compatibility among different networks (addressing, max message sizes, different protocols) Broadcast networks: this layer is very thin March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 26
Transport layer Accepts data from the above layers and manipulates it, ensuring that it arrives correctly at the destination Efficiency is important Hiding the hardware from the above layers also important When a connection is established, the type of service is determined, e.g. Error-free, point-to-point channel Transporting isolated messages Broadcasting True end-to-end layer a program on the source machine carries on a conversation with a similar program on the destination machine using message headers and control messages In contrast, layers 1-3 are chained
Session layer Allows users on different machines to establish sessions between them Session services Dialog control: keeping track of whose turn it is to transmit Token management: preventing 2 parties from attempting the same critical operation at the same time Synchronization: check-pointing long transmissions to allow them to continue from where they were after a crash March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 28
Presentation layer Concerned with the syntax and semantics of the transmitted information Data structures to be exchanged can be defined in an abstract way, along with a standard encoding to be used on the wire Useful for computers with different data representation Manages these abstract data structures and allows higher-level data structures to be defined and exchanged E.g. banking records March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 29
Application layer Contains a variety of protocols commonly needed by users E.g. HTTP basis for WWW File transfer Electronic mail Network news March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 30
TCP/IP reference model US Department of Defense sponsored a research network called ARPANET (1960s) that needed ultimately to interconnect with satellites and radio networks a reference architecture was needed Major goal: the ability to connect multiple networks in a seamless way Another major goal: the ability to survive loss of subnet hardware with existing conversations not being broken off Also: flexible architecture a packet-switching network, based on a connectionless inter-network layer was conceived March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 31
TCP/IP model March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 32
Internet layer Connectionless inter-network layer that holds TCP/IP architecture together It permits hosts to inject packets into any network and have them travel independently to the destination (in possibly another network) Defines an official packet format and protocol called IP (internet protocol) It delivers IP packets to their destination Major issues: packet routing and avoiding congestion Similar in functionality to OSI network layer March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 33
Transport layer Allows peer entities on the source and destination hosts to carry on a conversation Similar to the OSI transport layer 2 end-to-end transport protocols are defined here: TCP (transmission control protocol) UDP (user datagram protocol) March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 34
Hybrid Model March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 35
Layers we will cover Application Layer Transport Layer Network Layer Medium Access Control Sub-layer Logical Link Sub-layer March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 36
The Logical Link sub-layer Studies algorithms for achieving reliable and efficient communication between 2 adjacent machines at DLL Adjacent machines: connected by a wirelike communication channel Bits delivered in exactly the same order in which they are sent Problems to be handled Errors made by communication circuits Finite data rate of communication circuits Non-zero propagation delay
Functions of the Logical Link Layer Interface function: provides service interface to the network layer Error control function: deals with transmission errors Framing Error detection and retransmission Flow control function: regulates data flow, so that slow receivers are not swamped by fast senders
Services Provided to Network Layer (a) Virtual communication. (b) Actual communication.
LLC services Unacknowledged connectionless service Acknowledged connectionless service Acknowledged connection-oriented service March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 40
Unacknowledged connectionless service Source sends independent frames to destination Destination does not acknowledge the frames No logical connection is used If a frame is lost, this is not detected and the frame is not recovered Appropriate when error rate is very low, recovery left to upper layers for real-time traffic (voice) where late data is worse than bad data Most LANs use unacknowledged connectionless service
Acknowledged connectionless service Each frame sent is individually acknowledged The sender knows whether a frame has arrived correctly If an acknowledgement has not arrived within a specified time, frame can be sent again No logical connection is used Appropriate in unreliable channels (e.g., wireless systems) Acknowledgements in LLC: optimization, not requirement
Acknowledged connection-oriented service Source and destination establish a connection before any data is transmitted Frames are numbered LLC guarantees that each frame sent is indeed received each frame sent is received only once all frames are received in the right order Connection-oriented service provides a reliable bit stream 3 phases: establish connection, send, release connection
Framing idea To provide service to NL, LLC uses service of PhL PhL accepts a bit stream and delivers it to destination Bit stream not guaranteed to be error-free It is up to LLC to detect and, if necessary, to correct errors LLC breaks the bit stream into discrete frames and computes some checksum C for each frame At destination the checksum of the received frames recomputed in C If C C DLL knows an error occurred Framing = breaking the bit stream into frames
Frames Relationship between packets and frames. March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 45
Framing methods Character count Flag bytes with byte stuffing Starting and ending flags with bit stuffing PhL coding violations Many LLC protocols use a combination of character count with one of the other methods, for extra safety March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 46
Character count framing A character stream. (a) Without errors. (b) With one error. March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 47
Flag bytes with byte stuffing (a) A frame delimited by flag bytes. (b) Four examples of byte sequences before and after stuffing.
Starting and ending flags, with bit stuffing Bit stuffing also prescribes 01111110 as starting and ending flag (a) The original data. (b) The data as they appear on the line. (c) The data as they are stored in receiver s memory after de-stuffing.
PhL coding violations Applicable in networks where encoding in PhL contains some redundancy 1 bit of data encoded with two physical bits: a 1-bit encoded as a high-low pair, a 0-bit encoded as a low-high pair Every data bit has a transition in the middle, so receiver can easily locate bit boundaries Combinations high-high and low-low are used for delimiting frames in some protocols March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 50
Error Detection and Correction Errors are common on twisted copper pairs and in wireless communication On reliable channels Error-Detecting Codes On prone-to-error channels Error-Correcting Codes March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 51
How to detect errors?
Types of redundancy March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 53
Vertical Redundancy Check Called also parity check A redundant bit (the parity bit) is appended to every data unit so that the total number of 1s in the unit (including the parity bit) is even March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 54
Illustration of VRC March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 55
Longitudinal Redundancy Check
Cyclic Redundancy Check Most powerful, based on binary reduction Predefined binary unit called the divisor The data unit (DU) is appended with a sequence of redundant bits (CRC remainder) so that the resulted DU is exactly divisible by the divisor At destination, the received DU is divided by the divisor If remainder is zero, ok March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 57
More on CRC Required qualities of a CRC To have exactly one bit less than the divisor Appending it to the DU must make the resulting bit sequence divisible by divisor Theory and application of CRC: straightforward The complication: deriving the CRC March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 58
Deriving the CRC March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 59
CRC generator Uses modulo-2 division
CRC checker Uses modulo-2 division in the same way
Polynomials CRC generator typically represented as an algebraic polynomial This is useful Short Proves the concept mathematically
Standard polynomials 12,16, 32 size of CRC remainders CRC divisor s size is hence 13, 17, 33 32-bit CRC used in Ethernet, Token Ring March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 63
Error control LLC has to ensure that all frames are correctly delivered to NL at destination in right order and only once Implemented at LLC and at higher layers Tools Acknowledgements Timers Sequence numbers March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 64
Why flow control? Needed because Receivers have limited memory (called buffer) to store incoming data frames Receivers have limited speed at which to process incoming data Receivers must inform senders before these limits are reached March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 65
Flow control Occurs in LLC and at higher layers Implemented at LLC sub-layer What to do with fast senders that eventually swamp slow receivers 2 methods Feedback-based flow control Set of procedures telling the sender how much data it can send before it must wait for an acknowledgement (ack) Rate-based flow control (never used at DLL, but at NL) March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 66
Types of flow control Upon getting an ack, the sender can Send fewer frames Stop temporarily
Stop-and-Wait Sender waits for an ack after every frame sent
Pros and cons for Stop-and-Wait Advantage: simplicity and safety Disadvantage: inefficiency Each frame is alone on the line If distance between devices is big => transmission time much increased March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 69
Sliding window Sender transmits several frames before needing an ack Hence, receiver acknowledges only some frames An ack confirms receipt of multiple frames Frames can be sent one after another Link efficiently carries several frames at once March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 70
The window Refers to imaginary boxes at both sender and receiver At sender it holds frames Provides the upper limit on the number of frames to be transmitted before ack needed At receiver it holds placeholders for frames Provides the number of frames that may still be received before an ack must be sent March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 71
More on the window Has a predefined length n Identification scheme for frames (sequential numbers) Used to keep track of which frames have been transmitted and which received Frames numbered modulo n+1: 0 n When receiver sends an ack Includes the number of next expected frame Window has dimension n at both ends
Illustration of the window March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 73
Sender window March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 74
Receiver window March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 75
An example
How does the window increase? When ack i is sent, the receiver (or ack i is received, the sender) Increases its window by i positions if this is the first ack Increases its window by i-j positions if the previous ack was j, j<i Increases its window by i+n+1-j positions if the previous ack was j, j>i Note that j=i, if the previous ack was j, is NOT POSSIBLE: window size is n, we have n+1 frame numbers (0 -- n) so j=i => we sent n+1 frames without ack (contradiction) March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 77
Error control In LLC, it refers to methods for error retransmission Automatic Repeat request (ARQ) allows Detection of an error in an exchange => a NAK (negative ack) is returned and the specified frames are retransmitted Existence of lost frames and their retransmission A lost frame is so damaged by noise that is beyond recognition as a frame at all (data or ACK/NAK frame) March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 78
ARQ Implemented as an adjunct to flow control March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 79
Stop-and-Wait ARQ Based on stop-and-wait flow control Extended to handle retransmission of data in case of lost/damaged frames Added features 1. Sender keeps copy of last sent frame 2. Data and ACK frames are numbered with 0/1 3. Receiver finds error => sends NAK 4. Sender has timer March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 80
Damaged frames illustration
Lost data frame illustration March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 82
Lost acknowledgement illustration March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 83
Feature 1 Sender keeps a copy of the last frame transmitted and not acknowledged yet Allows the sender to retransmit all lost or damaged frames until received correctly March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 84
Feature 2 For identification, both data and ACK frames are alternatively numbered with 0 and 1 A data 0 frame is acknowledged by ACK 1 and a data 1 frame is acknowledged by ACK 0 Allows for identification of data frames if duplicate transmission occurs When acknowledgements are lost March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 85
Feature 3 If a data frame is corrupted in transit, receiver classifies it as error and sends back a NAK NAKs are unnumbered When sender gets a NAK, it retransmits the last frame sent Frame transmitted after the last ack, regardless of number March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 86
Feature 4 Sender has a timer If ACK/NAK does not arrive in a preestablished time period, sender assumes the data frame was lost and retransmits it March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 87
Lost ACK/NAK For a retransmitted frame that arrived at receiver before, but its ACK/NAK was lost If the lost frame was a NAK the receiver accepts new copy, returns ACK (if all OK this time) If the lost frame was an ACK the receiver recognizes the new copy as duplicate (it waits for a 1 frame and gets a 0 frame) returns ACK discards the new copy March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 88
Sliding window ARQ Based on sliding window flow control Extended to handle retransmission of data in case of lost/damaged frames 2 popular protocols Go-back-n ARQ Selective-reject ARQ Added features 1. Sender keeps copies of transmitted frames 2. NAK frames also, in addition to ACK 3. Sender has timer March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 89
Feature 1 All transmitted and yet unacknowledged frames have a copy at sender If frames 0 -- n have been sent and last ACK was for frame n-3, then copies of frames n-3, n-2, n-2, n are kept until an ACK arrives for them Assume here n>3 March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 90
Feature 2 If receiver gets damaged data, it then sends back NAK NAKs are numbered NAK n indicates that frames up to n arrived fine and frame n has to be retransmitted Data frames received well do not need each a separate ACK Damaged data frames need each a NAK March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 91
Feature 3 Sender has timer If n frames have been sent and are not yet acknowledged, then timer is started When timer goes off, frames are retransmitted (all or not all, depends on protocol) Lost data frames and lost NAK are thus solved If the lost frame is an ACK, then receiver recognizes the duplicates March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 92
Go-back-n ARQ When one frame is lost/damaged, all frames sent since the last acknowledged frame are retransmitted Specific features for Damaged frame Lost data frame Lost ACK/NAK March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 93
Go-back-n, damaged frame
Go-back-n, lost data frame
Go-back-n, lost ACK/NAK
Go-back-n, more This protocol requires frames to arrive sequentially When one is damaged/lost, sequence is broken and all subsequent frames, even if correctly arrived, are discarded Technically achieved with frame numbers When the sender s timer times out All frames are retransmitted This avoids deadlock March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 97
Selective-reject ARQ Only the specific damaged/lost frame is retransmitted Retransmission is typically out-of-sequence Receiver must know how to sort the frames it has in order to insert the retransmitted one March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 98
Differences compared to go-back-n Receiver Must have some form of sorting logic to reorder out-of-sequence received frames Must have some big-enough buffer Sender keeps all previously received frames on hold, until all retransmissions have been sorted and duplications identified and discarded Must have some sorting mechanism to find and select only the requested frame to retransmit ACK numbers refer to respective frames, not expected ones Sliding window: <= (n+2)/2, if it was n for go-back-n The complexity of this algorithm requires smaller window
Selective-reject, damaged frame
On acknowledgements ACK i implies the successful receipt of frame i and all frames from j+1 to i, if j is the last acknowledged frame, j<i Frames received after a damaged/lost frame cannot be acknowledged until that frame arrived correctly Lost ACK/NAK is likewise in go-back-n March 22, 2006 http://www.abo.fi/~lpetre/teleprot06/ 101
Bidirectional transmission Data frames are sent by both sender and receiver For sending acknowledgements, piggybacking is used When receiver gets a data frame from sender, it does not acknowledge it immediately Receiver waits until its NL passes to it the next packet It then sends this packet as a data frame to sender and also embeds the acknowledgement for the previously received data frame Question: how long to wait for a new data frame, in order to piggyback the acknowledgement on it? Not too much: receiver also gets a timer