Computer Communication Networks Link ICEN/ICSI 416 – Fall 2016 Prof. Dola Saha 1
Link layer and LANs our goals: Ø understand principles behind link layer services: § error detection, correction § sharing a broadcast channel: multiple access § link layer addressing § local area networks: Ethernet, VLANs Ø instantiation, implementation of various link layer technologies 2
Link layer: introduction terminology: hosts and routers: nodes Ø communication channels that connect Ø adjacent nodes along communication path: links § wired links § wireless links § LANs layer-2 packet: frame, encapsulates Ø datagram data-link layer has responsibility of transferring datagram from one node to physically adjacent node over a link 3
Link layer: context datagram transferred by transportation analogy: Ø different link protocols over trip from Princeton to Lausanne Ø different links: § limo: Princeton to JFK § e.g., Ethernet on first link, frame § plane: JFK to Geneva relay on intermediate links, § train: Geneva to Lausanne 802.11 on last link tourist = datagram Ø each link protocol provides Ø transport segment = Ø different services communication link § e.g., may or may not provide rdt transportation mode = link layer Ø over link protocol travel agent = routing algorithm Ø 4
Link layer services Ø framing, link access: § encapsulate datagram into frame, adding header, trailer § channel access if shared medium § “ MAC ” addresses used in frame headers to identify source, destination o different from IP address! Ø reliable delivery between adjacent nodes § we learned how to do this already (RTP)! § seldom used on low bit-error link (fiber, some twisted pair) § wireless links: high error rates o Q: why both link-level and end-end reliability? 5
Link layer services (more) Ø flow control: § pacing between adjacent sending and receiving nodes Ø error detection : § errors caused by signal attenuation, noise. § receiver detects presence of errors: o signals sender for retransmission or drops frame Ø error correction: § receiver identifies and corrects bit error(s) without resorting to retransmission Ø half-duplex and full-duplex § with half duplex, nodes at both ends of link can transmit, but not at same time 6
Where is the link layer implemented? in each and every host Ø link layer implemented in “ adaptor ” Ø (aka network interface card NIC) or on a chip § Ethernet card, 802.11 card; Ethernet application transport chipset cpu memory network link § implements link, physical layer host bus attaches into host’s system buses Ø controller (e.g., PCI) link combination of hardware, software, physical Ø physical transmission firmware network adapter card 7
Adaptors communicating datagram datagram controller controller receiving host sending host datagram frame sending side: receiving side: Ø Ø § encapsulates datagram in frame § looks for errors, rdt, flow control, etc. § adds error checking bits, rdt, flow control, etc. § extracts datagram, passes to upper layer at receiving side 8
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 otherwise 9
Parity checking single bit parity: two-dimensional bit parity: § detect and correct single bit errors § d etect single bit errors Ø Even parity § Total number of (d+1) 1’s is even Ø Odd parity 0 0 § Total number of (d+1) 1’s is odd 10
Internet checksum (review) goal: detect “ errors ” (e.g., flipped bits) in transmitted packet (note: used at transport layer only) sender: receiver: treat segment contents as compute checksum of received Ø Ø sequence of 16-bit integers segment checksum: addition (1 ’ s check if computed checksum Ø Ø complement sum) of segment equals checksum field value: contents § NO - error detected sender puts checksum value into § YES - no error detected. But Ø UDP checksum field maybe errors nonetheless? 11
Cyclic redundancy check Reduce the number of extra bits and maximize protection Ø more powerful error-detection coding Ø view data bits, M, as a binary number Ø choose r+1 bit pattern (generator), C (sender and receiver must agree) Ø Given a bit string 110001 we can associate a polynomial on a single Ø variable x for it. 1.x5+1.x4+0.x3+0.x2+0.x1+1.x0 = x5+x4+1 and the degree is 5. Ø goal: choose r CRC bits, R, such that Ø § <D,R> exactly divisible by G (modulo 2) § receiver knows G, divides <D,R> by G. If non-zero remainder: error detected! § can detect all burst errors less than r+1 bits widely used in practice (Ethernet, 802.11 WiFi, ATM) Ø 12
Cyclic Redundancy Check (CRC) Polynomial Arithmetic Modulo 2 § Any polynomial B(x) can be divided by a divisor polynomial C(x) if B(x) is of higher degree than C(x). § Any polynomial B(x) can be divided once by a divisor polynomial C(x) if B(x) is of the same degree as C(x). § The remainder obtained when B(x) is divided by C(x) is obtained by subtracting C(x) from B(x). § To subtract C(x) from B(x), we simply perform the exclusive-OR (XOR) operation on each pair of matching coefficients. 13
Cyclic Redundancy Check (CRC) CRC Calculation using Polynomial Long Division 14
Cyclic Redundancy Check (CRC) Ø Six generator polynomials that have become international standards are: § CRC-8 = x 8 +x 2 +x+1 § CRC-10 = x 10 +x 9 +x 5 +x 4 +x+1 § CRC-12 = x 12 +x 11 +x 3 +x 2 +x+1 § CRC-16 = x 16 +x 15 +x 2 +1 § CRC-CCITT = x 16 +x 12 +x 5 +1 § CRC-32 = x 32 +x 26 +x 23 +x 22 +x 16 +x 12 +x 11 +x 10 +x 8 +x 7 +x 5 +x 4 +x 2 +x+1 15
Multiple access links, protocols two types of “ links ” : Ø point-to-point § PPP for dial-up access § point-to-point link between Ethernet switch, host Ø broadcast (shared wire or medium) § old-fashioned Ethernet § upstream HFC § 802.11 wireless LAN shared RF shared wire (e.g., shared RF humans at a (e.g., 802.11 WiFi) cabled Ethernet) (satellite) cocktail party (shared air, acoustical) 16
Multiple access protocols single shared broadcast channel Ø two or more simultaneous transmissions by nodes: interference Ø § collision if node receives two or more signals at the same time multiple access protocol distributed algorithm that determines how nodes share channel, i.e., Ø determine when node can transmit communication about channel sharing must use channel itself! Ø § no out-of-band channel for coordination 17
An ideal multiple access protocol given: broadcast channel of rate R bps desired: 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can send at average rate R/M 3. fully decentralized: o no special node to coordinate transmissions o no synchronization of clocks, slots 4. simple 18
MAC protocols: taxonomy three broad classes: Ø channel partitioning § divide channel into smaller “ pieces ” (time slots, frequency, code) § allocate piece to node for exclusive use Ø random access § channel not divided, allow collisions § “ recover ” from collisions Ø “ taking turns ” § nodes take turns, but nodes with more to send can take longer turns 19
Channel partitioning MAC protocols: TDMA TDMA: time division multiple access Ø access to channel in "rounds" Ø each station gets fixed length slot (length = packet transmission time) in each round Ø unused slots go idle Ø example: 6-station LAN, 1,3,4 have packets to send, slots 2,5,6 idle 6-slot 6-slot frame frame 3 3 4 1 4 1 20
Channel partitioning MAC protocols: 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 packet to send, frequency bands Ø 2,5,6 idle frequency bands FDM cable 21
Random access protocols Ø when node has packet to send § transmit at full channel data rate R. § no a priori coordination among nodes Ø two or more transmitting nodes ➜ “ collision ” , Ø random access MAC protocol specifies: § how to detect collisions § how to recover from collisions (e.g., via delayed retransmissions) Ø examples of random access MAC protocols: § slotted ALOHA § ALOHA § CSMA, CSMA/CD, CSMA/CA 22
Slotted ALOHA operation: assumptions: when node obtains fresh frame, Ø all frames same size Ø transmits in next slot time divided into equal size slots Ø § if no collision: node can send (time to transmit 1 frame) new frame in next slot nodes start to transmit only slot Ø § if collision: node retransmits beginning frame in each subsequent slot with prob. p until success nodes are synchronized Ø if 2 or more nodes transmit in Ø slot, all nodes detect collision 23
Slotted ALOHA C, E, S: 1 1 1 1 node 1 Collision, Empty, Success 2 2 2 node 2 3 3 3 node 3 C E C S E C E S S Cons: Pros: collisions, wasting slots Ø single active node can Ø idle slots continuously transmit at full rate Ø of channel nodes may be able to detect Ø collision in less than time to highly decentralized: only slots Ø transmit packet in nodes need to be in sync clock synchronization Ø simple Ø 24
Recommend
More recommend