5: DataLink Layer5a-1 Chapter 5: The Data Link Layer Last time: r link layer services r error detection, correction r multiple access protocols and LANs Today: r multiple access protocols and LANs r link layer addressing, ARP r specific link layer technologies: r Lab 8/Project 3 r Next Friday class r Summer opps.
5: DataLink Layer5a-2 Slotted Aloha r time is divided into equal size slots (= pkt trans. time) r node with new arriving pkt: transmit at beginning of next slot r if collision: retransmit pkt in future slots with probability p, until successful. Success (S), Collision (C), Empty (E) slots
5: DataLink Layer5a-3 Slotted Aloha efficiency Q: what is max fraction slots successful? A: Suppose N stations have packets to send m each transmits in slot with probability p m prob. successful transmission S is: by single node: S= p (1-p) (N-1) by any of N nodes S = Prob (only one transmits) = N p (1-p) (N-1) … choosing optimum p as n -> infty... = 1/e =.37 as N -> infty At best: channel use for useful transmissions 37% of time!
5: DataLink Layer5a-4 Pure (unslotted) ALOHA r unslotted Aloha: simpler, no synchronization r pkt needs transmission: m send without awaiting for beginning of slot r collision probability increases: m pkt sent at t 0 collide with other pkts sent in [t 0 -1, t 0 +1]
5: DataLink Layer5a-5 Pure Aloha (cont.) P(success by given node) = P(node transmits). P(no other node transmits in [t 0 -1,t 0 ]). P(no other node transmits in [t 0, t 0 +1]) = p. (1-p) N-1. (1-p) N-1 P(success by any of N nodes) = N p. (1-p) N-1. (1-p) N-1 … choosing optimum p as n -> infty... = 1/(2e) =.18 S = throughput = “goodput” (success rate) G = offered load = Np Pure Aloha Slotted Aloha protocol constrains effective channel throughput!
5: DataLink Layer5a-6 CSMA: Carrier Sense Multiple Access) CSMA: listen before transmit: r If channel sensed idle: transmit entire pkt r If channel sensed busy, defer transmission m Persistent CSMA: retry immediately with probability p when channel becomes idle (may cause instability) m Non-persistent CSMA: retry after random interval r human analogy: don’t interrupt others!
5: DataLink Layer5a-7 CSMA collisions collisions can occur: propagation delay means two nodes may not yet hear each other’s transmission collision: entire packet transmission time wasted spatial layout of nodes along ethernet note: role of distance and propagation delay in determining collision prob.
5: DataLink Layer5a-8 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 m persistent or non-persistent retransmission 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 r human analogy: the polite conversationalist
5: DataLink Layer5a-9 CSMA/CD collision detection
5: DataLink Layer5a-10 “Taking Turns” MAC protocols channel partitioning MAC protocols: m share channel efficiently 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!
5: DataLink Layer5a-11 “Taking Turns” MAC protocols Polling: r master node “invites” slave nodes to transmit in turn r Request to Send, Clear to Send msgs 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)
5: DataLink Layer5a-12 Reservation-based protocols Distributed Polling: r time divided into slots r begins with N short reservation slots m reservation slot time equal to channel end-end propagation delay m station with message to send posts reservation m reservation seen by all stations r after reservation slots, message transmissions ordered by known priority
5: DataLink Layer5a-13 Summary of MAC protocols r What do you do with a shared media? m Channel Partitioning, by time, frequency or code Time Division,Code Division, Frequency Division m Random partitioning (dynamic), ALOHA, S-ALOHA, CSMA, CSMA/CD carrier sensing: easy in some technoligies (wire), hard in others (wireless) CSMA/CD used in Ethernet m Taking Turns polling from a central cite, token passing
5: DataLink Layer5a-14 LAN technologies Data link layer so far: m services, error detection/correction, multiple access Next: LAN technologies m addressing m Ethernet m hubs, bridges, switches m m PPP m ATM
5: DataLink Layer5a-15 LAN Addresses and ARP 32-bit IP address: r network-layer address r used to get datagram to destination network (recall IP network definition) LAN (or MAC or physical) address: r used to get datagram from one interface to another physically-connected interface (same network) r 48 bit MAC address (for most LANs) burned in the adapter ROM
5: DataLink Layer5a-16 LAN Addresses and ARP Each adapter on LAN has unique LAN address
5: DataLink Layer5a-17 LAN Address (more) r MAC address allocation administered by IEEE r manufacturer buys portion of MAC address space (to assure uniqueness) r Analogy: (a) MAC address: like Social Security Number (b) IP address: like postal address r MAC flat address => portability m can move LAN card from one LAN to another r IP hierarchical address NOT portable m depends on network to which one attaches
5: DataLink Layer5a-18 Recall earlier routing discussion A B E Starting at A, given IP datagram addressed to B: r look up net. address of B, find B on same net. as A r link layer send datagram to B inside link-layer frame B’s MAC addr A’s MAC addr A’s IP addr B’s IP addr IP payload datagram frame frame source, dest address datagram source, dest address
5: DataLink Layer5a-19 ARP: Address Resolution Protocol r Each IP node (Host, Router) on LAN has ARP module, table r ARP Table: IP/MAC address mappings for some LAN nodes m TTL (Time To Live): time after which address mapping will be forgotten (typically 20 min) Question: how to determine MAC address of B given B’s IP address?
5: DataLink Layer5a-20 ARP protocol r A knows B's IP address, wants to learn physical address of B r A broadcasts ARP query pkt, containing B's IP address m all machines on LAN receive ARP query r B receives ARP packet, replies to A with its (B's) physical layer address r A caches (saves) IP-to-physical address pairs until information becomes old (times out) m soft state: information that times out (goes away) unless refreshed
5: DataLink Layer5a-21 Routing to another LAN Walkthrough: routing from A to B via R r In routing table at source Host, find router r In ARP table at source, find MAC address E6-E BB- 4B, etc A R B
5: DataLink Layer5a-22 r A creates IP packet with source A, destination B r A uses ARP to get R’s physical layer address for r A creates Ethernet frame with R's physical address as dest, Ethernet frame contains A-to-B IP datagram r A’s data link layer sends Ethernet frame r R’s data link layer receives Ethernet frame r R removes IP datagram from Ethernet frame, sees its destined to B r R uses ARP to get B’s physical layer address r R creates frame containing A-to-B IP datagram sends to B A R B
5: DataLink Layer5a-23 Ethernet “dominant” 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, 100, 1000 Mbps Metcalfe’s Ethernet sketch
5: DataLink Layer5a-24 Ethernet Frame Structure Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame Preamble: r 7 bytes with pattern followed by one byte with pattern r used to synchronize receiver, sender clock rates
5: DataLink Layer5a-25 Ethernet Frame Structure (more) r Addresses: 6 bytes, frame is received by all adapters on a LAN and dropped if address does not match 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
5: DataLink Layer5a-26 Ethernet: uses CSMA/CD A: sense channel, if idle then { transmit and monitor the channel; if detect another transmission then { abort and send jam signal; update # collisions; delay as required by exponential backoff algorithm; goto A } else {done with the frame; set collisions to zero} } else {wait until ongoing transmission is over and goto A}
5: DataLink Layer5a-27 Ethernet’s CSMA/CD (more) Jam Signal: make sure all other transmitters are aware of collision; 48 bits; 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 x 512 bit transmission times r after second collision: choose K from {0,1,2,3}… r after ten or more collisions, choose K from {0,1,2,3,4,…,1023}
5: DataLink Layer5a-28 Ethernet Technologies: 10Base2 r 10: 10Mbps; 2: under 200 meters max cable length r thin coaxial cable in a bus topology r repeaters used to connect up to multiple segments r repeater repeats bits it hears on one interface to its other interfaces: physical layer device only!
5: DataLink Layer5a-29 10BaseT and 100BaseT r 10/100 Mbps rate; later called “fast ethernet” r T stands for Twisted Pair r Hub to which nodes are connected by twisted pair, thus “star topology” r CSMA/CD implemented at hub
5: DataLink Layer5a-30 10BaseT and 100BaseT (more) r Max distance from node to Hub is 100 meters r Hub can disconnect “jabbering” adapter r Hub can gather monitoring information, statistics for display to LAN administrators