ECE544: Communication Networks-II Spring 2014 D. Raychaudhuri Lecture II Includes teaching materials...

download ECE544: Communication Networks-II Spring 2014 D. Raychaudhuri Lecture II Includes teaching materials from L. Peterson, J. Kurose.

If you can't read please download the document

description

Link Layer: Introduction Some terminology: –hub/repeater (layer 1), bridge/LAN switch (layer 2), router (layer 3), host (layers app) –Links are communication channels that connect adjacent nodes along communication path (point-to-point, shared, wired, wireless) –Layer-2 frame: encapsulates payload/datagram/IP packet/service unit Router Switch Link Host Lin k LAN 1 LAN 2 Switch Link Host

Transcript of ECE544: Communication Networks-II Spring 2014 D. Raychaudhuri Lecture II Includes teaching materials...

ECE544: Communication Networks-II Spring 2014 D. Raychaudhuri Lecture II Includes teaching materials from L. Peterson, J. Kurose Todays Lecture Recap of network architecture & top- down design architecture paper discussion Shared media (MAC) protocols Ethernet Token ring IEEE Link Layer: Introduction Some terminology: hub/repeater (layer 1), bridge/LAN switch (layer 2), router (layer 3), host (layers app) Links are communication channels that connect adjacent nodes along communication path (point-to-point, shared, wired, wireless) Layer-2 frame: encapsulates payload/datagram/IP packet/service unit Router Switch Link Host Lin k LAN 1 LAN 2 Switch Link Host Link Layer Services Data-link layer: transfer datagram from one node to adjacent node over a link 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 channel access if shared medium MAC addresses used in frame headers to identify source, destination different from IP address! Reliable delivery between adjacent nodes Error detection Error recovery: forward error correction code, retransmission (ARQ) 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 CPU Cache Memory Control status register Bus interface Link interface Host NIC I/O bus Network Datagram Frame Adaptor Sending node Datagram Frame Adaptor Recv node Link layer protocol 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 uses different link protocols Scalable to large network by subnet routing Broadcast limited only in a subnet Link Layer Techniques Encoding (more Physical Layer stuff) Framing & PPP Protocol Error Detection & Correction ARQ Self study topics (see Ch2 & slides) 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) Baseband, not modulate to high frequency 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 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 bits signal 0 = the first half of the signal opposite to the last half of the previous bits signal Bits NRZ Clock Manchester NRZI 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 DLC 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 PPP Modem 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 others network address PPP no error correction/recovery no flow control out of order delivery OK no need to support multipoint links (e.g., polling) PPP Data Frame Flag: delimiter (framing) Address: Control: Protocol: upper layer protocol to which frame carried (e.g. IP) Info: upper layer data Check: CRC protocol info CRC flag Octet: 1 control address 1 or 2 1 variable 2 or 4 1 1 Byte Stuff data transparencyrequirement: data field must be allowed to include flag pattern Q: is received data or flag? Sender: adds (stuffs) extra byte after each data byte Receiver: two bytes in a row: discard first byte, continue data reception single : flag byte PPP Link Control Protocol (LCP) Before exchanging network-layer data, data link peers must configure PPP link (max. frame length, authentication) learn/configure network layer information for IP: carry IP Control Protocol (IPCP) msgs (protocol field: 8021) to configure/learn IP address High-Level Data Link Control (HDLC) Bit oriented protocol: view the frame as a collection of bits, does not care byte boundaries. Sentinel characters transmitted as the link is idle for synchronization Bit stuffing: to distinguish the data pattern in the body from the special beginning/end sequence after transmitting any 5 consecutive 1s in body, insert a 0 011111xxxx => xxx Header body CRC Beginning sequence Bits: 8variable 16 8 ending sequence Error Detection EDC= Error Detection and Correction bits (redundancy) D = Data protected by 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 Parity Checking Single Bit Parity: Detect single bit errors Two Dimensional Bit Parity: Detect and correct single bit error Internet Checksum Sender: treat segment contents as sequence of 16-bit integers checksum: addition (1s complement sum) of segment contents, and take the ones complement of the result sender puts checksum value into UDP checksum field Receiver: compute checksum of received segment check if computed checksum equals checksum field value: NO -error detected YES -no error detected. But maybe errors (internet checksum not very strong for error detection, but simple) Goal: detect errors (e.g., flipped bits) in transmitted segment (note: used at transport layer) Cyclic Redundancy Check (CRC) A (n+1)-bit message M can be represented as a polynomial of degree n. For example, X = ; M(X) = X 7 + X 4 + X 3 + X Choose k+1 bit pattern (divisor), C(X), a polyn of degree k goal: get k CRC bits, Y, such that P= exactly divisible by C (modulo 2) receiver knows C, divides by C. If non-zero remainder: error detected! can detect all burst errors less than k+1 bits M: data bits to be sent Y: CRC n bits k bits M x 2 k XOR R CRC Example Goal: design P(X) such that it is exactly divisible by C(X) T(X) = M(X) X k (add k zeros to the end of the message) Subtract the remainder from T(X) to get P(X). P(X) is now exactly divisible by C(X). Corresponding to the complete transmitted message (Remember all addition/subtract use modulo-2 arithmetic) Automatic Repeat reQuest(ARQ) 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 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 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 Sliding Window Reliable delivery: retransmission Ordered delivery: preserve the order in which the frames are transmitted Receiver does not pass along (buffer) out-of-order frames Flow control: feedback mechanism by which the receiver is able to throttle the sender Inform the sender of how much frames the receiver has room to receive Sliding Window (Cont) Send window size (SWS): the upper bound on the number of unacked frames that the sender can transmit, set according to the round-trip delay to keep the pipe full (recall: bandwidth x delay product represents the amount of data that could be in transit) LAR: the sequence # of the last ack received LFS: the sequence # of the last frame sent Receiver window size (RWS): the upper bound on the number of out-of-order frames that the receiver is willing to accept LAF: the sequence # of the largest acceptable frame LFR: the sequence # of the last frame received SeqNumToAck: the largest sequence # not yet acked, such that all frames with seq # do not transmit no carrier ==> OK to transmit But the above rules do not always apply to wireless. Problems with carrier sensing Y Z W Hidden terminal problem W finds that medium is free and it transmits a packet to Z no carrier ===> OK to transmit / Problems with carrier sensing Z W YX Exposed terminal problem Z is transmitting to W Y will not transmit to X even though it cannot interfere Presence of carrier ===> hold off transmission / Solving Hidden Node problem with RTS/CTS Y Z X W RTS CTS listen RTS ==> transmitter is close listen CTS ==> receiver is close - listen RTS - wait long enough for the requested station to respond with CTS - if (timeout) then ready to transmit - listen CTS - wait long enough for the transmitter to send its data Note: RTS/CTS does not solve exposed terminal problem. In the example above, X can send RTS, but CTS from the responder will collide with Ys data. RTS/CTS exchange example 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 Transmitter DIFS ACK RTS Receiver Frame CTS 352 s 10 s SIFS 8192 s Other NAV (RTS) NAV (CTS) 304 s 10 s 10 s 304 s 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) TDMA Time Division Multiple Access (TDMA) Fixed TDMA access to channel in "rounds" each station gets fixed length slot (length = packet transmission time) in each round unused slots go idle Not efficient example: 6-station LAN, 1,3,4 have pkt, slots 2,5,6 idle Dynamic TDMA 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. Modem preamble TDM Downlink D-TDMA Uplink S-ALOHA control User B User C TDD-TDMA Frame Burst from User A To Access Point Burst from Access Point -> Mobiles Frame header and schedule FDMA FDMA: frequency division multiple access channel spectrum divided into frequency bands each station assigned a frequency band unused transmission time in frequency bands go idle if assignment fixed Inefficient => make it dynamically assigned to different stations based on traffic demand OFDMA Frequency bands Spread Spectrum and 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. Spread Spectrum Idea spread signal over wider frequency band than required originally deigned to thwart jamming Frequency Hopping transmit over random sequence of frequencies sender and receiver share pseudorandom number generator seed Spread Spectrum (cont) 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 Random sequence: Data stream: 1010 XOR of the two: Code Division Multiple Access (CDMA) 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 Users 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 = Code for B = Code for C = LAN technologies Ethernet Token Ring Wireless LAN Ethernet Overview 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 standard CSMA/CD Evolution: Bus topology (90s) Star topology (now) Most successful access network technology Hub or switch Advance Ethernet Frame Preamble: 8 bytes 7 bytes with pattern followed by one byte with pattern 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: bytes Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame Dest addr 864 CRCPreamble Src addr TypeBody 26 Octets MAC Address MAC Addresses unique, 48-bit unicast address assigned to each adapter example: 3 8:10:2b:e4:b1:02 broadcast: all 1 s, ff:ff:ff:ff:ff:ff multicast: multicast flag (the lowest bit of the 1 st octet)= E to E-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 MAC Address vs. IP Address 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 IP to MAC address translation: ARP (more later) Different Flavors of Ethernet Format Ethernet version II Dest MAC 864 FCSPreamble Src MAC TypeBody 26 Octets Data link header Data & CRC (FCS) IEEE Dest MAC 86 Preamble Src MAC Length 26 Octets Datalink Header DSAPSSAPControl 4 FCSBody Data & CRC (FCS) Logical Link Control Length: the length of the data in the frame (excluding preamble, CRC, DLC addresses, and the Length field itself) Destination Service Access Point (DSAP): a pointer to a memory buffer in the receiving station. It tells the receiving NIC in which buffer to put this information. useful in situations where users are running multiple protocol stacks, etc... Source Service Access Point (SSAP) Control: the type of LLC frame Distinguish Ethertypes and Control field Ethertypes value > 0x05DC (1500), Length