1 / 51

Direct Link Networks

Direct Link Networks. Textbook: Computer Networks: A Systems Approach, L. Peterson, B. Davie, Morgan Kaufmann Chapter 2. Direct Links: Outline. Physical Layer Link technologies Encoding Link Layer Framing Error Detection Reliable Transmission (ARQ protocols) Medium Access Control:

kaya
Télécharger la présentation

Direct Link Networks

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. Direct Link Networks Textbook: Computer Networks: A Systems Approach, L. Peterson, B. Davie, Morgan Kaufmann Chapter 2. CCN: Direct Link Networks

  2. Direct Links: Outline • Physical Layer • Link technologies • Encoding • Link Layer • Framing • Error Detection • Reliable Transmission (ARQ protocols) • Medium Access Control: • Existing protocols: Ethernet, Token Rings, Wireless CCN: Direct Link Networks

  3. Link Technologies • Cables: • Cat 5 twisted pair, 10-100Mbps, 100m • Thin-net coax, 10-100Mbps, 200m • Thick-net coax, 10-100Mbps, 500m • Fiber, 100Mbps-2.4Gbps, 2-40km • Leased Lines: • Copper based: T1 (1.544Mbps), T3 (44.736Mbps) • Optical fiber: STS-1 (51.84Mbps), STS-N (N*51.84Mbps) • Last-Mile Links: • POTS (56Kbps), ISDN (2*64Kbps) • xDSL: ADSL (16-640Kbps, 1.554-8.448Mbps), VDSL (12.96Mbps-55.2Mbps) • CATV: 40Mbps downstream, 20Mbps upstream • Wireless Links: Cellular, Satellite, Wireless Local Loop CCN: Direct Link Networks

  4. Bits 0 0 1 0 1 1 1 1 0 1 0 0 0 0 1 0 NRZ Encoding • Signals propagate over a physical medium • modulate electromagnetic waves • e.g., vary voltage • Encode binary data onto signals • e.g., 0 as low signal and 1 as high signal • known as Non-Return to zero (NRZ) CCN: Direct Link Networks

  5. Problem: Consecutive 1s or 0s • Low signal (0) may be interpreted as no signal • High signal (1) leads to baseline wander • Receiver compares rx_signal to avg_signal • Clock drift: Unable to recover clock CCN: Direct Link Networks

  6. Alternative Encodings • Non-return to Zero Inverted (NRZI) • make a transition from current signal to encode a one; stay at current signal to encode a zero • solves the problem of consecutive ones • Manchester • transmit XOR of the NRZ encoded data and the clock • only 50% efficient. CCN: Direct Link Networks

  7. Bits 0 0 1 0 1 1 1 1 0 1 0 0 0 0 1 0 NRZ Clock Manchester NRZI Encodings (cont) CCN: Direct Link Networks

  8. 4b data 5b code 4b data 5b code 0000 11110 1000 10010 0001 01001 1001 10011 0010 10100 1010 10110 0011 01010 1011 10111 0100 01011 1100 11010 0101 01110 1101 11011 0110 10010 1110 11100 0111 10011 1111 11101 Encodings (cont) • 4B/5B • every 4 bits of data encoded in a 5-bit code • 5-bit codes selected to have no more than one leading 0 and no more than two trailing 0s • thus, never get more than three consecutive 0s • resulting 5-bit codes are transmitted using NRZI • achieves 80% efficiency CCN: Direct Link Networks

  9. Framing • The physical layer provides a mean to transmit a sequence of bits • How can one determine the beginning/end of a frame? • Solutions: • Character-based framing (use special control characters) • Bit-oriented framing with flags • Length counts • Clock based CCN: Direct Link Networks

  10. SYN SYN SOH Header STX Body ETX CRC SYN Character Based Framing • BISYNC: BInary SYNchronous Communication • SYN: Synchronous idle, SOH: Start of Header, STX: Start of text, ETX: End of text • Problem 1: if control characters appear within the header, or CRC. • These are known locations, one can skip control characters in these fields • Problem 2: if CTRL characters appear in the packet. • Use a Data Link Escape (DLE) character before ETX when it appears within the packet • If DLE appears within the packet replace it with DLE DLE. CCN: Direct Link Networks

  11. 8 16 16 8 Beginning Ending Header Body CRC sequence sequence Bit Based Framing • Sentinel-based (Bit oriented) • delineate frame with special pattern: 01111110 • e.g., HDLC, SDLC • problem: special pattern appears in the payload • solution: bit stuffing • sender: insert 0 after five consecutive 1s • receiver: delete 0 that follows five consecutive 1s • Disadvantage: potentially increases the length by 20% CCN: Direct Link Networks

  12. Counter Based Framing • include payload length in header • e.g., DDCMP • problem: count field corrupted • solution: catch when CRC fails CCN: Direct Link Networks

  13. Clock Based Framing • SONET: Synchronous Optical Network • Each frame is 125 micro-seconds long: 810 bytes for STS-1 • STS-n (STS-1 = 51.84 Mbps) CCN: Direct Link Networks

  14. Direct Links: Outline • Physical Layer • Link technologies • Encoding • Link Layer • Framing • Error Detection • Reliable Transmission (ARQ protocols) • Medium Access Control (MAC): • Existing protocols: Ethernet, Token Rings, Wireless CCN: Direct Link Networks

  15. Error Detection • Bits can get corrupted on transmissions • How to detect, and if possible, correct them • Error detection techniques: • Parity bit • Internet checksum • Cyclic redundancy check (CRC) CCN: Direct Link Networks

  16. Parity Bit • Simplest of all techniques • Single parity bit • Add a bit that takes the XOR of all the data bits • What kind of errors can it detect? • Two dimensional parity: • Arrange the data in a 2D matrix • Take the parity along each row and row column • Send the data with the parity bits • What kind of errors can it detect? CCN: Direct Link Networks

  17. Internet Checksum Algorithm • View message as a sequence of 16-bit integers; sum using 16-bit ones-complement arithmetic; take ones-complement of the result. u_short cksum(u_short *buf, int count) { register u_long sum = 0; while (count--) { sum += *buf++; if (sum & 0xFFFF0000) { /* carry occurred, so wrap around */ sum &= 0xFFFF; sum++; } } return ~(sum & 0xFFFF); } CCN: Direct Link Networks

  18. Cyclic Redundancy Check • Add k bits of redundant data to an n-bit message • want k << n • e.g., k = 32 and n = 12,000 (1500 bytes) • Represent n-bit message as n-1 degree polynomial • e.g., MSG=10011010 as M(x) = x7 + x4 + x3 + x1 • Let k be the degree of some divisor polynomial • e.g., C(x) = x3 + x2 + 1 CCN: Direct Link Networks

  19. CRC (cont) • Transmit polynomial P(x) that is evenly divisible by C(x) • shift left k bits, i.e., M(x)xk • subtract remainder of M(x)xk / C(x) from M(x)xk • Receiver polynomial P(x) + E(x) • E(x) = 0 implies no errors • Divide (P(x) + E(x)) by C(x); remainder zero if: • E(x) was zero (no error), or • E(x) is exactly divisible by C(x) CCN: Direct Link Networks

  20. Selecting C(x) • All single-bit errors, as long as the xk and x0 terms have non-zero coefficients. • Any odd number of errors, as long as C(x) contains the factor (x + 1) • Any ‘burst’ error (i.e., sequence of consecutive error bits) for which the length of the burst is less than k bits. • Most burst errors of larger than k bits can also be detected • See Table 2.6 on page 102 for common C(x) CCN: Direct Link Networks

  21. Direct Links: Outline • Physical Layer • Link technologies • Encoding • Link Layer • Framing • Error Detection • Reliable Transmission (ARQ protocols) • Medium Access Control (MAC): • Existing protocols: Ethernet, Token Rings, Wireless CCN: Direct Link Networks

  22. Reliable Transmission: ARQ • Automatic Repeat reQuest (ARQ) • Underlying physical channel: • Each transmitted frame may be delayed by an arbitrary and variable time • Some frames might be lost and may never arrive • Assume that error detection works correctly • Frames that arrive are assumed to do so in order, with or without errors (this assumption is not always necessary, true for direct links) • Correctness of ARQ protocol: each packet is released to the network layer once and only once, without error • Efficiency: Use of link bandwidth (effective throughput) CCN: Direct Link Networks

  23. Acknowledgements & Timeouts CCN: Direct Link Networks

  24. Stop-and-Wait Sender Receiver • Sender ensures that each frame is received correctly before sending the next frame. • How to distinguish between successive packets? • Use sequence numbers • But sequence numbers may grow out of bound? • A 1-bit sequence number suffices for Stop-and-Wait! CCN: Direct Link Networks

  25. Problems with Stop-and-Wait • Keeping the pipe full • Example • 1.5Mbps link x 45ms RTT = 67.5Kb (8KB) • 1KB frames implies 1/8th link utilization • How to keep the pipe full? • Send more frames without waiting for acks CCN: Direct Link Networks

  26. Sender Receiver … ime T … Sliding Window • Allow multiple outstanding (un-ACKed) frames • Upper bound on un-ACKed frames, called window CCN: Direct Link Networks

  27. £ SWS … … LAR LFS Sliding Window: Sender • Assign sequence number to each frame (SeqNum) • Maintain three state variables: • send window size (SWS) • last acknowledgment received (LAR) • last frame sent (LFS) • Maintain invariant: LFS - LAR <= SWS • Advance LAR when ACK arrives • Buffer up to SWS frames CCN: Direct Link Networks

  28.  RWS LFR LFA Sliding Window: Receiver • Maintain three state variables • receive window size (RWS) • largest frame acceptable (LFA) • last frame received in order (LFR) • Maintain invariant: LFA - LFR <= RWS • Frame SeqNum arrives: • if LFR < SeqNum < = LFA accept; update LFR, if necessary • if SeqNum < = LFR or SeqNum > LFA discarded • Send cumulative ACKs • Buffer up to RWS packets CCN: Direct Link Networks

  29. Buffer Sizes • SWS set to bandwidth-delay product estimate • For RWS, two common settings • RWS = 1: receiver will not buffer any frames that arrive out of order • RWS = SWS • Does not make sense to set RWS > SWS CCN: Direct Link Networks

  30. Sequence Number Space • SeqNum field is finite; sequence numbers wrap around • Sequence number space must be larger then number of outstanding frames • If RWS=SWS, SWS <= MaxSeqNum-1 is not sufficient • suppose 3-bit SeqNum field (0..7) • SWS=RWS=7 • sender transmit frames 0..6 • arrive successfully, but ACKs lost • sender retransmits 0..6 • receiver expecting 7, 0..5, but receives second incarnation of 0..5 • SWS < (MaxSeqNum+1)/2 is correct rule • Intuitively, SeqNum “slides” between two halves of sequence number space CCN: Direct Link Networks

  31. Concurrent Logical Channels • Multiplex 8 logical channels over a single link • Run stop-and-wait on each logical channel • Maintain three state bits per channel • channel busy • current sequence number out • next sequence number in • Header: 3-bit channel num, 1-bit sequence num • 4-bits total • Separates reliability from order • Datalink layer protocol used in ARPANET CCN: Direct Link Networks

  32. Direct Links: Outline • Physical Layer • Link technologies • Encoding • Link Layer • Framing • Error Detection • Reliable Transmission (ARQ protocols) • Medium Access Control (MAC): • Existing protocols: Ethernet, Token Rings, Wireless CCN: Direct Link Networks

  33. Medium Access Control Protocols Multiple Access Protocols Contention Conflict-free Dynamic Resolution Static Resolution Dynamic Allocation Static Allocation Token Passing Time of arrival Probabilistic Probabilistic ID Reservation CCN: Direct Link Networks

  34. MAC Protocols: Evaluation • Throughput • Delay • Buffering • Stability We also generally assume that: • channel is errorless • feedback is available CCN: Direct Link Networks

  35. Carrier Sense Protocols • Use the fact that in some networks you can sense the medium to check whether it is currently free • 1-persistent CSMA • non-persistent CSMA • p-persistent protocol • CSMA with collision Detection (CSMA/CD) • 1-persistent CSMA • when a station has a packet: • it waits until the medium is free to transmit the packet • if a collision occurs, the station waits a random amount of time • first transmission results in a collision if several stations are waiting for the channel CCN: Direct Link Networks

  36. Carrier Sense Protocols (Cont’d) • non-persistent CSMA • when a station has a packet: • if the medium is free, transmit the packet • otherwise wait for a random period of time and repeat the algorithm • higher delays, but better performance than pure ALOHA • p-persistent protocol • when a station has a packet wait until the medium is free: • transmit the packet with probability p • wait for next slot with probability 1-p • better throughput than other schemes but higher delay • CSMA with Collision Detection (CSMA/CD) • stations abort their transmission when they detect a collision • e.g., Ethernet, IEEE802.3 CCN: Direct Link Networks

  37. Ethernet • History: evolution from Aloha, CSMA, CSMA/CD (by Xerox PARC) => Ethernet, => IEEE802.3 (Digital, Intel, Xerox) • There are slight differences between Ethernet and 802.3 (e.g., 802.3 length field is used for packet type in Ethernet, various transmission speeds for 802.3 from 1 to 10Mbps) • Physical layer (10Mbps Ethernet): • Manchester encoding (bit synchronous, no-dc component) • Cabling: maximum 500 meters with up to 4 repeaters (max 2500m) CCN: Direct Link Networks

  38. Frame Format (IEEE802.3) • Preamble : 7x10101010… (allows the receiver’s clock to synchronize) • SF: 10101011 • 10Mbps has only 6 bytes addresses: • Unicast: unique per adaptor (ranges are allocated to manufacturers) • Broadcast: FF:FF:FF:FF:FF:FF • Multicast: first address bit = 1 • Internet Multicast: 01:00:5e:00:00:00 -to- 01:00:5e:7f:ff:ff • Pad: minimum frame length of 64 bytes CCN: Direct Link Networks

  39. Ethernet Algorithm • Receiver: accepts frames with a correct CRC • Sender: CSMA/CD 1-persistent algorithm • If the adaptor has a frame and the line is idle: transmit, otherwise wait until idle line then transmit • If a collision occurs: • When detected a 32-bit jamming sequence is sent • Binary exponential backoff: select a random number  [0, 2i-1] and waits for that many slots before transmitting • After ten collisions the randomization interval is frozen to max 1023 • After 16 collisions the controller throws away the frame • What is the reason for having a minimal frame length? (Hint RTT: 51.2ms) CCN: Direct Link Networks

  40. Ethernet Performance • Assume that retransmissions occur with probability p, k stations ready to transmit: • Probability that a station acquires the channel: A=kp(1-p)k-1 • Maximum: when p=1/k, k-> A->1/e • Probability that a contention interval has exactly j slots is: A(1-A)j-1 • Mean number of slots per contention is: 1/A -> e = 2.718… • Slot duration: 2t = 51.2ms • Channel efficiency: P/(P+2te), where P is transmission time for a packet CCN: Direct Link Networks

  41. Ethernet Performance CCN: Direct Link Networks

  42. Ethernet Capture Effect • A and B have a large queue of packets • There exists a situation where B will keep increasing its backoff interval (and finally dropping its packet) while A is transmitting its packets • One of the reasons why frame is dropped after 16 collisions CCN: Direct Link Networks

  43. Token Passing MAC • Token Bus (IEEE802.4): • broadcast bus • logical ring • token: special control frame • only the token holder station can transmit frames • 0, 2, 4, 6: traffic priority classes • Token Ring (initiated by IBM => IEEE802.5 => FDDI): • token regenerated/modified at each node • stations have two modes: • listen (forwards bits with delay 1) • transmit (seizes the first token by transforming into the start of frame) CCN: Direct Link Networks

  44. Token Ring CCN: Direct Link Networks

  45. 8 8 48 48 8 32 24 Start of Dest Src End of Control Body CRC Status frame addr addr frame Token Ring (cont) • Idea • Frames flow in one direction: upstream to downstream • special bit pattern (token) rotates around ring • must capture token before transmitting • release token after done transmitting • immediate release • delayed release • remove your frame when it comes back around • stations get round-robin service • Frame Format CCN: Direct Link Networks

  46. Fiber Distributed Data Interface • Evolution of IEEE802.5 • Designed for fiber (100Mbps) but also supports coax and twisted pair • Architecture: dual ring • Tolerates one broken link or one station failure • Stations buffer at least 9 bits and at most 80 bits • Uses 4B/5B encoding • Specific Timed-Token Algorithm CCN: Direct Link Networks

  47. Token Times • Token Holding Time (THT) • upper limit on how long a station can hold the token • Token Rotation Time (TRT) • how long it takes the token to traverse the ring. • TRT <= ActiveNodesxTHT + RingLatency • Target Token Rotation Time (TTRT) • agreed-upon upper bound on TRT CCN: Direct Link Networks

  48. Token Maintenance • Lost Token • no token when initializing ring • bit error corrupts token pattern • node holding token crashes • Generating a Token (and agreeing on TTRT) • execute when join ring or suspect a failure • send a claim frame that includes the node’s TTRT bid • when receive claim frame, update the bid and forward • if your claim frame makes it all the way around the ring: • your bid was the lowest • everyone knows TTRT • you insert new token CCN: Direct Link Networks

  49. Maintenance (cont) • Monitoring for a Valid Token • should periodically see valid transmission (frame or token) • maximum gap = ring latency + max frame < = 2.5ms • set timer at 2.5ms and send claim frame if it fires CCN: Direct Link Networks

  50. Ad Hoc Wireless Networks • Physical transmission: spread-spectrum radio and diffused infrared • Key issue: collision avoidance, as for the Ethernet • More complex than the Ethernet because the nodes are not directly connected with one another • Multi-hop network • Potential problems: • Hidden terminal problem • Exposed terminal problem CCN: Direct Link Networks

More Related