1 / 40

CSC4220/6220 Computer Networks

CSC4220/6220 Computer Networks. Dr. WenZhan Song Associate Professor, Computer Science. Course roadmap. Introduction Application Layer: WWW, FTP, email, DNS, multimedia Transport Layer: reliable end-end data transfer principles, UDP, TCP

alissa
Télécharger la présentation

CSC4220/6220 Computer 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. CSC4220/6220 Computer Networks Dr. WenZhan Song Associate Professor, Computer Science

  2. Course roadmap • Introduction • Application Layer: WWW, FTP, email, DNS, multimedia • Transport Layer: reliable end-end data transfer principles,UDP, TCP • Network Layer: IP addressing, routing and other issues • Data Link Layer: framing, error control, flow control • Medium Access Control (MAC) Layer: multiple-access, channel allocation • Physical Layer: wired, wireless, satellite • Other Topics: network security, social issues, hot topics, research directions

  3. Data Link Layer Our goals: • understand principles behind data link layer services: • error detection, correction • sharing a broadcast channel: multiple access • link layer addressing • reliable data transfer, flow control: done! • instantiation and implementation of various link layer technologies

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

  5. Data Link Layer Road Map • Data link layer design issues • Framing • Error Control • Example data link protocols • HDLC and PPP • Multiple Access Protocols • Static channel allocation • Dynamic channel allocation • LAN technologies and their MAC protocols • Ethernet • WiFi and WiMax

  6. Functions of the Data Link Layer • Provide service interface to the network layer • Dealing with transmission errors • Regulating data flow • Slow receivers not swamped by fast senders • Sharing broadcast channels: multiple access channels • Determine who gets to use the channel when there is competition for it

  7. Functions of the Data Link Layer Relationship between packets and frames.

  8. Services Provided to Network Layer • Various services • Unacknowledged connectionless service • Without ack, no logical connection • Appropriate when error rate is low, real-time traffic (voice, late data worse than bad data) • Most LANs • Acknowledged connectionless service • No logical connection, but individually acked • Useful over unreliable channels (wireless) • Acknowledged connection-oriented service • Guarantee frame received only once and in right order • Three phases: connection established, frames transmitted, connection released

  9. frame frame Adaptors Communicating • link layer implemented in “adaptor” (called NIC) • Ethernet card, PCMCI card, 802.11 card • sending side: • encapsulates datagram in a frame • adds error checking bits, rdt, flow control, etc. • receiving side • looks for errors, rdt, flow control, etc • extracts datagram, passes to rcving node • adapter is semi-autonomous • link & physical layers datagram rcving node link layer protocol sending node adapter adapter

  10. Framing • Encapsulate datagram into frame, adding header and trailer • Break the bit stream up into discrete frames and compute the checksum of each frame Relationship between packets and frames

  11. Framing – Character Count A character stream. (a) Without errors. (b) With one error.

  12. Framing (2) – Flag Bytes (a) A frame delimited by flag bytes. (b) Four examples of byte sequences before and after stuffing. Actually, after insert ESC control byte, it also inverts the fifth bit of (or XOR 0x20 with) the following data byte. See wiki or textbook p491. For simplicity, many textbooks do not mention it.

  13. Framing (3) – Bit Flags • Delimit frame at both ends using 01111110 • May close one frame and open another • Receiver hunts for flag sequence to synchronize • Bit stuffing used to avoid confusion with data containing 01111110 • 0 inserted after every sequence of five 1s • If receiver detects five 1s it checks next bit • If 0, it is deleted • If 1 and seventh bit is 0, accept as flag • If sixth and seventh bits 1, sender is indicating abort

  14. Framing (4) – Bit Flags Bit stuffing (a) The original data. (b) The data as they appear on the line. (c) The data as they are stored in receiver’s memory after destuffing.

  15. Error Control • Error Detection: • errors caused by signal attenuation, noise. • receiver detects presence of errors: • error-detection codes • signals sender for retransmission or drops frame • Error Correction: • receiver identifies and corrects bit error(s) without resorting to retransmission • error-correction codes

  16. Error Detection and Correction • 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

  17. Error-Detection & Correction Code Consider a code with only 4 valid codewords: 00000 0000000000 1111111111 0000011111 11111 They have Hamming diatance 5 with each other, hence can correct double errors. Example: 00000 00111 must be 00000 11111 Single Bit Parity: Detect single bit errors Hamming distance of x and y is XOR(x,y) Only odd bit errors detection Examine: Number of 1s in the code is even • Rules • To correct d errors, you need a distance 2d+1 code • To detect d errors, you need a distance d+1 code

  18. Error-Correction Code Hamming code • Theoretical lower limit • A code with m message bits and r check bits which will allow all single errors to be corrected • 2m legal messages – legal codewords • For each legal message, there is n illegal codewords • Total number of bit pattern is 2n • Therefore, (n+1)2m2n • n=m+r, (m+r+1) 2r => the limit can be achieved by Hamming code • Hamming Code • It can correct any single bit error • bits in power of 2 positions (1,2,4,8,) are check bits, the rest are m data bits • Check bit forces the parity of some collection of bit “1” to be even • To see which check bits the data bit in position k contributes to, rewrite k as a sum of powers of 2. • 11=1+2+8, 29=1+4+8+16

  19. Hamming Code Example If a 12-bit hamming code 0x9B8 = 100110111000 arrives at receiver, is there any bit error? If so, which bit is wrong? 1 2 3=2+1 4 5=4+16=4+27=4+2+1 8 9=8+110=8+211=8+2+1 12=8+4 1 0 0 1 1 0 1 1 1 0 0 0 Hence bit 6 = 2+4 is wrong, so correct hamming code should be 0x9F8 = 100111111000

  20. Correct burst errors Use of Hamming code to correct k burst errors by send k ASCII character together, column by column. (Read Tanenbaum textbook page 195)

  21. Error-Detection Codes Internet checksum • Note • When adding numbers, a carryout from the most significant bit needs to be added to the result • Example: add two 16-bit integers 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1 wraparound sum checksum

  22. Error-Detection Codes Cyclic Redundancy Check • 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, and odd number of bit errors • widely used in practice (ATM, HDCL)

  23. CRC Example Want: D.2r XOR R = nG equivalently: D.2r = nG XOR R equivalently: if we divide D.2r by G, want remainder R 0 0 0 0 Left shift r bit D.2r G R = remainder[ ] If G has r+1 bit, R has r bit Operation is XOR, not +, or -!!! Notice: x^3+1 is a generator!

  24. Another Example Calculation of the polynomial code checksum. GCRC-32=100000100110000010001110110110111

  25. CRC generator preference Generator G(x) with degree k can detect: • All single-bit errors, as long as the xk and x0 terms have nonzero coefficients. • All double-bit errors, as long as G(x) has a factor with at least three terms. • Any odd number of errors, as long as G(x) contains the factor (x+1). • Any “burst” error(i.e., sequence of consecutive errored bits) with the length less than (including equal) k bits. • Burst errors of larger than k bits can also be detected with high probability 1-1/2k) * Refer textbook page 196-200

  26. Flow Control • Ensuring the sending entity does not overwhelm the receiving entity • Preventing buffer overflow • Transmission time • Time taken to emit all bits into medium • Propagation time • Time for a bit to traverse the link

  27. Model of Frame Transmission X

  28. Data Link Layer Road Map • Data link layer design issues • Framing • Error Control • Example data link protocols • HDLC and PPP • Multiple Access Protocols • Static channel allocation • Dynamic channel allocation • LAN technologies and their MAC protocols • Ethernet • WiFi and WiMax

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

  30. HDLC (High-Level Data Link Control) Frame format for bit-oriented protocols. • Data link layer protocol used in IBM mainframe world, X.25 network, etc • Using slide window protocol (GBN, SR, or variations) for flow control and reliable data transfer

  31. HDLC (High-Level Data Link Control) Control field of (a) An information frame. (b) A supervisory frame • ACK or RECEIVE READY • NAK or REJECT: follow GBN protocol • RECEIVE NOT READY: ask sender to stop • SELECTIVE REJECT: follow SR protocol (c) An unnumbered frame • used for control purpose or carry data when unreliable connectionless service needed ACKed/NAKed frame#

  32. The Data Link Layer in the Internet A home personal computer acting as an internet host.

  33. PPP Design Requirements [RFC 1557] • packet framing: encapsulation of network-layer datagram in data link frame • carry network layer data of any network layer protocol (not just IP) at same time • ability to demultiplex upwards • bit transparency: must carry any bit pattern in the data field • error detection (no correction) • connection liveness: detect, signal link failure to network layer • network layer address negotiation: endpoint can learn/configure each other’s network address

  34. PPP non-requirements • no error correction/recovery • no flow control • out of order delivery OK • no need to support multipoint links (e.g., polling) Error recovery, flow control, data re-ordering all relegated to higher layers!

  35. PPP Data Frame • Flag: delimiter (framing) • Address: does nothing (only one option) • Control: does nothing; in the future possible multiple control fields • Protocol: upper layer protocol to which frame delivered (eg, PPP-LCP, IP, IPCP, etc)

  36. PPP Data Frame • info: upper layer data being carried • check: cyclic redundancy check for error detection Not bit-oriented, e.g., bit-stuffing, it uses byte-stuffing!

  37. Byte Stuffing • “data transparency” requirement: data field must be allowed to include flag pattern <01111110> • Q: is received <01111110> data or flag? • Sender: adds (“stuffs”) extra < 01111110> byte after each < 01111110> data byte • Receiver: • two 01111110 bytes in a row: discard first byte, continue data reception • single 01111110: flag byte

  38. Byte Stuffing flag byte pattern in data to send flag byte pattern plus stuffed byte in transmitted data

  39. PPP Data Control Protocol Before exchanging network-layer data, data link peers must • LCP: configure PPP link (max. frame length, authentication) • NCP: learn/configure network layer information • for IP: carry IP Control Protocol (IPCP) msgs (protocol field: 8021) to configure/learn IP address LCP configuration

  40. Reading Assignment • Chapter 5 • 5.2 – 5.6

More Related