* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download PPTX - gozips.uakron.edu
Survey
Document related concepts
Transcript
ECE 4450:427/527 - Computer Networks Spring 2017 Dr. Nghi Tran Department of Electrical & Computer Engineering Lecture 5.1: Link Layer Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 1 Some Discussions • Previously, we saw a network consisting of LINKS interconnecting NODES • Simplest network: • A link connects two nodes • Even though it looks trivial, link is a fundamental aspect of network: one of the first fundamental problems we face • Next few lectures focus on LINK LAYER • Recall: Our approach is bottom up. • How about Physical Layer? Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 2 Link Layer: Five Common Problems • Basic problem: you can’t just send datagrams over the link! • We first consider how to encode bits into the signal at the source and recover bits at the receiving node • Once it is possible to transmit bits, we need to figure out how to package these bits into FRAME • Assume each node is able to recognize the collections of bits making up a frame, the third problem is to determine if those bits are in error: Error Detection and Correction • If frames arriving at destination contain errors, how to recover from such losses: ARQ • Final problem related to multiple-access link: how mediate access to a shared link so that all nodes have a chance to transmit: We focus on Ethernet Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 3 Link Layer: Outline • Physical Medium and FIVE additional functions/services in Link Layer: • How to 1) encoding bits onto medium so that they can be understood by receiving node • With packed-switch, need to consider block of data: 2) Framing • Transmission of Frames: corrupted errors: 3) Error detection/correction • Reliable delivery: 4) Automatic Repeat reQuest (ARQ). • A link shared by multiple nodes: Media access control problem • Introduction of Carrier Sense Multiple Access (CSMA) network, e.g., Ethernet Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 4 Link Layer • Examples of Link Layer Protocols: Ethernet, WiFi, token ring, LTE, 3G etc • Where is Link Layer Implemented? • In each node • Most parts in a Network Adaptor or a Network Interface Card (NIC): Ethernet card, PCMCI card, 802.11 card • Combination of hardware, software, firmware • Note: NIC also implements Physical Layer Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 5 Link Layer datagram datagram controller controller receiving host sending host datagram frame • receiving side • sending side: – encapsulates datagram in frame – adds error checking bits, flow control, etc. Dr. Nghi Tran (ECE-University of Akron) – looks for errors, flow control, etc – extracts datagram, passes to upper layer at receiving side ECE 4450:427/527 Computer Networks 6 What is Communications? • Two nodes connected by a link and the ultimate objective is to send information from one to the other “The fundamental problem of communication is that of reproducing at one point either exactly or approximately a message selected at another point.” (Claude Shannon 1948) Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 7 Communications System Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 8 Physical Medium & Link Capacity • Signals travel through the medium/channel carrying binary bits • Maximum bits carried reliably – Link capacity? • Shannon theorem: the upper bound to the capacity of a link in terms of bits per second (bps) as a function of signal-to-noise ratio (S/N) of the link measured in decibels (dB): C = W log2(1+S/N) (bits/s) • W: Available ``bandwidth” of link (Hz) Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 9 Link Capacity: Example • • • • • • • C = W log2(1+S/N) What is W for telephone line? What is typical S/N Can signal be weaker than noise? How to get higher C? Higher W, higher C? Higher S/N, higher C? Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 10 Link Capacity as Function of W Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 11 Link • All practical links rely on some sort of electromagnetic radiation propagating through a medium or, in some cases, through free space • One way to characterize links, then, is by the medium they use – Typically copper wire in some form (as in Digital Subscriber Line (DSL) and coaxial cable), – Optical fiber (as in both commercial fiber-to-the home services and many long-distance links in the Internet’s backbone), or – Air/free space (for wireless links) Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 12 Link • Another important link characteristic is the frequency – Measured in hertz, with which the electromagnetic waves oscillate • Distance between the adjacent pair of maxima or minima of a wave measured in meters is called wavelength – Speed of light divided by frequency gives the wavelength. – Frequency on a copper cable range from 300Hz to 3300Hz; Wavelength for 300Hz wave through copper is speed of light on a copper / frequency – 2/3 x 3 x 108 /300 = 667 x 103 meters. Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 13 Link Electromagnetic spectrum Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 14 Links Common services available to connect your home Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 15 1) Encoding Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 16 Encoding • Now we start with the first service: Encoding – How to convert binary bits to signal • Not focus on the entire modulation. Instead, we assume the simplest situation: working with two discrete signals: high and low • In practice, it corresponds to two different voltages or two different power levels • What is an obvious way to convert? Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 17 Encoding Signals travel between signaling components; bits flow between adaptors NRZ (Non-Return to Zero) encoding of a bit stream: Low signal represents a 0, high signal represents a 1 Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 18 NRZ: Problems • Problem: Long periods of silence (0s) or high signals (1s) are possible • Baseline wander • Clock recovery Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 19 NRZ Problem: Baseline Wander • Baseline wander • The receiver keeps an average of the signals it has seen so far • Uses the average to distinguish between low and high signal • When a signal is significantly low than the average, it is 0, else it is 1 • Too many consecutive 0’s and 1’s cause this average to change, making it difficult to detect Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 20 NRZ Problem: Clock Recovery • Clock recovery • Frequent transition from high to low or vice versa are necessary to enable clock recovery • Both the sending and decoding process is driven by a clock • Every clock cycle, the sender transmits a bit and the receiver recovers a bit • The sender and receiver have to be precisely synchronized Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 21 Other Coding Scheme: NRZI – Non Return to Zero Inverted – Sender makes a transition from the current signal to encode 1 and stay at the current signal to encode 0: transition at a clock boundary – Solves for consecutive 1’s: Used in USB with bit stuffing Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 22 Other Coding Scheme: Manchester – Merging the clock with signal by transmitting ExOR of the NRZ encoded data and the clock – In Manchester encoding (used widely in 802.3) • 0: low high transition • 1: high low transition Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 23 Issues with Manchester – Doubles the rate at which the signal transitions are made on the link • Which means the receiver has half of the time to detect each pulse of the signal – The rate at which the signal changes is called the link’s baud rate – In Manchester the bit rate is half the baud rate Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 24 4B/5B Encoding • Encode 4-bit symbols into 5-bit codes • 24 symbols must be mapped to 24 codewords out of the possible 25 • Each codeword has no more than one starting zero, and no more than two trailing zeros • Already solve consecutive 0s problem? • Then use NRZI to solve the consecutive 1s problem • 80% efficiency (1 bit is overhead) Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 25 4B/5B Encoding 4-bit data symbol 5-bit code 4-bit data symbol 5-bit code 0000 11110 1000 10010 0001 01001 1001 10011 0010 10100 1010 10110 0011 10101 1011 10111 0100 01010 1100 11010 0101 01011 1101 11011 0110 01110 1110 11100 0111 01111 1111 11101 Dr. Nghi Tran (ECE-University of Akron) 16 left 11111 – when the line is idle 00000 – when the line is dead .. 00100 – to mean halt 13 left : 7 invalid, 6 for various control signals ECE 4450:427/527 Computer Networks 26 4B/5B Encoding 4-bit data symbol 5-bit code 4-bit data symbol 5-bit code 0000 11110 1000 10010 0001 01001 1001 10011 0010 10100 1010 10110 0011 10101 1011 10111 0100 01010 1100 11010 0101 01011 1101 11011 0110 01110 1110 11100 0111 01111 1111 11101 4B/5B: popularized by Fiber Distributed Data Interface (FDDI); also adopted by 802.3, Multichannel Audio Digital Interface Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 27 Other Schemes • RZ, RZ-L • Bi – Phase, Bi-Phase-L • Miller Code, Miller L etc. Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 28 Example • Show 4B/5B encoding and the resulting NRZI signal for the following bit sequences 1101 1110 1010 Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 29 2) Framing Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 30 Why Framing? • We are focusing on packet-switched networks, which means that blocks of data (called frames at this level), not bit streams, are exchanged between nodes. • It is the network adaptor that enables the nodes to exchange frames. Bits flow between adaptors, frames between hosts Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 31 Why Framing? • When node A wishes to transmit a frame to node B, it tells its adaptor to transmit a frame from the node’s memory. This results in a sequence of bits being sent over the link. • The adaptor on node B then collects together the sequence of bits arriving on the link and deposits the corresponding frame in B’s memory. • Recognizing exactly what set of bits constitute a frame—that is, determining where the frame begins and ends—is the central challenge faced by the adaptor Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 32 Framing • Byte-Oriented Protocols • To view each frame as a collection of bytes (characters) rather than bits • BISYNC (Binary Synchronous Communication) Protocol – Developed by IBM (around 60s) • DDCMP (Digital Data Communication Protocol) – Used in DECnet (Digital Equipment Corporation) • Widely used PPP (Point-to-Point Protocol) over Internet • Bit-Oriented Protocols • HDLC (High-Level Data Link Control) Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 33 Frame/Packet Format • Frame/packet: Sequence of labeled fields • Above each field: A number indicating the length of that field in bits • Frame/packet: transmission beginning with the leftmost field Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 34 BISYNC BISYNC: Binary synchronous communication Frame is a collection of bytes Need to indicate the beginning and end of a frame Sentinel characters are used SYN: Synchronization character SOH: Start of header STX, ETX: Start of text, End of text CRC: Cyclic redundancy check Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 35 Problem with BISYNC • ETX may occur in the payload • Precede it with a DLE (data-link-escape) character • Problem propagates, precede DLE with another DLE (extra overhead). Cost is overhead • This approach is called character stuffing: extra characters are inserted in data portion Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 36 DDCMP: Byte-Counting Framing Include the # of bytes in the frame as a field in the header Digital Data Communications Protocol (DDCMP) Count: Specifies # of bytes in the body What happen if Count corrupted? Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 37 PPP Framing • Recent PPP which is commonly run over Internet links uses sentinel approach – Special start of text character denoted as Flag • 01111110 – Address, control : default numbers – Protocol for demux : IP / IPX – Payload : negotiated (1500 bytes) – Checksum : for error detection 2-4 bytes Overhead: 8/1508 =0.5% Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 38 HDLC –Bit-oriented Framing Bit-oriented Protocol HDLC : High Level Data Link Control Beginning and Ending Sequences 01111110 HDLC Frame Format Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 39 HDLC –Bit-oriented Framing HDLC Protocol On the sending side, any time five consecutive 1’s have been transmitted from the body of the message (i.e. excluding when the sender is trying to send the distinguished 01111110 sequence) The sender inserts 0 before transmitting the next bit: Bit stuffing Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 40 HDLC –Bit-oriented Framing HDLC Protocol On the receiving side 5 consecutive 1’s Next bit 0 : Stuffed, so discard it 1 : Either End of the frame marker Or Error has been introduced in the bitstream Look at the next bit If 0 ( 01111110 ) End of the frame marker If 1 ( 01111111 ) Error, discard the whole frame The receiver needs to wait for next 01111110 before it can start receiving again Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 41 Example Example of Bit-stuffing Sender 1111110111111111110111110 0 Receiver x 0 0 0 x x x 11111010111110111110101111100 Length of frame Variable, depends on the data We can calculate and optimize the overhead of bit stuffing Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 42 Example Frame Size Let each frame contain V overhead bits Let a message of M bits be broken into frames of size Kmax # of packets : M / K max The total # of bits for all frames: M M / Kmax V If Kmax ↓, # of frames ↑, and overhead also ↑ If # of frames ↑, then each frame must be processed then more processing delay at each host Increase frame length as much as possible Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 43 Example Frame Size • Why just make Kmax = M? Pipelining delay: frame must be received before forwarding Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 44 Example Framing • What we have discussed so far • Sentinel framing uses special “sentinel” characters (STX, ETX) to indicate the start and end of each frame. • Length-based framing specifies the length of the frame in the beginning of the header, so the receiver knows exactly how much data to read • Frames usually not same size • Clock-based framing (SONET): all frames are the same size - Sender and receiver must have synchronized clocks. All frames fit into a specific time interval. Refer to 2.3.3 textbook. Dr. Nghi Tran (ECE-University of Akron) ECE 4450:427/527 Computer Networks 45