Telecommunication Protocols Laboratory Course Lecture 2
Last time We began our study of telecommunication protocols at the Logical Link Control sub-layer (LLC) LLC issues Connectionless vs connection-oriented service to network layer Error handling Framing Error detection (using redundancy) Error control (using frame retransmission) Flow control 2
Example LLC Protocols HDLC High-Level Data Link Control Bit stuffing for framing Full-duplex operation Sliding window for flow control Acknowledgements also for control frames PPP Point-to-point protocol Supports multiple protocols Byte stuffing for framing Allows IP addresses to be negotiated at connection time Permits authentication 3
HDLC frame format Address: used on lines with multiple terminals On p2p lines used sometimes to distinguish commands from responses Data: arbitrarily long Carries network layer protocol data The efficiency of the checksum decreases for big frames Implies a minimum frame of 32 bits (3 fields), without flags 4
Control field Handles acknowledgements and sequence numbers Depending on its form, it defines the type of frame Frame usually called PDU (protocol data unit) Information PDU: I-PDU Transports user data in connection-oriented services Supervisory PDU: S-PDU Flow and error control Unnumbered PDU: U-PDU Carries data in connectionless services and management information in connection-oriented services 5
PDUs 6
Control field First one/two bits define the PDU type 7
I-PDU Combining data to be sent with control information: piggybacking N(S) specifies number of PDU being sent Its own identifying number N(R) specifies number of PDU being expected Implies full-duplex operation ACK field referring to a previous correct reception of PDUs until the next expected one NAK field referring to a previous incorrect reception of the respective PDU Possible to include flow/error/other control information in I- PDUs 8
S-PDU N(R) is used when receiver has no data of its own to send S-PDUs do not transmit data Hence do not need N(S) to identify them Code refers to some coded flow and error control information 9
S-PDU types Receive ready (00): receiving station returns ACK of a received I- PDU In this case receiver has no data of its own to send N(R) contains the sequence number of next expected PDU Receive not ready (01): receiver returns ACK for all PDUs except the one in N(R) Also requests that no more PDUs be sent until a RR S-PDU is issued Reject (10): NAK returned by a receiver in a go-back-n ARQ system When receiver has no data on which to piggyback the response N(R) contains the number of damaged PDU => that PDU and all that follow need to be retransmitted Selective reject (11): requires the retransmission of specified frame 10
Has neither N(S) nor N(R) U-PDU Has 2 code fields, one 2-bit long, another 3-bit long
P/F bit Stands for poll/final, single bit with dual purpose Has meaning only when set (bit=1) It means poll when a PDU is sent by a primary station to a secondary one Address field contains the receiver s address It means final when a PDU is sent by a secondary station to a primary one Address field contains the sender s address In some protocols is used to force the other machine to send a Supervisory frame immediately, rather than waiting for reverse traffic and piggyback 12
PPP usage A home PC acting as an internet host. 13
PPP usage 2 PPP (Point-to-Point Protocol) Data link protocol used to establish a direct connection between two nodes Commonly used by home users to connect via dial-up lines to their ISP, or for router-to-router traffic Designed to additionally support numerous network layer protocols Features Byte-oriented framing method (also handles error detection) Link control protocol (LCP) Network control protocol (NCP) 14
PPP frame format Compared to HDLC: additional Protocol field Address field indicates that frame should be accepted by all stations Unreliable protocol: Control field fixed, no sequence numbers allowed (no flow/error control) At connection time there can be a negotiation whether to omit the two fields above altogether 15
PPP frame format 2 Protocolfield Tells receiver what kind of packet is in Payload field Usually 16 bits but can be negotiated to just 8 bits If it starts with a 0, then Payload contains NL data If it starts with a 1, then Payload contains some other protocols used for negotiating the link Payload field Variable length, default 1500 bytes Another maximum can be negotiated Padding is used to reach maximum length 16
Typical scenario PC calls the ISP router via a modem Router s modem answers the phone and establishes a physical connection PC sends a series of LCP packets in the payload of one/more PPP frames These packets and their responses select the PPP parameters to be used PC sends a series of NCP packets in the payload of one/more PPP frames These packets configure the NL (PC gets a temporary IP address) After user is done, connections are closed: NL, DLL, PhL 17
PPP summary Multi-protocol framing mechanism Suitable to use over various PhL Supports Error detection Option negotiation Header compression (optionally) reliable transmission using a HDLC-type frame format 18
HDLC vs PPP HDLC used mostly in LANs, PPP over p2p links HDLC provides reliable transfer, PPP relies on higher layer protocols for reliability Option negotiation possible only with PPP Integer number of bytes in a frame with PPP PPP is extendible and more versatile 19
So far LLC s job: achieving reliable and efficient communication between 2 adjacent machines We have seen two-party protocols, devised for point-topoint networks 20
The Medium Access Control (MAC) Sub-layer Deals with broadcast channels and their (multi-party) protocols Key issue in broadcast networks: how to determine who gets to use the channel when there is competition for it MAC is a sub-layer of DLL MAC is important for local area networks (LANs) and wireless communications LANs use multi-access channel as a basis for communication Air transmission is inherently broadcast 21
The Allocation Problem Static Channel Allocation FDM (frequency division multiplexing) TDM (time division multiplexing) Dynamic Channel Allocation 22
Dynamic Channel Allocation Assumptions Station Model. Single Channel Assumption. Collision Assumption. (a)continuous Time. (b) Slotted Time. (a)carrier Sense. (b) No Carrier Sense. 23
Station model N independent stations (terminals), each generating frames for transmission When a frame is generated, the station blocks until successful transmission Station has one user Frames are generated at a constant rate 24
Single channel assumption Heart of the model A single channel is available for all communications All stations can transmit and receive on it All stations are equivalent However, protocols may assign priorities to some of them No other external ways of communication 25
Collision Assumption If 2 frames are transmitted simultaneously => they overlap in time => resulting signal is garbled COLLISION All stations can detect collisions A collided frame must be retransmitted There are no other errors except those due to collisions 26
Time Continuous Frame transmission can start at any instant No master clock dividing time into discrete intervals Slotted Time divided into discrete intervals, called SLOTS Frame transmission always begins at the start of a slot Slot may contain 0 frames => idle 1 frame => successful transmission n, n>1 frames => collision 27
Carrier Sense (CS) Yes No Stations can tell if channel in use before trying to use it If channel busy, no station attempts to send anything until it goes idle Stations may terminate their transmissions prematurely if collision is detected LANs usually have CS Stations cannot sense the channel before trying to use it, they simply transmit Later they can determine if a transmission was successful or not Wireless networks usually have no CS 28
Other issues MAC sub-layers do NOT guarantee reliable delivery E.g., the receiver may have not copied the frame correctly (lack of buffer space, missed interrupt) Feedback on transmissions Implicit: property of broadcasting A sender can always find out whether its transmitted frame was destroyed, by listening to the channel, as all other stations do LAN immediate feedback Satellite systems 270 msec delay Explicit: with acknowledgements If no ack arrives, then sender waits random time and sends again 29
Multiple Access Protocols ALOHA Carrier Sense Multiple Access Protocols Collision-Free Protocols Limited-Contention Protocols Wireless LAN Protocol 30
ALOHA Devised in the 70s, University of Hawaii, by Norman Abramson, extended later ( 86) Originally: ground-based radio broadcasting, on 2 frequencies one for sending data, one for receiving acknowledgements Basic idea works for any system with uncoordinated users competing for a single shared channel Two versions Continuous (pure) Slotted 31
Pure ALOHA Users transmit whenever they have data to send There will be collisions, collided frames damaged Sender finds out if transmission was successful With feedback property With acknowledgements If frame collided, sender waits random amount of time and sends again Efficiency of such channel allocation: 18% 32
Pure ALOHA illustration In pure ALOHA, frames are transmitted at completely arbitrary times. 33
Vulnerable time for Pure ALOHA Vulnerable period for the shaded frame. 34
Slotted ALOHA Time divided into slots Each slot corresponds to one frame Agreement on slot boundaries needed (synchronization) One special station can emit a beep at the start of each slot Users send at the beginning of slots only Vulnerable period is halved compared to pure ALOHA => double efficiency: 37% Devised in the 70s, used in some experimental early systems, then abandoned Reused again with Internet over cable, when a channel is needed to be shared among competing users 35
ALOHA comparison Throughput versus offered traffic for ALOHA systems. 36
Carrier Sense Multiple Access (CSMA) protocols Several types Persistent (and p-persistent) Non-persistent CSMA with collision detection (CSMA/CD) 37
(1-)Persistent CSMA When a station has to send, it first listens to the channel If channel busy, station waits until it becomes idle If channel idle, station transmits frame (with probability 1) If collision occurs, a random amount of time passes and everything starts over again Better than ALOHA Propagation delays => bad efficiency Since station transmits as soon as the channel becomes idle => still bad, even without delays 38
Non-persistent CSMA Station senses the channel If channel idle station starts transmitting If channel busy, station waits a random amount of time and then it senses the channel again Better efficiency than persistent CSMA Longer delays, however 39
p-persistent CSMA Applies to slotted channels Station senses channel and if idle: Transmits with probability p Defers transmission until next slot with probability q=1-p At next slot, if idle, same thing Algorithm repeated until frame transmitted or another station begins transmission If channel busy, station waits a random time and senses again If channel initially busy, station waits until next slot and applies algorithm Better performances for small p 40
Persistent and Non-persistent CSMA Comparison of the channel utilization versus load for various random access protocols.
CSMA / CD A different improvement compared to ALOHA Stations abort transmission as soon as they detect a collision => saves time and bandwidth Widely used in LANs (basis of Ethernet) Model At t 0 some station finished transmission Any other station may start transmitting => collisions may occur After a detected collision, stations wait a random time and start sending again, sensing the channel first Backoff exponential algorithm used in Ethernet 42
(Truncated) binary exponential backoff algorithm after 1 st collision, each colliding station waits 0 or 1 slot times before trying again after 2 nd collision, each colliding station waits 0,1,2, or 3 slot times before trying again if a 3 rd collision occurs, each station waits 0 to 2 3-1 slot times after i collisions, each station waits 0 to 2 i -1 slots after 10 collisions the randomization interval is frozen at a maximum of 1023 (2 10-1) slots after 16 collisions a failure is reported and recovery is up to higher layers
(Truncated) binary exponential backoff algorithm - more Dynamically adapts to the number of stations trying to send Ensures a low delay when only few stations collide Ensures that collision is resolved in reasonable interval when many stations collide Truncating the backoff at 1023 keeps the bound from growing too large 44
CSMA/CD conceptual model CSMA/CD can be in one of three states: contention, transmission, or idle. 45
When do we know that a frame was sent successfully? Minimum time to detect a collision Time needed for a signal to propagate from a station to another Worst case scenario τ the time needed for a signal to propagate between farthest stations It takes 2τ until a station is certain it seized the channel (if it transmits for 2τ without hearing a collision, then it is sure) Contention slot of 2τ A sending station must continually monitor the channel To listen for noise bursts indicating a collision CSMA/CD inherently a half-duplex system 46
Collision detection 47
Collision-Free Protocols We assume the N stations have 0 to N-1 wired as addresses inside them 2 protocols Bit-map Binary countdown 48
Bit-map protocol Has a contention period lasting N slots If station j has a frame to transmit, it sends a 1-bit during the j th slot, j=0,...,n-1 After all N slots passed by, stations with frames to send start transmitting in numerical order => no collisions After last station transmitted its frame (all stations can monitor that) another N-bit contention period begins An example of a reservation protocol The desire to transmit is broadcast before the actual transmission 49
Bit Map Protocol illustration 50
Binary Countdown Protocol Network address in binary form, all same length Transmission delays assumed negligible A station wanting to transmit broadcasts its address as a binary bit string, high-order bit starting x = addr 0 addr 1 addr N-1 Arbitration rule: when a station sees that a high-order bit position is 0 in its address and 1 in x, it gives up Station with highest address wins, starts transmitting; after that, another bidding cycle starts Higher numbered stations have a higher priority over lower numbered stations 51
Binary Countdown Protocol illustration A dash indicates silence.
Limited-Contention Protocol: motivation Contention and collision-free methods can be evaluated with respect to Delay at low load (1) Efficiency at high load (2) For (1), contentions are preferable Low delay For (2), collision-free is better Good channel efficiency It would be good to combine these into a protocol using contention at low loads and collision-free at high loads Such protocol named limited contention 53
Limited-contention protocols Stations divided into groups (not necessarily disjoint) Initially only members of group 0 compete for slot 0 If one succeeds, it acquires channel and starts transmitting If there is a collision, only members of group 1 contend for slot 1 etc By managing group division appropriately, the amount of contention for each slot can be reduced How to assign stations to slots? 54
Special cases Each group has one member No collisions (binary countdown, e.g.) Each group has 2 members Probability that both try to send: p 2 OK for small p More and more stations assigned to one slot Probability of contention Length of bit-map scan needed to give everyone a chance One slot with all stations => slotted ALOHA Stations to slots have to be assigned dynamically 55
Adaptive Tree Walk protocol Stations = leaves of a binary tree In slot 0 (first one following a successful transmission) All stations (they are all below node 1) try to acquire the channel If one does, repeat algorithm If there is a collision, go to slot 1 In slot 1 only stations falling below node 2 may compete If one acquires channel, go to slot 2 with node 3 If collision, go to slot 2 with node 4 And so on 56
Adaptive Tree Walk Protocol illustration The tree for eight stations.
Adaptive tree walk protocol - more If a collision occurs during slot 0, entire tree searched, depth first, to find all ready stations Each slot corresponds to a node Collision in a slot (node) => search continues recursively with the node s left and right children Slot (node) idle or successful transmission => search finished for that node (all ready stations determined) 58
Wireless LAN Protocols Wireless LAN system of notebooks communicating by radio In the presence of a base station Without base station (ad-hoc networks) Standard 802.11 ( 97), 802.11a & 802.11b ( 99), 802.11g ( 03) Compatible with Ethernet ( the wired LAN) above DLL: sending IP packets over wireless LANs same as over wired LANs In PhL and DLL (& MAC) several inherent differences exist, compared to Ethernet, so had to be dealt with by the standard CSMA with a wireless LAN is a naïve approach CSMA merely tells if there s activity around the station sensing the carrier; in fact before transmitting, a station needs to know if there s activity around the receiver 59
CSMA does not work The range of a single radio may not cover the entire system.
The hidden (a) and exposed (b) station problems 61
802.11 layers 62
802.11 Service types Basic Service Set (BSS) Building block of 802.11 Made of Fixed or mobile wireless stations A possible central base station, called Access Point (AP) BSS without AP called ad-hoc network Extended Service Set (ESS) Made of 2 or more BSSs with APs BSSs are connected via distribution system 63
BSS illustration 64
ESS APs usually fixed, other stations mobile Distribution system -> usually a wired LAN Can be 802.3 or 802.5 Connects the APs Called also infrastructure network Stations in each other s range can communicate Stations not in each other s range communicate via APs Mobile stations can belong to more than one BSS at the same time 65
ESS illustration 66
Distributed Coordination Function (DFC) Basic access method (contention method) Every station, including APs, is required to implement DCF Ad-hoc networks: the only access method Infrastructure networks Obligatory DCF Optional PCF 67
Hand shaking Refers to the exchange of two control frames before actual frames are sent Station A sends a request-to-send (RTS) frame to station B The message: duration of actual data exchange B responds with a clear-to-send (CTS) frame The message: duration of actual data exchange, copied from RTS Upon receiving CTS, A sends its frame Upon receiving A s frame B sends ACK frame 68
Importance of hand shaking A station hearing RTS refrains from sending until a CTS is sent back to A If a station hears RTS and not CTS => it s not too close to B and can transmit its own data Any station hearing the CTS refrains from sending for the duration indicated in CTS plus some time for ACK to be sent 69
Hand shaking illustration (a) A sending an RTS to B. (b) B responding with a CTS to A.
Collisions If several stations send RTS at the same time => collisions No collision detection mechanism Sender assumes collision if no CTS returns Timer set to wait for CTS Exponential backoff algorithm is used for trying again 71
NAV Stands for network allocation vector The stations hearing an RTS/CTS set up the NAV timer Shows how much time should pass before these stations may check the channel for idleness Hence: each station, before sensing the medium, has to have an expired NAV 72
NAV illustration 73
Fragmentation Wireless networks are noisy and unreliable Probability of success decreases with frame length Fragmentation is then used A fragmentation-threshold parameter defined If frame length exceeds that, frame is fragmented Fragments have own checksum, individually numbered and acknowledged (stop-and-wait) 74
Fragments illustration 75
More on fragments Fragmentation increases throughput Transmission of only the bad fragments, not entire frame Fragment size Not fixed by standard Parameter of the cell, adjusted by base station NAV mechanism keeps stations quiet until 1 st ACK received Another mechanism used to allow the whole burst sent without interference 76
Flow and error control Present also in MAC (not only at LLC level) ACK sent by receivers No NAK When frame is corrupted, silently discarded by receiver Sender has timer to resend frame if ACK not received until timer expires Timer also used for lost frame/ack To prevent duplication, frames have sequence and acknowledgement numbers In data and management frames 77
Inter-frame spaces (IFS) To control access to medium 2 IFSs defined Short IFS (SIFS): high priority frames (CTS, ACK, next fragment of a burst) DCF IFS (DIFS): other situations 78
NAV and IFSs
Point Coordination Function (PFC) Optional access method, to be implemented in an infrastructure network On top of the DCF Used mostly for time-sensitive transmission Uses a centralized, contention-free polling access method Point coordinator software is installed inside AP This software polls for stations capable of polling These stations send their data to AP, one after another 80
More on PCF Before starting a polling cycle, PCF uses the contention method (once) PCF has priority over DCF Implemented with PIFS (PCF IFS): < DIFS If a station wants to use DCF and an AP wants to use PCF, AP has priority To let DCF stations to gain access to medium again (later), a repetition interval is designed 81
Repetition interval Starts with a special control frame called beacon Broadcast periodically (10-100 times/sec) When stations hear the beacon, they set up their NAV for the duration of the contention-free period Contains System parameters Clock synchronization Invitations to new stations to sign up for polling Receive data, sending ACK, receive ACK Piggybacking possible At the end of this period, a CF end (contention-free end) frame is sent This allows stations to use the contention method again
Repetition interval (example)