1 / 58

Links and LANs

Links and LANs. EE 122: Intro to Communication Networks Fall 2010 (MW 4-5:30 in 101 Barker) Scott Shenker TAs: Sameer Agarwal, Sara Alspaugh, Igor Ganichev, Prayag Narula http://inst.eecs.berkeley.edu/~ee122/

xenon
Télécharger la présentation

Links and LANs

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Links and LANs EE 122: Intro to Communication Networks Fall 2010 (MW 4-5:30 in 101 Barker) Scott Shenker TAs: Sameer Agarwal, Sara Alspaugh, Igor Ganichev, Prayag Narula http://inst.eecs.berkeley.edu/~ee122/ Materials with thanks to Jennifer Rexford, Ion Stoica, Vern Paxsonand other colleagues at Princeton and UC Berkeley

  2. Your Future? • Who is planning to go to grad school (in CS)? • Who is interested in research possibilities?

  3. Regrading of Homework • Requests for regrading must be made within one week of when the work was returned. • To ask for a regrade, attach a page that specifies:   • The problem(s) you want to be regraded • For each of these problems specify clearly why do you think the problem was misgraded • Without this page, your work will not be regraded. • Your entire homework may be regraded • Score could decrease, stay the same, or increase

  4. Other Announcements • Won’t finish topic (links/LANs) today • It is your responsibility to slow me down • Ask questions, yawn loudly, snore, whatever it takes! • Will continue into next Monday’s lecture….

  5. Goals of Today’s Lecture • Link-layer services • Arbitrating access to a shared medium • Random Access MAC (Media Access Control) • Ethernet: single segment • Ethernet: spanning multiple segments [Monday] • Spanning trees [Monday]

  6. Link-Layer Services

  7. HTTPmessage TCP segment IP packet IP packet IPpacket IP IP IP Ethernet interface Ethernetframe SONET frame Ethernet frame Message, Segment, Packet, and Frame host host HTTP HTTP TCP TCP router router IP Ethernet interface SONET interface Ethernet interface Ethernet interface SONET interface

  8. Ethernet interface Ethernetframe SONET frame Ethernet frame Today We Focus on Link-Layer Ethernet interface SONET interface Ethernet interface Ethernet interface SONET interface • What functions these technologies provide • How they implement those functions

  9. frame frame Adaptor-to-Adaptor Communication datagram link layer protocol adaptor receiving node adaptor sending node • Link layer implemented in adaptor (network interface card; NIC) • Ethernet card, 802.11 card (why?) • Sending side: • Encapsulates datagram in a frame • Determines local addressing, adds error checking, controls transmission • Receiving side • Recognizes arrival, looks for errors, possibly acknowledges • Extracts datagram and passes to receiving node

  10. Link-Layer Services • Encoding • Representing the 0s and 1s • Framing • Encapsulating packet into frame, adding header, trailer • Using MAC addresses rather than IP addresses • Error detection • Errors caused by signal attenuation, noise • Receiver detects presence, may ask for repeat (ARQ) • Resolving contention • Deciding who gets to transmit when multiple senders want to use a shared media • Flow control (pacing between sender & receiver)

  11. Framing • Specify how blocks of data are transmitted between two nodes connected on the same physical media • Service provided by the data link layer • Implemented by the network adaptor • Challenges • Decide when a frame starts & ends • How hard can that be?

  12. 21 Frame contents 53 58 Frame contents Frame contents 21 bytes of data 53 bytes of data 21 Frame contents 94 Bogus new frame length; desynchronization 58 bytes of data misdelivered Simple Approach to Framing: Counting • Sender: begin frame with byte(s) giving length • Receiver: extract this length and count • How can this go wrong? • On occasion, the count gets corrupted

  13. Desynchronization • Once framing is desynchronized, stays that way • Need a method to resynchronize • But once we have that method, why use counting? • Sounds like E2E-like argument….

  14. 01111110 Frame contents 01111111 Framing: Sentinels • Delineate frame with special pattern • e.g., 01111110 start,01111111 end • Problem: what if sentinel occurs within frame? • Solution: escape the special characters • E.g., sender always inserts a 0 after five 1s • … receiver always removes a 0 appearing after five 1s • Similar to escaping special characters in C programs

  15. 01111110 Frame content 01111111 When Receiver Sees Five 1s • If next bit 0, remove it, and begin counting again • Because this must be stuffed bit • Can’t be at beginning/end of frame • If next bit 1, then: • If following bit is 0, this is start of frame • receiver has seen 01111110 • If following bit is 1, this is end of frame • receiver has seen 01111111

  16. Example 01111110 0111111011111011111001 01111111 Sender: Five 1s  insert a 0 • 01111110 0111110101111100111110001 01111111 Five 1s and next bit 0  remove it Receiver: Start frame End frame 01111110 0111111011111011111001 01111111

  17. Sentinels and Synchronization • Can Sentinels ever get desynchronized? • No! Every analysis of start/end is independent

  18. Clock-Based Framing (SONET) • SONET (Synchronous Optical NETwork) • SONET endpoints maintain clock synchronization • Frames have fixed size (e.g., 125 sec) • No ambiguity about start & stop of frame • But may be wasteful • NRZ encoding • To avoid long sequences of 0’s or 1’s payload is XOR-ed with special 127-bit pattern w/ many 0-1/1-0 transitions

  19. Error Detection • Errors are unavoidable • Electrical interference, thermal noise, etc. • Error detection • Transmit extra (redundant) information • Use redundant information to detect errors • Extreme case: send two copies of the data • Trade-off: accuracy vs. overhead • Techniques for detecting errors • Parity checking • Checksum • Cyclic Redundancy Check (CRC)

  20. Error Detection: Parity • Add an extra bit to a 7-bit code • Odd parity: ensure an odd number of 1s • E.g., 0101011 becomes 01010111 • Even parity: ensure an even number of 1s • E.g., 0101011 becomes 01010110 • Overhead: 1/7th • Power: • Detects all 1-bit errors • But: can’t detect an even number of bit errors in a word • Can use more bits to gain more power

  21. Error Detection: Internet Checksum • Treat data as a sequence of 16-bit words • Compute ones-complement sum of all 16-bit words • Intermingles integrity of a large group of data • Overhead: 16 bits • Power: • Catches 1-bit errors, most other errors • But not, e.g., same bit flipped in two different words

  22. Error Detection: CRC • Family of powerful and principled algorithms • Detects wide range of bit corruption patterns seen in practice • Used by most modern link layers • See K&R Section 5.2.3 • Why do links use CRC but IP uses checksum?

  23. Arbitrating Access in Shared Media

  24. Point-to-Point vs. Broadcast Media • Point-to-point: dedicated pairwise communication • Long-distance fiber link • Point-to-point link between Ethernet switch and host • Broadcast: shared wire or medium • Traditional Ethernet • 802.11 wireless LAN

  25. Multiple Access Algorithm • Single shared broadcast channel • Must avoid having multiple nodes speaking at once • Otherwise, collisions lead to garbled data • Multiple access mechanism • Distributed algorithm for sharing the channel • Algorithm determines which node can transmit • Classes of techniques • Channel partitioning: divide channel into pieces • Taking turns: scheme for trading off who gets to transmit • Random access: allow collisions, and then recover • Optimizes for the common caseof only one sender

  26. Rounds 0 1 2 4 5 0 1 2 4 5 3 3 Slots = Channel Partitioning: TDMA TDMA: Time Division Multiple Access • Access to channel in "rounds" • Each station gets fixed length slot in each round • Time-slot length is packet transmission time • Unused slots go idle • Example: 6-station LAN with slots 0, 3, and 4

  27. time frequency bands FDM cable Channel Partitioning: 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 pkt, frequency bands 2,5,6 idle

  28. master data data poll slaves “Taking Turns” MAC protocols Polling • Master node “invites” slave nodes to transmit in turn • Concerns: • Polling overhead • Latency • Single point of failure (master) • Token passing • Control tokenpassed from one node to next sequentially • Node must have token to send • Concerns: • Token overhead • Latency • At mercy of any node

  29. Why Did Ethernet Beat Token Ring? • Performance? • No! • Latency? • No! • Cost (i.e., simplicity)? • Yes! • Reliability? • Yes!

  30. 5 Minute Break Questions Before We Proceed?

  31. Random Access MAC Protocols

  32. Random Access MAC Protocols • When node has packet to send • Transmit at full channel data rate • No a priori coordination among nodes • Two or more transmitting nodes collision • Data lost • Random access MAC protocol specifies: • How to detect collisions • How to recover from collisions • Examples • ALOHA and Slotted ALOHA • CSMA, CSMA/CD, CSMA/CA (wireless, covered later)

  33. Key Ideas of Random Access • Carrier sense • Listen before speaking, and don’t interrupt • Checking if someone else is already sending data • … and waiting till the other node is done • Collision detection • If someone else starts talking at the same time, stop • Realizing when two nodes are transmitting at once • …by detecting that the data on the wire is garbled • Randomness • Don’t start talking again right away • Waiting for a random time before trying again

  34. Where it all Started: AlohaNet • Norm Abramson left Stanford to surf • Set up first data communication system for Hawaiian islands • Hub at U. Hawaii, Oahu • Had two radio channels: • Random access: • Sites sending data • Broadcast: • Hub rebroadcasting data

  35. Assumptions All frames same size Time divided into equal slots (time to transmit a frame) Nodes are synchronized Nodes begin to transmit frames only at start of slots If two or more nodes transmit, all nodes detect collision Operation When node gets fresh data, transmits in next slot No collision: success! Collision: node retransmits frame in each subsequent slot with probability p until success Slotted ALOHA

  36. Slot-by-Slot Example

  37. Efficiency of Slotted Aloha • What is the maximum fraction of successful transmissions? • Suppose N stations have packets to send • Each transmits in slot with probability p • Probability of successful transmission is roughly:by a particular node i: Si = p (1-p)(N-1)by exactly one of N nodes: S= N p (1-p)(N-1) • Limiting behavior: • For fixed p, S  0 as N increases • But if p = 1/N, then S  1/e = 0.37 as N increases • Max efficiency is only slightly greater than 1/3!

  38. Pros Single active node can continuously transmit at full rate of channel Highly decentralized: only need slot synchronization Simple Cons Wasted slots: Idle Collisions Nodes should detect collision in less than time to transmit packet Clock synchronization Pros and Cons of Slotted Aloha

  39. Improving on Slotted Aloha • Fewer wasted slots • Need to decrease collisions and empty slots • Don’t waste full slots on collisions • Need to decrease time to detect collisions • Avoid need for synchronization • Synchronization is hard to achieve

  40. CSMA (Carrier Sense Multiple Access) • CSMA: listen before transmit • If channel sensed idle: transmit entire frame • If channel sensed busy, defer transmission • Human analogy: don’t interrupt others!

  41. CSMA Collisions Collisions can still occur: propagation delay means two nodes may not hear each other’s transmission in time. At time t1, D still hasn’t heard B’s signal sent at the earlier time t0, so D goes ahead and transmits: failure of carrier sense. Collision:entire packet transmission time wasted Do we still needs slots? Would slots hurt or help?

  42. CSMA/CD (Collision Detection) • CSMA/CD: carrier sensing, deferral as in CSMA • Collisions detected within short time • Colliding transmissions aborted, reducing wastage • Collision detection easy in wired LANs: • Compare transmitted, received signals • Collision detection difficult in wireless LANs: • Reception shut off while transmitting • Even if on, might not be able to hear the other sender, even though the receiver can • Leads to use of collision avoidance instead (later)

  43. CSMA/CD Collision Detection Both B and D can tell that collision occurred. This lets them (1) know that they need to resend the frame, and (2) recognize that there’s contention and adopt a strategy for dealing with it. Note: for this to work, we need restrictions on minimum frame size and maximum distance

  44. Limits on CSMA/CD Network Length B • Latency depends on physical length of link • Time to propagate a packet from one end to the other • Suppose A sends a packet at timet • And B sees an idle line at a time just before t+d • … so B happily starts transmitting a packet • B detects a collision, and sends jamming signal • But A can’t see collision until t+2d A latency d

  45. Limits on CSMA/CD Network Length B • A needs to wait for time 2d to detect collision • So, A should keep transmitting during this period • … and keep an eye out for a possible collision • Imposes restrictions. E.g., for 10 Mbps Ethernet: • Maximum length of the wire: 2,500 meters • Minimum length of a frame: 512 bits (64 bytes) • 512 bits = 51.2 sec (at 10 Mbit/sec) • For light in vacuum, 51.2 sec ≈ 15,000 meters vs. 5,000 meters “round trip” to wait for collision A latency d

  46. Performance of CSMA/CD • Time wasted in collisions • Proportional to d • Time spend transmitting • Proportional to packet length p • Efficiency ~ 1/(1+5d/p) • For large packets, small distances, E ~ 1 • Note that as bandwidth increases, p decreases • That is why high-speed LANs are all switched

  47. Game Theory? • What happens when one node has CD and the other doesn’t? • When do we see this in real life?

  48. Ethernet (Single Segment)

  49. Ethernet: CSMA/CD Protocol • Carrier sense: wait for link to be idle • Collision detection: listen while transmitting • No collision: transmission is complete • Collision: abort transmission & send jam signal • Random access: binary exponential back-off • After collision, wait a random time before trying again • After mth collision, choose K randomly from {0, …, 2m-1} • … and wait for K*512 bit times before trying again • The wired LAN technology • Hugely successful: 3/10/100/1000/10000 Mbps

  50. Ethernet Frame Structure • Sending adapter encapsulates packet in frame • Preamble: synchronization • Seven bytes with pattern 10101010, followed by one byte with pattern 10101011 • Used to synchronize receiver & sender • Type: indicates the higher layer protocol • Usually IP (but also Novell IPX, AppleTalk, …) • CRC: cyclic redundancy check • Receiver checks & simply drops frames with errors

More Related