Lecture 3 - Media Access Control (MAC)
Bit Stuffing
"data transparency" requirement: data field must be allowed to include flag pattern <01111110> - Q: is received <01111110> data or flag (in HDLC)? ->data Bit stuffing: to distinguish the data pattern 01111110 in the body from the special "beginning/end" sequence - after transmitting any 5 consecutive 1s in body, insert a 0 - 011111xxxx => 0111110xxx - At the receiver side: stuffed bit is removed Mostly flag is a special 8-bit pattern "01111110" used to define the beginning and the end of the frame. Problem with the flag is same as that was in case of byte stuffing. So, in this protocol what we do is, if we encounter 0 and five consecutive 1 bits,an extra 0 is added after these bits. This extra stuffed bit is removed from the data by the receiver. The extra bit is added after one 0 followed by five 1 bits regardless of the value of the next bit. Also, as sender side always knows which sequence is data and which is flag it will only add this extra bit in the data sequence not in the flag sequence.
Data Protected Error Checking
- May include header fields - Error detection not 100% reliable! protocol may miss some errors, but rarely - larger EDC field yields better detection and correction Common technique for detecting transmission error - Parity Checking - Checksum - CRC (Cyclic Redundancy Check) Used in many protocols in the protocol suite
3 ARQ Strategies
1) Stop-and-wait ARQ 2) Go-back-N ARQ 3) Selective-repeat
10BaseT and 100BaseT
10/100 Mbps rate; latter called "fast ethernet" T stands for Twisted Pair Star toplogy, max 100m between node and hub Hubs: physical-layer repeaters - bits coming from one link go out all other links at the same rate - no frame buffering - no CSMA/CD at hub: adapters detect collisions - provides net management functionality
Legacy Ethernet
10Base5 - Bus topology with coaxial cable - 10 Mbps, Up to 500m each segment - No more than 4 repeaters between any pair of stations - Max 2500 m - Max 1024 hosts 10Base2 - Daisy chain - Up to 200m
Wireless LANs Technologies/Protocols
802.11 a/b/g different Phy technologies: - 802.11 b/g: 20 MHz channel in 2.4 GHz, up to 11 Mbps (802.11b), 54 Mbps (802.11g) phy data rate - 802.11a: 20 MHz channel in 5GHz, up to 54 Mbps phy data rate 802.11n: - 130 Mbps phy data rate on 20 MHz channel (2 x 2 MIMO) - 300 Mbps phy data rate on 40 MHz channel (channel bonding with 2 x 2 MIMO)
Cyclic Redundancy Check (CRC)
A (n+1)-bit message M can be represented as a polynomial of degree n. For example, - X = 10011010; - M(X) = X7 + X4 + X3 + X Choose k+1 bit pattern (divisor), C(X), a polyn of degree k goal: get k CRC bits, Y, such that - P=<M,Y> exactly divisible by C (modulo 2) - receiver knows C, divides <M,Y> by C. If non-zero remainder: error detected! - can detect all burst errors less than k+1 bits THIS IS EXTREMELY COMPLICATED COME BACK TO IT LATER
Polling (Demand Assignment Protocols)
A central controller interrogates each host and allocates channel capacity to those who need it Good for systems with: - Short propagation delay - Small polling messages - Non-bursty traffic
Control Frame
A control frame is a frame with header only (no data).
Repeater
A repeater is a network device that is used to regenerate or replicate signals that are weakened or distorted by transmission over long distances and through areas with high levels of electromagnetic interference (EMI).
Turn-Based Protocols
A token (8 bit pattern) circulates around the ring Token state: ◦ Busy: 11111111 ◦ Idle: 11111110 General Procedure: Sending host waits for and captures an idle token Sending host changes the token to a frame and circulates it Receiving host accepts the frame and continues to circulate it Sending host receives its frame, removes it from the ring, and generates an idle token which it then circulates on the ring One station on the ring is designated as the "monitor station"
Exposed Station Problem and Handshaking
A wants to send to B -> transmits RTS RTS of A is only heard by B & C B (the receiver) sends CTS. But the CTS of B will not reach C C sense the channel as idle and thus sends RTS, in order to send to D D sends CTS that collides with the data received from A, at C listen RTS -> transmitter is close listen CTS -> receiver is close Note: RTS/CTS does not solve exposed terminal problem. In the example above, C can send RTS, but CTS from the responder will collide with A's data at C. In fact it is a result of the RTS/CTS scheme used in 802.11
1-Persistent CSMA
Algorithm: To send data, a node first listens to the channel to see if anyone else is transmitting. If so, the node waits (keeps sensing it) until the channel becomes idle. Otherwise, it transmits a frame. If a collision occurs, the node waits a random amount of time and starts all over again. It is called 1-persistent because the station transmits with a probability of 1 whenever it starts sensing the channel and finds the channel idle. (Greedy)
Demand Assignment Protocols
Allocate channel capacity to hosts on a demand basis (i.e., only to active users) Requires methods for measuring the demand for the channel - Polling - Reservation schemes
Acknowledgment in Reliable Transmission
An acknowledgement (ACK for short) is a small control frame that a protocol sends back to its peer saying that it has received the earlier frame. A control frame is a frame with header only (no data). The receipt of an acknowledgement indicates to the sender of the original frame that its frame was successfully delivered. If the sender does not receive an acknowledgment after a reasonable amount of time, then it retransmits the original frame. The action of waiting a reasonable amount of time is called a timeout. The general strategy of using acknowledgements and timeouts to implement reliable delivery is sometimes called Automatic Repeat reQuest (ARQ).
P-Persistent CSMA
Assume channels are slotted One slot = contention period (i.e., one round trip propagation delay) Algorithm: 1) Sense the channel If channel is idle, transmit a packet with probability p if a packet was transmitted, go to step 2 if a packet was not transmitted, wait one slot and go to step 1 If channel is busy, wait one slot and go to step 1. In other words, wait until idle and then transmit with probability p 2) Detect collisions If a collision occurs, wait a random amount of time and go to step 1
Slotted Aloha
Assumptions all frames same size time is divided into equal size slots, time to transmit 1 frame nodes start to transmit frames only at beginning of slots nodes are synchronized (to know the start of timeslot) if 2 or more nodes transmit in slot, detect collision Feedback channel about whether packet is received or not (half-duplex) Operation when node obtains fresh frame, it transmits at the beginning of next slot no collision, node can send new frame in next slot if collision, wait a random number of slots and try to send again C: Collision E: Empty S: Success
PPP Link Control Protocol (LCP)
Before exchanging network-layer data, data link peers must - configure PPP link (max. frame length, establishing, configuring, and testing the data-link connection) PPP and LCP work in tandem - LCP sends control messages encapsulated in PPP frames (identified in the protocol field) - Like handshaking (remember the human conversation example)
Binary Encoding
Binary Encoding: turn the binary data (bits) into signals to transmit on cable or optical fiber link (physical layer stuff, but better to know) Nonreturn To Zero (NRZ): 1=high signal, 0=low signal - May stay on high or low signal too long for a long strings of consecutive 1s or 0s => baseline wander, clock recovery problems. Nonreturn to Zero Inverted (NRZI): 1 = signal transition (low to high, or high to low), 0=no change. - Solve the problem of consecutive 1s, but not consecutive 0s
Error Detection
Bit errors are introduced into frames Because of electrical interference and thermal noises Detecting Error Correcting Error Two approaches when the recipient detects an error - Notify the sender that the message was corrupted, so the sender can send again. If the error is rare, then the retransmitted message will be error-free. - Using some error detection and correction algorithm, the receiver reconstructs the message
High-Level Data Link Control (HDLC)
Bit oriented protocol: view the frame as a collection of bits, does not care about byte boundaries. Sentinel characters 01111110 transmitted as the link is idle for synchronization
Bridge
Bridge (layer 2). In telecommunication networks, a bridge is a product that connects a local area network (LAN) to another local area network that uses the same protocol. Having a single incoming and outgoing port and filters traffic on the LAN by looking at the MAC address, bridge is more complex than hub. Bridge looks at the destination of the packet before forwarding unlike a hub. It restricts transmission on other LAN segment if destination is not found. A bridge works at the data-link (physical network) level of a network, copying a data frame from one network to the next network along the communications path.
Reliable Transmission
CRC is used to detect errors. Some error codes are strong enough to correct errors. The overhead is typically too high. Corrupt frames must be discarded. A link-level protocol that wants to deliver frames reliably must recover from these discarded frames. This is accomplished using a combination of two fundamental mechanisms Acknowledgements and Timeouts
CSMA with Collision Detection (CSMA/CD)
CSMA/CD (Carrier Sense Multiple Access with Collision Detection) protocol further improves ALOHA by aborting transmissions as soon as a collision is detected. Operation: To send data, a node first listens to the channel to see if anyone else is transmitting. If not, it transmits a frame If channel busy, deferral as in CSMA the node wait a random period of time and repeats the algorithm (non-persistent), or waits until the end of the transmission (1-persistent) The node will detect the collision, if collision detected, abort its transmission (reducing channel wastage), send a jamming signal, waits a random amount of time, and starts all over again.
Carrier Sense Multiple Access (CSMA)
CSMA: listen before transmit: If channel sensed idle: transmit If channel sensed busy, defer transmission Human analogy: don't interrupt others! Can collisions occur in this scheme? Two nodes might attempt to transmit a frame at the same time Propagation delay means two nodes may not hear each other's transmission immediately Several variants of CSMA protocols: Non-Persistent CSMA 1-Persistent CSMA P-Persistent CSMA
Ethernet Protocol is an Unreliable, Connectionless Protocol
Connectionless: No handshaking between sending and receiving adapter. Unreliable: receiving adapter doesn't send acks or nacks to sending adapter stream of datagrams passed to network layer can have gaps gaps will be filled if app is using TCP otherwise, app will see the gaps
Internet Checksum Algorithm
Consider the data being checksummed as a sequence of 16-bit integers. Add them together using 16-bit ones complement arithmetic (explained next slide) and then take the ones complement of the result. That 16-bit number is the checksum In ones complement arithmetic, a negative integer −x is represented as the complement of x; Each bit of x is inverted. When adding numbers in ones complement arithmetic, a carryout from the most significant bit needs to be added to the result. Consider, for example, the addition of −5 and −3 in ones complement arithmetic on 4-bit integers +5 is 0101, so −5 is 1010; +3 is 0011, so −3 is 1100 If we add 1010 and 1100 ignoring the carry, we get 0110 In ones complement arithmetic, the fact that this operation caused a carry from the most significant bit causes us to increment the result, giving 0111, which is the ones complement representation of −8 (obtained by inverting the bits in 1000), as we would expect
CSMA Performance Analysis Assumptions
Constant length packets No errors, except those caused by collisions Collision: entire packet transmission time wasted Each host can sense the transmissions of all other hosts The propagation delay is small compared to the transmission time
Propagation Delay in CSMA
D only sense A's transmission after a propagation delay τ If τ is larger than packet transmission time, too much time wasted. CSMA in satellite communication? No. (Why?) Distance & propagation delay determine collision probability The size (length) of the network must be limited!
Link layer services
Data-link layer: transfer datagram from one node to adjacent node over a link. Encoding: turn the binary data (bits) into signals to transmit on cable or optical fiber link (more physical layer stuff). Framing: encapsulate datagram into frame, adding header, trailer. - Identify what set of bits constitute a frame, that is, determining the beginning and the end of a frame. Reliable delivery between adjacent nodes - Error detection - Error recovery: forward error correction code, retransmission (ARQ). channel access if shared medium - MAC addresses used in frame headers to identify source, destination. - Different from IP address!
Ethernet Frame
Different flavors exits such as IEEE 802.3 and Ethernet Version II Preamble: 8 bytes 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 used to synchronize receiver, sender clock rates Addresses:6 bytes if adapter receives frame with matching destination address, or with broadcast address, it passes data in frame to net-layer protocol, otherwise, adapter discards frame Type: 2 bytes indicates the higher layer protocol (mostly IP but others also supported) CRC: 4 bytes checked at receiver, if error is detected, the frame is simply dropped Body: 46-1500 bytes Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Data encapsulation by layer
Each layer considers as "data" that should be encapsulated and then handed to the layer below it.
Frame
Encapsulates payload/datagram/IP packet/service unit.
Ethernet
Ethernet is a family of computer networking technologies commonly used in local area networks (LAN), metropolitan area networks (MAN) and wide area networks (WAN). It was commercially introduced in 1980 and first standardized in 1983 as IEEE 802.3, and has since been refined to support higher bit rates and longer link distances. Over time, Ethernet has largely replaced competing wired LAN technologies such as Token Ring, FDDI and ARCNET. History developed by Xerox PARC in mid-1970s roots in Aloha packet-radio network standardized by Xerox, DEC, and Intel in 1978 similar to IEEE 802.3 standard CSMA/CD Evolution: Bus topology (90's) -> Star topology (now) Most successful access network technology
Error Detection and Correction Bits (EDC)
Extra bits are redundant - They add no new information to the message - Derived from the original message using some algorithm - Both the sender and receiver know the algorithm Receiver computes r using m If they match, no error
FDMA
FDMA: frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example: 6-station LAN, 1,3,4 have pkt, frequency bands 2,5,6 idle
PPP Data Frame
Flag: frame separator, special characters Address: default value Control: default value Protocol: upper layer protocol to which frame carried (e.g. IP) Payload (infor): upper layer data (1500 Bytes by default, but can be negotiated (LCP)) Check: CRC (2 Bytes by default)
Links
Frame (layer 2) Links are communication channels that connect adjacent nodes along communication path (point-to-point, shared, wired, wireless).
Byte (character) Stuffing
Frames could be of fixed size or variable size. In fixed-size framing, there is no need for defining the boundaries of the frames as the size itself can be used to define the end of the frame and the beginning of the next frame. But, in variable-size framing, we need a way to define the end of the frame and the beginning of the next frame. To separate one frame from the next, an 8-bit (or 1-byte) flag is added at the beginning and the end of a frame. But the problem with that is, any pattern used for the flag could also be part of the information. So, there are two ways to overcome this problem: 1) Using Byte stuffing (or character stuffing) 2) Using Bit stuffing A byte (usually escape character(ESC)), which has a predefined bit pattern is added to the data section of the frame when there is a character with the same pattern as the flag. Whenever the receiver encounters the ESC character, it removes from the data section and treats the next character as data, not a flag. But problem arises when text contains one or more escape characters followed by a flag. To solve this problem, the escape characters that are part of the text are marked by another escape character i.e., if the escape character is part of the text,an extra one is added to show that the second one is part of the text. Note: Point-to-Point Protocol (PPP) is a byte-oriented protocol.
PPP Functions
Framing: encapsulation of network-layer datagram in data link frame - Identify what set of bits constitute a frame, that is, determining the beginning and the end of a frame Carry data of any network layer protocol (not just IP) at same time - Ability to demultiplex upwards Bit transparency: must carry any bit pattern in the data field Error detection (no correction) Connection liveness: detect, signal link failure to network layer Network layer address negotiation: endpoint can learn/configure each other's network address PPP - No error correction/recovery - No flow control - Out of order delivery OK - No need to support multipoint links (e.g., polling)
Reservation schemes (Demand Assignment Protocols)
Hosts independently reserve the channel for period of time Reservations are usually piggybacked on data messages passing along the channel Good for systems with: - short propagation delay - no central controller node - non-bursty traffic
Hub/Repeater
Hub/repeater (layer 1). A hub is a common connection point for multiple twisted pair copper wire cables or optical fiber cables in a local are network (LAN). Most hubs are active hubs, which are also called multiport repeaters. An active hub functions in the same way as a repeater, except that it must also broadcast the regenerated signals to all connected network segments rather than forwarding them to just one segment. Passive hubs, which are also called concentrators, serve simply as a conduit for data and broadcast incoming data to every port. They provide no signal regeneration. In contrast to active hubs, they require no external power supply. They also have the advantage of costing less than active hubs. Sometimes hubs are advertised as managed hubs, switched hubs, and even intelligent hubs. Each of these provides additional features beyond those of a basic hub, such as enabling an administrator to monitor the traffic passing through the hub and to configure each port in the hub. On the outside, hubs and network switches have a very similar appearance; inside, however, they work very differently. As is the case with repeaters, hubs operate at the physical layer of the seven layer OSI (open systems interconnect) reference model, which provides no filtering of packets. Switches, however, operate at the data link layer, which allows a greater degree of control, including the filtering of packets by their MAC addresses to specific network segments rather than just broadcasting them to all segments and thus helps conserve network bandwidth. This, together with a narrow price gap, has resulted in the increasing replacement of hubs by switches.
IEEE 802.11
IEEE 802.11 is a set of media access control (MAC) and physical layer (PHY) specifications for implementing wireless local area network (WLAN) computer communication in the 900 MHz and 2.4, 3.6, 5, and 60 GHz frequency bands. They are the world's most widely used wireless computer networking standards, used in most home and office networks to allow laptops, printers, and smartphones to talk to each other and access the Internet without connecting wires.
MAC Address vs. IP Address
IP to MAC address translation: ARP 48-bit MAC address: Layer 2 Used to get packet from one interface to another within the same LAN/subnet (Ethernet, token ring...) Flat Unique No change when moving 32-bit IP address Network layer Used to get packet to destination IP subnet Hierarchical Change when moving - Depending on IP subnet to which node is attached
Dynamic TDMA (Demand Assignment Protocols)
In dynamic TDMA, a scheduling algorithm dynamically reserves a variable number of timeslots in each frame to variable user data streams, based on the traffic demand of each user data stream. Negotiations (beforehand) to determine how to allocate slots dynamically.
Spread Spectrum
In telecommunication and radio communication, spread-spectrum techniques are methods by which a signal (e.g., an electrical, electromagnetic, or acoustic signal) generated with a particular bandwidth is deliberately spread in the frequency domain, resulting in a signal with a wider bandwidth. These techniques are used for a variety of reasons, including the establishment of secure communications, increasing resistance to natural interference, noise and jamming, to prevent detection, and to limit power flux density (e.g., in satellite down links). spread signal over wider frequency band than required originally designed to thwart jamming Frequency Hopping transmit over random sequence of frequencies sender and receiver share... - pseudorandom number generator - seed Direct Sequence for each bit, send XOR of that bit and n random bits random sequence known to both sender and receiver called n-bit chipping code
Ethernet CSMA/CD Jam Signal and Exponential Backoff
Jam Signal: make sure all other transmitters are aware of collision; 32 bits Frame: 64 (preamble) + 32 (jamming sequence) = 96 bits - Runt Frame Exponential Backoff: Goal: adapt retransmission attempts to the estimated current # of active stations or load heavy load: random wait will be longer first collision: choose K from {0,1}; delay is K·512 bit (51.2 µs in 10 Mbps) transmission times after second collision: choose K from {0,1,2,3}... after ten collisions, choose K from {0,1,2,3,4,...,1023}
Layer 2 vs. Layer 3
Layer 2 switching - Based on MAC address - Self configuring and plug & play - Transparent to protocols above the MAC layer - Fast and inexpensive - Does not limit the scope of broadcasts - Does not scale to extremely large networks Layer 3 routing - Based on IP address - Must get IP address (DHCP or manual assign) - Easily connect LANs that use different link protocols - Scalable to large network by subnet routing - Broadcast limited only in a subnet
Link layer communication
Link layer implemented in adaptor (NIC) and driver (Ethernet card, WLAN card) Sending side: encapsulates higher layer payload in a frame, adds error checking bits, flow control, etc. Receiving side: error detection, flow control, extracts payload, passes to the receiving node
MAC Address
MAC Addresses unique, 48-bit unicast address assigned to each adapter example: 38:10:2b:e4:b1:02 broadcast: all 1s, ff:ff:ff:ff:ff:ff multicast: multicast flag (the lowest bit of the 1st octet)= 1 - 01-00-5E-00-00-00 to 01-00-5E-7F-FF-FF for IP multicast - IP multicast group address mapped to the lower order 23 bits of MAC address (not one-to-one mapping) Unique MAC address allocation administered by IEEE - manufacturer buys portion of MAC address space - the first three octets as vendor-specific
Manchester Encoding
Manchester Encoding: NRZ_encode data XOR clock - Clock cycle (a low/high pair) = 2 x signal interval - Baud rate (the signal change rate) = 2 x bitrate - 0 =high-to-low transition, 1 = low-to-high transition Clock recovery Variation: Differential Manchester - 1 = the first half of the signal equal to the last half of the previous bit's signal - 0 = the first half of the signal opposite to the last half of the previous bit's signal Manchester encoding: - Merging the clock with signal by transmitting Ex-OR of the NRZ encoded data and the clock - Clock is an internal signal that alternates from low to high, a low/high pair is considered as one clock cycle - In Manchester encoding * 0: low -> high transition * 1: high -> low transition Problem with Manchester encoding: - Doubles the rate at which the signal transitions are made on the link - Which means the receiver has half of the time to detect each pulse of the signal - The rate at which the signal changes is called the link's baud rate - In Manchester the bit rate is half the baud rate
Pure (Unslotted) ALOHA
Media Access Protocol Early packet radio network created at the U. of Hawaii in 1970 Uplink channel (clients->hub) and downlink channel (hub->clients) uses different frequencies Client nodes send data frames to the central hub using the shared uplink channel. The hub immediately re-send the received frames, allowing clients to determine whether or not their data had been received properly. Simplest form of random access, provides basis for more advance contention MAC Aloha Algorithm: Nodes transmit immediately whenever they have a frame to send No synchronization among nodes - If collision, retransmit after random delay - random delay prevents the same frames from colliding over and over again collision window or "vulnerable period": frame sent at t0 collides with other frames sent in [t0-1,t0+1]
Medium Access Control
Medium Access Sub-Layer In IEEE 802 LAN/MAN standards, the medium access control (MAC) sublayer (also known as the media access control sublayer) and the logical link control (LLC) sublayer together make up the data link layer. Within that data link layer, the LLC provides flow control and multiplexing for the logical link (i.e. EtherType, 802.1Q VLAN tag etc), while the MAC provides flow control and multiplexing for the transmission medium.
Medium Access Sublayer
Medium access control (MAC) sublayer is not relevant on point-to-point links The MAC sublayer is only used in broadcast or shared medium/channel networks All communication entities "share" a common channel - Wired networks: Ethernet LAN - Wireless & Mobile Networks: Satellite, Cellular, Wireless LAN
Encoding (NRZI)
NRZI - Non Return to Zero Inverted - Sender makes a transition from the current signal to encode 1 and stay at the current signal to encode 0 - Solves for consecutive 1's - With a long string of 0's will suffer from baseline wonder and clock recovery problems
Shared Media Networks and Associated Protocols
Networks where hosts use same medium to communicate. MAC (medium access control): ***ALOHA, Slotted ALOHA*** ***CSMA/CD, CSMA/CA*** Token Ring TDMA, Dynamic TDMA FDMA, CDMA LAN Technologies ***IEEE 802.3 Ethernet*** IEEE 802.5 Token Ring ***IEEE 802.11 Wireless LAN*** *** Are important ones to know.
Internet Checksum
Not used at the link level Add up all the words that are transmitted and then transmit the result of that sum The result is called the checksum The receiver performs the same calculation on the received data and compares the result with the received checksum If any transmitted data, including the checksum itself, is corrupted, then the results will not match, so the receiver knows that an error occurred
"Taking Turns" MAC protocols
Polling: master node "invites" slave nodes to transmit in turn concerns - polling overhead - single point of failure (master) Token passing: control token passed from one node to next sequentially. token message concerns - token overhead - complexity - single point of failure (token)
How CSMA/CD Detects Collisions in Wired LANS?
Prerequisite: A node can listen while talking Easy in wired LANs: measure signal strength, compare Tx and Rx signals Difficult in wireless LANs: receiver shut off while transmitting Tx = Transmit Rx = Receive
802.11 - MAC layer Priorities
Priorities defined through different inter frame spaces Interframe space (IFS) is a period of time that exists between transmissions of wireless frames. *The two most common interframe spaces used are the SIFS and the DIFS. Interframe spaces are all about what type of 802.11 traffic is allowed next. no guaranteed, hard priorities SIFS (Short Inter Frame Spacing) - highest priority, for ACK, CTS, polling response PIFS (PCF IFS) - medium priority, for time-bounded service using PCF DIFS (DCF, Distributed Coordination Function IFS) - lowest priority, for asynchronous data service - Sent after the station is found to be idle
Hidden Station Problem
Problem with carrier sensing
Encoding (NRZ)
Problems with NRZ: Baseline wander - The receiver keeps an average of the signals it has seen so far - Uses the average to distinguish between low and high signal - When a signal is significantly low than the average, it is 0, else it is 1 - Too many consecutive 0's and 1's cause this average to change, making it difficult to detect Clock recovery - Frequent transition from high to low or vice versa are necessary to enable clock recovery - Both the sending and decoding process is driven by a clock - Every clock cycle, the sender transmits a bit and the receiver recovers a bit - The sender and receiver have to be precisely synchronized
RTS/CTS Exchange
RTS + CTS + Frame + ACK exchange invoked when frame size is large NAV (Network Allocation Vector) NAV maintains prediction of future traffic on the medium based on duration information that is announced in RTS/CTS frames prior to actual exchange of data
Contention Access Protocols
Random Access channel not divided When node has frame to send, transmit with the total channel bandwidth No coordination between nodes, control is completely distributed two or more nodes transmit simultaneously ➜ "collision" random access MAC protocol should specify: - how to detect collisions - how to recover from collisions (e.g., via delayed retransmissions) - Examples: ALOHA, Slotted ALOHA, CSMA/CD, CSMA/CA Advantages: ◦ Short delay for bursty traffic ◦ Simple (due to distributed control) ◦ Flexible to fluctuations in the number of hosts ◦ Fairness Disadvantages: ◦ Can not be certain who will acquire the media/channel ◦ Low channel efficiency with a large number of hosts ◦ Not good for continuous traffic (e.g., voice) ◦ Cannot support priority traffic ◦ High variance in transmission delays
Reading and Practice Problems
Reading: Peterson & Davie, Chap 2 Practicing: Peterson & Davie, Chap 2, 4th ed 2.6 2.18 2.23 2.33 2.44 2.42 Download and review IEEE 802.11 Wireless LAN Overview slides
Media Access Protocol
Shared broadcast channel two or more simultaneous transmissions by nodes: interference Collision if node receives two or more signals at the same time MAC protocol Determines how nodes share channel, i.e., determine when node can transmit Ideally, if broadcast channel of rate R bps When one node wants to transmit, it can send at rate R. When M nodes want to transmit, each can send at average rate R/M (fairness)
Sliding Window Protocols
Sliding window*: sender allows multiple, "in-flight", yet-to-be-acknowledged frames range of sequence numbers must be increased buffering at sender and/or receiver two generic forms of sliding window protocols: 1) go-Back-N 2) selective repeat *Kurose & Ross book call this "pipelining" COMPLICATED, GET MORE INFORMATION ON THIS.
What are Fixed Assignment Protocols "Channel Partitioning" and 3 Examples?
Static and predetermined allocation of channel access: independent of user activity Idle users may be assigned to the channel, in which case channel capacity is wasted Examples: - TDMA - FDMA - CDMA
Switch
Switch (layer 2). A switch when compared to bridge has multiple ports. Switches can perform error checking before forwarding data, which are very efficient by not forwarding packets that error-end out or forwarding good packets selectively to correct devices only. Switches can support both layer 2 (based on MAC Address) and layer 3 (Based on IP address) depending on the type of switch. Usually large networks use switches instead of hubs to connect computers within the same subnet.
TDMA
TDMA: time division multiple access access to channel in "rounds" each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example: 6-station LAN, 1,3,4 have pkt, slots 2,5,6 idle
CSMA/CA and ACK Protocol Together on 802.11 LAN
The contention window is an amount of time divided into slots. A station that is ready to send chooses a random number of slots as its wait time. The number of slots in the window changes according to binary exponential backoff strategy. This means it is set to one slot the first time and then doubles each time the station cannot idle channel after DIFS time. In CSMA/CA, if the station finds the channel busy, it does not restart the timer of the contention window; it stops the timer and restarts it when the channel becomes idle.
Automatic Repeat reQuest (ARQ)
The general strategy of using acknowledgements and timeouts to implement reliable delivery is sometimes called Automatic Repeat reQuest (ARQ).
Ethernet CSMA/CD Algorithm
The lowercase Greek letter mu (µ) is used to represent the prefix multiplier 0.000001 (10 -6 or one millionth) 1)If sender senses channel idle, it starts to transmit frame. If it senses channel busy, waits until channel idle and then transmits (1-persistent CSMA) - Inter-frame gap: time to send 96 bits (9.6 µs for 10Mbps) 2) If adapter transmits entire frame without detecting another transmission, the adapter is done with frame ! 3) If adapter detects another transmission while transmitting, aborts and sends 32-bit jam signal (collision detection) 4) After aborting, sender enters exponential backoff - after the mth collision, adapter chooses a K at random from {0,1,2,...,2m-1}. Then waits K·512 bit times (k x 51.2 us in 10 Mbps Ethernet) and returns to Step 1 - give up after several tries (usually 16)
Performance of Pure vs. Slotted Aloha
Throughput versus offered traffic for ALOHA systems The main reason for poor channel utilization of ALOHA (pure or slotted) is that all stations can transmit at will, without paying attention to what the other stations are doing.
Non-Persistent CSMA
To send data, a node first listens to the channel to see if anyone else is transmitting. If so, the node waits a random period of time (instead of keeping sensing until the end of the transmission) and repeats the algorithm. Otherwise, it transmits a frame. If a collision occurs, the node waits a random amount of time and starts all over again.
Stop-and-wait ARQ
Transmit a frame and wait for acknowledge If positive acknowledge (ACK) from receiver, send next frame If ACK does not arrive after a certain period of time (Timeout), retransmits the frame Simple, low efficiency INCLUDE MORE INFORMATION ON THIS
Selective-repeat
Transmit continuously, no waiting The receiver acks all successfully received frames The sender only retransmits (repeats) the unacked frames when their timers expire Most efficient, but most complex, buffer needed at both transmitter and receiver, need per frame timer
Go-back-N ARQ
Transmit frames continuously, no waiting The receiver only acks the highest-numbered frames received in sequence ACK comes back after a round-trip delay If timeout, the sender retransmits the frames that are not acked and N-1 succeeding frames that were transmitted during the round-trip delay (N frames transmitted during a round-trip delay) Need buffer at transmitter, does not have to buffer the frames at the receiver, Moderate efficiency and complexity. Less efficient when the round-trip delay is large and data transmission rate is high
Point-to-Point Data Link Protocol
Two types of links - point-to-point link (easier than broadcast link) one sender, one receiver on the link, NO Media Access Control no need for explicit MAC addressing e.g., dialup link, ISDN line - Broadcast (shared wire or medium) popular point-to-point data link control protocols: - PPP (point-to-point protocol): byte-oriented PPP for dial-up access PPP over Ethernet (DSL) - HDLC (High level data link control): bit-oriented
Two-Dimensional Parity
Two-dimensional parity is exactly what the name suggests - It is based on "simple" (one-dimensional) parity, which usually involves adding one extra bit to a 7-bit code to balance the number of 1s in the byte. For example, - Odd parity sets the eighth bit to 1 if needed to give an odd number of 1s in the byte, and - Even parity sets the eighth bit to 1 if needed to give an even number of 1s in the byte Two-dimensional parity does a similar calculation for each bit position across each of the bytes contained in the frame This results in an extra parity byte for the entire frame, in addition to a parity bit for each byte Two-dimensional parity catches all 1-, 2-, and 3-bit errors and most 4-bit errors Correct 1-bit errors
Hidden Station Problem Solution
Use handshaking RTS = Request to send CTS = Clear to send When a node hears an RTS from a neighboring node, but not the corresponding CTS, that node can deduce that it is an exposed node and is permitted to transmit to other neighboring nodes.
Framing
We are focusing on packet-switched networks, which means that blocks of data (called frames at this level), not bit streams, are exchanged between nodes. Data link layer is responsible for something called Framing, which is the division of stream of bits from network layer into manageable units (called frames). Each frame consists of sender's address and a destination address.The destination address defines where the packet is to go and the sender's address helps the recipient acknowledge the receipt. It is the network adaptor that enables the nodes to exchange frames. When node A wishes to transmit a frame to node B, it tells its adaptor to transmit a frame from the node's memory. This results in a sequence of bits being sent over the link. The adaptor on node B then collects together the sequence of bits arriving on the link and deposits the corresponding frame in B's memory. Recognizing exactly what set of bits constitute a frame—that is, determining where the frame begins and ends—is the central challenge faced by the adaptor.
CDMA
What if we don'y not divide up the channel by time (as in TDMA), or frequency (as in FDMA)? Is collision inevitable? Not if collision is no longer damaging! Is there any way to decode bits garbled by other overlapping frames? Code Division Multiple Access (CDMA) based on Spread Spectrum Another perspective to solve multiple access problems Spread Spectrum is a PHY innovation, not a MAC technique. CDMA encodes data with a special code associated with each user and uses the constructive interference properties of the special codes to perform the multiplexing. Multiplexing Technique used with spread spectrum Start with data signal rate D Called bit data rate Break each bit into k chips according to fixed pattern specific to each user - User's code New channel has chip data rate kD chips per second E.g. k=6, three users (A,B,C) communicating with base station R Code for A = <1,-1,-1,1,-1,1> Code for B = <1,1,-1,-1,1,1> Code for C = <1,1,-1,1,1,-1>
What Are Access Protocols?
Who gets to use the channel next? - Fixed/Static assignment - Demand assignment - Contention - Turn-Based
LAN MAC Technologies
Wired LANS: Ethernet -> CSMA/CD Token Ring Wireless LANs: IEEE802.11 -> CSMA/CA
CSMA with Collision Avoidance (CSMA/CA)
Wireless LANs How can a node detect collision if it cannot listen while talking? Collision Avoidance (by using handshaking or control frames) Random Backoff (instead of 1-persistent) Request-to-send (RTS)/clear-to-send (CTS) CS no longer works well Rules: carrier -> do not transmit no carrier -> OK to transmit But the above rules do not always apply to wireless.
Ethernet Collisions
Worst case: A sends at t, A's frame arrives B at t+d B begins transmitting at t+d and collides with A's frame B sends runt frame, the runt frame arrives A at t+2d To detect collision, A must continue transmit until t+2d. A must transmit for 2d. Round-trip delay about 51.2 us for 2500m long Ethernet with 4 repeater - Corresponds to 512 bits for 10 Mbps Ethernet - So min frame size 512 bits The longer the propagation delay, the higher probability of collision.
Gbit Ethernet
uses standard Ethernet frame format allows for point-to-point links and shared broadcast channels in shared mode, CSMA/CD is used; short distances between nodes required for efficiency uses hubs Full-Duplex at 1 Gbps for point-to-point links 10 Gbps now