510 likes | 680 Views
Local Area Networks and Medium Access Control. Computer Networks. Dr C. C. Constantinou ( originally prepared by N.J.Flowers). Reading. Chapter 6 of Leon-Garcia and Widjaja In particular §6.1, §6.2, §6.4, §6.4 Self-study §6.5 Chapters 3 and 4 of Tanenbaum Chapter 5 of Kurose and Rose
E N D
Local Area Networks and Medium Access Control Computer Networks Dr C. C. Constantinou (originally prepared by N.J.Flowers)
Reading • Chapter 6 of Leon-Garcia and Widjaja • In particular §6.1, §6.2, §6.4, §6.4 • Self-study §6.5 • Chapters 3 and 4 of Tanenbaum • Chapter 5 of Kurose and Rose • Chapter 6 is on the peculiarities of wireless LANs – optional reading, but really important these days
Basic network types • Switched networks – multiple networks connected via multiplexers and switches which direct (route) packets from source to destination – usually Wide Area Networks • Broadcast networks – data is received by all receivers. Usually Local Area Networks • This lecture will concentrate on Broadcast Networks – also called Multiple Access Networks since the medium is shared
Broadcast Networks • Advantages • No routing • Simple, flat addressing scheme, hence low overhead • Cheap and simple • Disadvantages • Not scalable • Need some control – like in a meeting
Broadcast Networks • Radio communications – walkie-talkies • Satellite communications • Mobile telephones • Coaxial cable networks • Bluetooth (2.4GHz radio) • Topology can be Ring, Star or Bus
Directly connected, wire-like Losses & errors, but no out-of-sequence frames Applications: Direct Links; LANs; Connections across WANs Data Links Services Framing Physical addressing Error control Flow control Multiplexing Link Maintenance Security: Authentication & Encryption Examples PPP HDLC Ethernet LAN IEEE 802.11 (Wi Fi) LAN Packets Packets Data link layer Data link layer Frames A B Physical layer Physical layer Data Link Protocols
Collisions • With broadcast networks we can have collisions when two transmissions occur at the same time and interfere • We need a protocol to prevent or minimise collisions • This is a Medium Access Control protocol – MAC • All devices that share the medium are in the same broadcast domain • All devices need to agree on the MAC and be coordinated even if not involved in the current message on the network
MAC Schemes • Two basic ways to control access • Random Access – like a meeting without a chairman. Collisions occur but the protocol does something to fix it • Scheduling – slots are allocated to each device in turn like a meeting with a chairman
What is a collision? • When two stations transmit at the same time - but we need to consider the propagation delay • Even if the channel is empty collisions can occur • For a collision B must transmit between 0 and tprop but A doesn’t detect collision until 2tprop (worse case)
Setup time • A must wait at least 2tprop before it knows the channel is free – this is the negotiation or coordination time • If bit rate is R bps, then setup time uses 2tpropR bits – these are effectively wasted. • If the average packet length is L, the efficiency in use of the channel is
Random access MAC • Simplest form is just to transmit when desired – don’t listen for silence first • First system was ALOHA – University of Hawaii needed to connect terminals on different islands • Used radio transmitters that send data immediately – this gives no setup delay • Transmitters detect collision by waiting for a response – if a collision occurs, there will be data corruption and the receiver says ‘send again’ • Collisions result in complete re-transmission • For light traffic, low probability of collision so re-transmissions are infrequent
ALOHA • Problem is a collision involves at least two devices – both need to re-transmit • If both devices re-transmit immediately (or after the same delay) another collision will occur…. and again…. and again • ALOHA requires a random delay after collision before re-transmission • Since devices don’t listen for silence before transmission this delay must allow one transmitter to complete its transmission – delay is long to ensure this • Likelihood of collision is increased after each collision
Collision limit • For lightly loaded network, get very few collisions so throughput is high • As traffic increases, more and more collisions generate more and more collisions…… wasting bandwidth
Collision dominated • For heavily loaded networks the collisions cause collisions and every packet takes many attempts to get through – intimately network becomes collision dominated and throughput goes down to zero • Peak throughput is 18.4% of channel capacity
Slotted ALOHA • Need to reduce collisions to improve throughput • Slotted ALOHA constrains stations to transmit in specific synchronised time slots • Time slots are all the same and packets occupy one slot • All devices share the slots – collisions are reduced since the can only occur at the start of the slot – cannot have a collision half way through a transmission • A ‘Don’t interrupt me once I’ve started’ protocol !
Slotted ALOHA • Better performance under light load than pure ALOHA • Maximum throughput is 36.8%
ALOHA problem • Channel bandwidth is wasted due to collisions • We can reduce collisions by avoiding transmissions that are certain to cause a collision • ALOHA transmits without first without listening to check the channel is free • Can sense the medium for presence of a signal before transmitting • Carrier Sense Multiple Access – CSMA MAC scheme
CSMA • Station A transmits – as other stations detect the signal, they defer any transmissions • After tprop station A has captured the channel • Vulnerable period is t= tprop
CSMA – when to stop waiting • If the channel is busy, station wishing to transmit waits until what happens? • 1-Persistent CSMA • Wait until channel is free and transmit immediately – but it’s likely more than one transmitter is waiting so a collision is likely • ‘Greedy’ access mechanism resulting in high collision rate
Non-persistent CSMA • Stations wanting to transmit sense the channel • If busy, they re-schedule another sense for later • Re-scheduling method is called the Backoff algorithm • If channel is free at re-sense, transmit, else re-schedule again • Since stations do not persist in sensing the channel and ‘come back later’ for another look, collisions are reduced • The drawback is the re-sense may be scheduled for a lot longer than needed – channel may be free before backoff algorithm times out so efficiency is lower than 1-Persistent CSMA
p-Persistent CSMA • A combination of 1-Persistent and Non-Persistent • Stations wanting to transmit sense the channel • If busy, they continuously re-sense until it becomes idle • With a probability p, the station transmits immediately • With a probability 1-p, the station re-schedules another sense (often delay is tprop) • Note - delay is from channel becoming free – with Non-Persistent the delay was from first sense time
Advantages of p-Persistent • Efficiency is good since there is a probability p of instant transmission when channel is free – the higher p the better (ultimately p=1 becomes 1-Persistent CSMA) • Probability p of two devices transmitting causing a clash – the lower p the better (ultimately p=0 becomes 0-Persistent or Non-Persistent CSMA) • …. hence the value of p is a compromise and depends on many factors
CSMA performance • CSMA is sensitive to propagation delay and other factors – typical performance 53 to 81% - better than ALOHA (18 to 37%) 1-Persistent Non-Persistent
CSMA and ALOHA problem • Both CSMA and ALOHA collisions involve an entire packet – the collision is not detected until the entire packet is sent • E.g. a 1500 bit packet, collision occurs after 10 bits, the remaining 1490 bytes are still sent and will be corrupted • The receiver will detect this (via a checksum) and respond with a Negative Acknowledgement (NAK) and the data will be sent again • This is inefficient – the last 1490 bits are a waste of channel capacity
CSMA-CD • Better channel usage if we detect the collision when it occurs rather than waiting until the end of the packet • Carrier Sense Multiple Access with Collision Detection - CSMA-CD • Performed by the transmitting station listening to itself and if what it hears is different from what it sends then there is a collision • If this occurs, transmitter sends a short jamming signal which notifies all stations there has been a collision – without this the receiver will not know there has been a collision and will continue to listen • Then the transmission is aborted and a re-try scheduled
Protocol - Without a chairman = CSMA-CD • One person speaks, all others listen • Before someone speaks, they check that nobody else is talking, then they talk • If two people start talking at the same time, both stop and apologise, and one of them re-starts talking • Multiple Access – MA • Carrier Sense – CS • Collision Detect - CD
MAC – the scheduling approach • Previous MAC’s have been random access • Simple to implement, good performance EXCEPT under heavy load – collision dominated • Scheduling Systems are a way of controlling access to the media – like a meeting with a chairman • Each station has a reserved slot when it can transmit so no collisions • Disadvantage is some stations may not want to transmit and this slot is wasted
Reservation Systems • To overcome this, we have a special timeslot where devices say if they want to talk – this is a minislot within the reservation interval
Reservation Systems • Listeners pickup the reservation packet and can work out who said what in subsequent packets • Talkers also know when to talk since they also pickup the reservation packet r • Time between r and next r is a frame • Wasted bandwidth is only length of r per frame – the larger the frame, the higher the efficiency. Typically 95% for 20 packets per frame
Polling • Reservation requires stations make explicit reservation ahead of time • Polling is where stations take turn to access the medium • The right to access is then passed to the next station via some mechanism • This does not occur in fixed time slots – the access control mechanism is flexible
Centrally controlled polling • A master controller sends a polling message to one station, this then sends the data (which may be nothing) and finishes with a go-ahead message • Central controller then polls the next station – this may be round-robin or some otherorder
Token Passing Networks • Another way of polling – the right to access is a token that is passed from one station to the next (no central controller) • When listening, devices copy data from input to output hence passing everything along • When transmitting, devices receive data coming in, modify or add to it and send this on to the next station
How to transmit • A station that wants to transmit waits for a free token • The ‘free token’ is the polling message that allows access to the medium • Station then modifies the token to say the medium is no longer free, adds its data and sends this on • This full packet eventually reaches the destination where it is read • Packet must be removed from the ring – either: • Receiver does this and does not forward the packet • Receiver marks the token as read and sends it on – the transmitter then removes the packet. This is an acknowledgment that the packet was read OK
Token re-insertion • After transmission is complete, a new free token needs to be re-inserted • Most common form is whoever removed the full packet re-inserts a new free token • Another problem – since devices re-generate the data, what if device is switched off during this? Free token is lost… • Normally there is a nominated controller that re-starts the ring if the token is lost
Typical MAC Efficiencies Normalized Delay-Bandwidth Product Propagation delay Time to transmit a frame • If a<<1, then efficiency close to 100% • As a approaches 1, the efficiency becomes low CSMA-CD (Ethernet) protocol: Token-ring network a΄= latency of the ring (bits)/average frame length
Typical Delay-Bandwidth Products • Max size Ethernet frame: 1500 bytes = 12000 bits • Long and/or fat pipes give large a
MAC protocol features • Delay-bandwidth product • Efficiency • Transfer delay • Fairness • Reliability • Capability to carry different types of traffic • Quality of service • Cost
MAC Delay Performance • Frame transfer delay • From first bit of frame arrives at source MAC • To last bit of frame delivered at destination MAC • Throughput • Actual transfer rate through the shared medium • Measured in frames/sec or bits/sec • Parameters R bits/sec & L bits/frame X=L/R seconds/frame l frames/second average arrival rate Load r = l X, rate at which “work” arrives Maximum throughput (@100% efficiency): R/L fr/sec
E[T]/X Transfer delay 1 r rmax 1 Load Normalized Delay versus Load E[T] = average frame transfer delay • At low arrival rate, only frame transmission time • At high arrival rates, increasingly longer waits to access channel • Max efficiency typically less than 100% X = average frame transmission time
a > a E[T]/X a a Transfer Delay 1 r rmax rmax 1 Load Dependence on Rtprop/L
Comparison of MAC approaches • Aloha & Slotted Aloha • Simple & quick transfer at very low load • Accommodates large number of low-traffic bursty users • Highly variable delay at moderate loads • Efficiency does not depend on a • CSMA-CD • Quick transfer and high efficiency for low delay-bandwidth product • Can accommodate large number of bursty users • Variable and unpredictable delay
Comparison of MAC approaches • Reservation • On-demand transmission of bursty or steady streams • Accommodates large number of low-traffic users with slotted Aloha reservations • Can incorporate QoS • Handles large delay-bandwidth product via delayed grants • Polling • Generalization of time-division multiplexing • Provides fairness through regular access opportunities • Can provide bounds on access delay • Performance deteriorates with large delay-bandwidth product
What is a LAN? Local area means: • Private ownership • freedom from regulatory constraints of WANs • Short distance (~1km) between computers • low cost • very high-speed, relatively error-free communication • complex error control unnecessary • Machines are constantly moved • Keeping track of location of computers a chore • Simply give each machine a unique address • Broadcast all messages to all machines in the LAN • Need a medium access control protocol
RAM RAM Typical LAN Structure • Transmission Medium • Network Interface Card (NIC) • Unique MAC “physical” address Ethernet Processor ROM
Medium Access Control Sublayer • In IEEE 802.1, Data Link Layer divided into: • Medium Access Control Sublayer • Coordinate access to medium • Connectionless frame transfer service • Machines identified by MAC/physical address • Broadcast frames with MAC addresses • Logical Link Control Sublayer • Between Network layer & MAC sublayer
OSI IEEE 802 Network layer Network layer 802.2 Logical link control LLC Data link layer 802.11 Wireless LAN Other LANs 802.3 CSMA-CD 802.5 Token Ring MAC Physical layer Various physical layers Physical layer MAC Sub-layer
C A Reliable frame service A Unreliable Datagram Service C LLC LLC LLC MAC MAC MAC MAC MAC MAC PHY PHY PHY PHY PHY PHY Logical Link Control Layer • IEEE 802.2: LLC enhances service provided by MAC
Logical Link Control Services • Type 1: Unacknowledged connectionless service • Unnumbered frame mode of HDLC • Type 2: Reliable connection-oriented service • Asynchronous balanced mode of HDLC • Type 3: Acknowledged connectionless service • Additional addressing • A workstation has a single MAC physical address • Can handle several logical connections, distinguished by their SAP (service access points).
LLC PDU Structure 1 1 or 2 bytes 1 byte 1 Source SAP Address Destination SAP Address Control Information Source SAP Address Destination SAP Address C/R I/G 1 7 bits 7 bits 1 Examples of SAP Addresses: 06 IP packet E0 Novell IPX FE OSI packet AA SubNetwork Access protocol (SNAP) I/G = Individual or group address C/R = Command or response frame
IP Packet IP LLC Header LLC PDU Data MAC Header FCS Encapsulation of MAC frames