Computer Communication Networks Link ICEN/ICSI 416 – Fall 2017 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 Albany to San Francisco Ø different links: § uber: Albany Home to ALB § e.g., Ethernet on first link, frame § plane1: ALB to PHL relay on intermediate links, § plane2: PHL to SFO 802.11 on last link § train (BART): SFO to train station each link protocol provides § walk: train station to Hotel Ø different services tourist = datagram Ø § e.g., may or may not provide rdt transport segment = Ø over link communication link transportation mode = link layer Ø 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 attaches into host’s system buses bus Ø controller (e.g., PCI) link combination of hardware, software, physical Ø physical transmission firmware network adapter card 7
Adaptors communicating datagram datagram controller controller sending host receiving 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 more powerful error-detection coding Ø view data bits, D, as a binary number Ø choose r+1 bit pattern (generator), G Ø 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
Modulo 2 Arithmetic Ø CRC Calculations are done in modulo-2 arithmetic. § Without carries and borrows in addition and subtraction Ø Addition & Subtraction are identical and equivalent to bitwise XOR. Ø Multiplication and division are same as in base-2 arithmetic. 13
CRC Example Ø want: § D.2 r XOR R = nG Ø equivalently: § D.2 r = nG XOR R Ø equivalently: § if we divide D.2r by G, we want remainder R to satisfy: 𝑆 = 𝑠𝑓𝑛𝑏𝑗𝑜𝑒𝑓𝑠 𝐸.2 - 𝐻 14
Classwork Ø Consider the 5-bit generator, G=10011. Suppose D has a value of 1010101010. What is the value of R? 15
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 16
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 RF shared wire (e.g., humans at a (e.g., 802.11 WiFi) cabled Ethernet) (satellite) cocktail party (shared air, acoustical) 17
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 18
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 19
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 20
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 21
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 22
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 23
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 24
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 S C S E C E 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 Ø 25
Recommend
More recommend