Presentation is loading. Please wait.

Presentation is loading. Please wait.

CPSC 441: Link Layer1. 2 Our Goals … r understand principles behind data link layer services: m error detection, correction m sharing a broadcast channel:

Similar presentations


Presentation on theme: "CPSC 441: Link Layer1. 2 Our Goals … r understand principles behind data link layer services: m error detection, correction m sharing a broadcast channel:"— Presentation transcript:

1 CPSC 441: Link Layer1

2 2 Our Goals … r understand principles behind data link layer services: m error detection, correction m sharing a broadcast channel: multiple access m link layer addressing: done! m reliable data transfer, flow control: done! r instantiation and implementation of various link layer technologies

3 CPSC 441: Link Layer3 Link Layer r Introduction and services (review) r Error detection and correction r Multiple access protocols r Ethernet r Hubs and switches r PPP r MPLS

4 CPSC 441: Link Layer4 Link Layer: Review Some terminology: r hosts and routers are nodes r communication channels that connect adjacent nodes along communication path are links m wired links m wireless links m LANs r layer-2 packet is a frame, encapsulates datagram “link” data-link layer has responsibility of transferring datagram from one node to adjacent node over a link

5 CPSC 441: Link Layer5 Link layer: Review r Datagram transferred by different link protocols over different links: m e.g., Ethernet on first link, frame relay on intermediate links, 802.11 on last link r Each link protocol provides different services m e.g., may or may not provide reliable data transfer over link

6 CPSC 441: Link Layer6 Link Layer Services: Review r Framing, link access r Reliable delivery between adjacent nodes r Flow Control r Error Detection r Error Correction r Half-duplex and full-duplex

7 CPSC 441: Link Layer7 Link Layer r Introduction and services r Error detection and correction r Multiple access protocols r Link-Layer Addressing r Ethernet r Hubs and switches r PPP r MPLS

8 CPSC 441: Link Layer8 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

9 CPSC 441: Link Layer9 Parity Checking Single Bit Parity: Detect single bit errors Two Dimensional Bit Parity: Detect and correct single bit errors 0 0

10 CPSC 441: Link Layer10 Cyclic Redundancy Check/Polynomial Codes r A (n+1)-bit message can be represented as a polynomial of degree n. For example, m X = 10011010; m M(X) = r So, a sender and receiver can be considered to exchange polyns. r Choose k+1 bit pattern (divisor), C(X), a polyn of degree k r goal: choose k CRC bits, R, such that m exactly divisible by C (modulo 2) m receiver knows C, divides by C. If non-zero remainder: error detected! m can detect all burst errors less than k+1 bits

11 CPSC 441: Link Layer11 CRC continued … r Goal: design P(X) such that it is exactly divisible by C(X) r Multiply M(X) by x k (add k zero’s to the end of the message) to get T(X) r Divide T(X) by C(X) and find the remainder R(X) r Subtract the remainder from T(X) to get P(X). P(X) is now exactly divisible by C(X). r Remember – all addition/subtract use modulo-2 arithmetic.

12 CPSC 441: Link Layer12 Link Layer r Introduction and services r Error detection and correction r Multiple access protocols r Link-Layer Addressing r Ethernet r Hubs and switches r PPP r MPLS

13 CPSC 441: Link Layer13 Multiple Access Links and Protocols Two types of “links”: r point-to-point m PPP for dial-up access m point-to-point link between Ethernet switch and host r broadcast (shared wire or medium) m traditional Ethernet m upstream HFC m 802.11 wireless LAN

14 CPSC 441: Link Layer14 When are Multiple Access Protocols Required? r single shared broadcast channel r two or more simultaneous transmissions by nodes: interference m collision if node receives two or more signals at the same time (examples, LANs, Wireless-LANs) multiple access protocol r distributed algorithm that determines how nodes share channel, i.e., determine when node can transmit r communication about channel sharing must use channel itself! m no out-of-band channel for coordination

15 CPSC 441: Link Layer15 Ideal Multiple Access Protocol Broadcast channel of rate R bps 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: m no special node to coordinate transmissions m no synchronization of clocks, slots 4. Simple and easy to implement

16 CPSC 441: Link Layer16 Taxonomy of Multiple Access Control Protocols Three broad classes: r Channel Partitioning m divide channel into smaller “pieces” (TDM, FDM, Code Division Multiple Access) – TDM, FDM covered in chap. 1 m allocate piece to node for exclusive use r Random Access m channel not divided, allow collisions m “recover” from collisions r “Taking turns” m Nodes take turns, but nodes with more to send can take longer turns

17 CPSC 441: Link Layer17 Random Access Protocols r When node has packet to send m transmit at full channel data rate R. m no a priori coordination among nodes  two or more transmitting nodes ➜ “collision”, r random access MAC protocol specifies: m how to detect collisions m how to recover from collisions (e.g., via delayed retransmissions) r Examples of random access MAC protocols: m slotted ALOHA m ALOHA m CSMA, CSMA/CD, CSMA/CA

18 CPSC 441: Link Layer18 Pure ALOHA r Let nodes transmit whenever a frame arrives r No synchronization among nodes m If collision, retransmit after random delay r collision probability increases: m frame sent at t 0 collides with other frames sent in [t 0 -1,t 0 +1]

19 CPSC 441: Link Layer19 Pure Aloha efficiency P(success by given node) = P(node transmits). P(no other node transmits in [p 0 -1,p 0 ]. P(no other node transmits in [p 0 -1,p 0 ] = p. (1-p) N-1. (1-p) N-1 = p. (1-p) 2(N-1) … choosing optimum p and then letting n -> infty... = 1/(2e) =.18 Even worse !

20 CPSC 441: Link Layer20 Slotted ALOHA Assumptions r all frames same size r time is divided into equal size slots, time to transmit 1 frame r nodes start to transmit frames only at beginning of slots r nodes are synchronized r if 2 or more nodes transmit in slot, all nodes detect collision Operation r when node obtains fresh frame, it transmits in next slot r no collision, node can send new frame in next slot r if collision, node retransmits frame in each subsequent slot with prob. p until success

21 CPSC 441: Link Layer21 Slotted ALOHA Pros r single active node can continuously transmit at full rate of channel r highly decentralized: only slots in nodes need to be in sync r simple Cons r collisions, wasting slots r idle slots r nodes may be able to detect collision in less than time to transmit packet r clock synchronization

22 CPSC 441: Link Layer22 Slotted Aloha efficiency r Suppose N nodes with many frames to send, each transmits in slot with probability p r prob that node 1 has success in a slot = p(1-p) N-1 r prob that any node has a success = Np(1-p) N-1 r For max efficiency with N nodes, find p* that maximizes Np(1-p) N-1 r For many nodes, take limit of Np*(1-p*) N-1 as N goes to infinity, gives 1/e =.37 Efficiency is the long-run fraction of successful slots when there are many nodes, each with many frames to send At best: channel used for useful transmissions 37% of time!

23 CPSC 441: Link Layer23 Carrier Sense Multiple Access (CSMA) r First listen; transmit only if channel sensed to be idle r Can collisions occur in this scheme? m One possibility: two nodes might attempt to transmit a frame at the same time m Another possibility?

24 CPSC 441: Link Layer24 CSMA/CD (Collision Detection) CSMA/CD: carrier sensing, deferral as in CSMA m collisions detected within short time m colliding transmissions aborted, reducing channel wastage r collision detection: m easy in wired LANs: measure signal strengths, compare transmitted, received signals m difficult in wireless LANs: receiver shut off while transmitting

25 CPSC 441: Link Layer25 “Taking Turns” MAC protocols channel partitioning MAC protocols: m share channel efficiently and fairly at high load m inefficient at low load: delay in channel access, 1/N bandwidth allocated even if only 1 active node! Random access MAC protocols m efficient at low load: single node can fully utilize channel m high load: collision overhead “taking turns” protocols look for best of both worlds!

26 CPSC 441: Link Layer26 “Taking Turns” MAC protocols Polling: r master node “invites” slave nodes to transmit in turn r concerns: m polling overhead m latency m single point of failure (master) Token passing: r control token passed from one node to next sequentially. r token message r concerns: m token overhead m latency m single point of failure (token)

27 CPSC 441: Link Layer27 Summary of MAC protocols r What do you do with a shared media? m Channel Partitioning, by time, frequency or code Time Division, Frequency Division m Random partitioning (dynamic), ALOHA, S-ALOHA, CSMA, CSMA/CD carrier sensing: easy in some technologies (wire), hard in others (wireless) CSMA/CD used in Ethernet CSMA/CA used in 802.11 m Taking Turns polling from a central site, token passing

28 CPSC 441: Link Layer28 Next Stop LAN Technologies Data link layer so far: m services, error detection/correction, multiple access Next: LAN technologies m Ethernet m hubs, switches m PPP

29 CPSC 441: Link Layer29 Link Layer r Introduction and services r Error detection and correction r Multiple access protocols r Link-Layer Addressing r Ethernet r Hubs and switches r PPP r MPLS

30 CPSC 441: Link Layer30 Ethernet “dominant” wired LAN technology: r cheap $20 for 100Mbs! r first widely used LAN technology r Simpler, cheaper than token LANs and ATM r Kept up with speed race: 10 Mbps – 10 Gbps

31 CPSC 441: Link Layer31 Star topology r Bus topology popular through mid 90s r Now star topology prevails r Connection choices: hub or switch (more later) hub or switch

32 CPSC 441: Link Layer32 Ethernet Frame Structure (1/2) Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame Preamble: r 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 r used to synchronize receiver, sender clock rates

33 CPSC 441: Link Layer33 Ethernet Frame Structure (2/2) r Addresses: 6 bytes m if adapter receives frame with matching destination address, or with broadcast address (eg ARP packet), it passes data in frame to net-layer protocol m otherwise, adapter discards frame r Type: indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk) r CRC: checked at receiver, if error is detected, the frame is simply dropped

34 CPSC 441: Link Layer34 Unreliable, connectionless service r Connectionless: No handshaking between sending and receiving adapter. r Unreliable: receiving adapter doesn’t send acks or nacks to sending adapter m stream of datagrams passed to network layer can have gaps m gaps will be filled if app is using TCP m otherwise, app will see the gaps

35 CPSC 441: Link Layer35 Ethernet uses CSMA/CD r No slots r adapter doesn’t transmit if it senses that some other adapter is transmitting, that is, carrier sense r transmitting adapter aborts when it senses that another adapter is transmitting, that is, collision detection r Before attempting a retransmission, adapter waits a random time, that is, random access

36 CPSC 441: Link Layer36 Ethernet CSMA/CD algorithm 1. Adaptor receives datagram from net layer & creates frame 2. If adapter senses channel idle, it starts to transmit frame. If it senses channel busy, waits until channel idle and then transmits 3. If adapter transmits entire frame without detecting another transmission, the adapter is done with frame ! 4. If adapter detects another transmission while transmitting, aborts and sends jam signal 5. After aborting, adapter enters exponential backoff: after the mth collision, adapter chooses a K at random from {0,1,2,…,2 m -1}. Adapter waits K·512 bit times and returns to Step 2

37 CPSC 441: Link Layer37 Ethernet’s CSMA/CD (more) Jam Signal: make sure all other transmitters are aware of collision; 48 bits Bit time:.1 microsec for 10 Mbps Ethernet ; for K=1023, wait time is about 50 msec Exponential Backoff: r Goal: adapt retransmission attempts to estimated current load m heavy load: random wait will be longer r first collision: choose K from {0,1}; delay is K· 512 bit transmission times r after second collision: choose K from {0,1,2,3}… r after ten collisions, choose K from {0,1,2,3,4,…,1023} See/interact with Java applet on AWL Web site: highly recommended !

38 CPSC 441: Link Layer38 CSMA/CD efficiency r t prop = max prop between 2 nodes in LAN r t trans = time to transmit max-size frame r Efficiency goes to 1 as t prop goes to 0 r Goes to 1 as t trans goes to infinity r Much better than ALOHA, but still decentralized, simple, and cheap

39 CPSC 441: Link Layer39 10BaseT and 100BaseT r 10/100 Mbps rate; latter called “fast ethernet” r T stands for Twisted Pair r Nodes connect to a hub: “star topology”; 100 m max distance between nodes and hub twisted pair hub

40 CPSC 441: Link Layer40 Hubs Hubs are essentially physical-layer repeaters: m bits coming from one link go out all other links m at the same rate m no frame buffering m no CSMA/CD at hub: adapters detect collisions m provides net management functionality twisted pair hub

41 CPSC 441: Link Layer41 Link Layer r Introduction and services r Error detection and correction r Multiple access protocols r Link-Layer Addressing r Ethernet r Interconnections: Hubs and switches r PPP r MPLS

42 CPSC 441: Link Layer42 Interconnecting with hubs r Backbone hub interconnects LAN segments r Extends max distance between nodes r But individual segment collision domains become one large collision domain r Can’t interconnect 10BaseT & 100BaseT hub

43 CPSC 441: Link Layer43 Switch r Link layer device m stores and forwards Ethernet frames m examines frame header and selectively forwards frame based on MAC dest address m when frame is to be forwarded on segment, uses CSMA/CD to access segment r transparent m hosts are unaware of presence of switches r plug-and-play, self-learning m switches do not need to be configured

44 CPSC 441: Link Layer44 Forwarding How do determine onto which LAN segment to forward frame? Looks like a routing problem... hub switch 1 2 3

45 CPSC 441: Link Layer45 Self learning r A switch has a switch table r entry in switch table: m (MAC Address, Interface, Time Stamp) m stale entries in table dropped (TTL can be 60 min) r switch learns which hosts can be reached through which interfaces m when frame received, switch “learns” location of sender: incoming LAN segment m records sender/location pair in switch table

46 CPSC 441: Link Layer46 Filtering/Forwarding When switch receives a frame: index switch table using MAC dest address if entry found for destination then{ if dest on segment from which frame arrived then drop the frame else forward the frame on interface indicated } else flood forward on all but the interface on which the frame arrived

47 CPSC 441: Link Layer47 Switch: traffic isolation r switch installation breaks subnet into LAN segments r switch filters packets: m same-LAN-segment frames not usually forwarded onto other LAN segments m segments become separate collision domains hub switch collision domain

48 CPSC 441: Link Layer48 Switches: dedicated access r Switch with many interfaces r Hosts have direct connection to switch r No collisions; full duplex Switching: A-to-A’ and B-to-B’ simultaneously, no collisions switch A A’ B B’ C C’

49 CPSC 441: Link Layer49 Switching types r cut-through switching: frame forwarded from input to output port without first collecting entire frame m slight reduction in latency m Disadvantage? r Store-and-forward r combinations of shared/dedicated, 10/100/1000 Mbps interfaces

50 CPSC 441: Link Layer50 Institutional network hub switch to external network router IP subnet mail server web server

51 CPSC 441: Link Layer51 Switches vs. Routers r both store-and-forward devices m routers: network layer devices (examine network layer headers) m switches are link layer devices r routers maintain routing tables, implement routing algorithms r switches maintain switch tables, implement filtering, learning algorithms

52 CPSC 441: Link Layer52 Link Layer r Introduction and services r Error detection and correction r Multiple access protocols r Link-Layer Addressing r Ethernet r Hubs and switches r PPP (self-study) r MPLS (self-study)

53 CPSC 441: Link Layer53 Point to Point Data Link Control r one sender, one receiver, one link: easier than broadcast link: m no Media Access Control m no need for explicit MAC addressing m e.g., dialup link, ISDN line r popular point-to-point DLC protocols: m PPP (point-to-point protocol) m HDLC: High level data link control (Data link used to be considered “high layer” in protocol stack! r This is your READING assignment

54 CPSC 441: Link Layer54 Link Layer r Introduction and services r Error detection and correction r Multiple access protocols r Link-Layer Addressing r Ethernet r Hubs and switches r PPP r MPLS

55 CPSC 441: Link Layer55 Multi-Protocol Label Switching (MPLS) r initial goal: speed up IP forwarding by using fixed length label (instead of IP address) to do forwarding m borrowing ideas from Virtual Circuit (VC) approach m but IP datagram still keeps IP address! PPP or Ethernet header IP header remainder of link-layer frame MPLS header label Exp S TTL 20 3 1 5

56 CPSC 441: Link Layer56 MPLS capable routers r a.k.a. label-switched router r forwards packets to outgoing interface based only on label value (don’t inspect IP address) m MPLS forwarding table distinct from IP forwarding tables r signaling protocol needed to set up forwarding m RSVP-TE m forwarding possible along paths that IP alone would not allow (e.g., source-specific routing) !! m use MPLS for traffic engineering r must co-exist with IP-only routers

57 CPSC 441: Link Layer57 R1 R2 D R3 R4 R5 0 1 0 0 A R6 in out out label label dest interface 6 - A 0 in out out label label dest interface 10 6 A 1 12 9 D 0 in out out label label dest interface 10 A 0 12 D 0 1 in out out label label dest interface 8 6 A 0 0 8 A 1 MPLS forwarding tables


Download ppt "CPSC 441: Link Layer1. 2 Our Goals … r understand principles behind data link layer services: m error detection, correction m sharing a broadcast channel:"

Similar presentations


Ads by Google