450 likes | 557 Views
ECE 4450:427/527 - Computer Networks Spring 2014. Dr. Nghi Tran Department of Electrical & Computer Engineering. Lecture 5.1: Link Layer. Some Discussions. Previously, we saw a network consisting of LINKS interconnecting NODES Simplest network: A link connects two nodes
E N D
ECE 4450:427/527 - Computer NetworksSpring 2014 Dr. Nghi Tran Department of Electrical & Computer Engineering Lecture 5.1: Link Layer ECE 4450:427/527
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? ECE 4450:427/527
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 ECE 4450:427/527
Link Layer: Outline • Physical Medium andFIVE 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 ECE 4450:427/527
Link Layer • Examples of Link Layer Protocols: Ethernet, WiFi, token ring • 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 ECE 4450:427/527
Link Layer datagram datagram controller controller receiving host sending host datagram frame • receiving side • looks for errors, flow control, etc • extracts datagram, passes to upper layer at receiving side • sending side: • encapsulates datagram in frame • adds error checking bits, flow control, etc. ECE 4450:427/527
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) ECE 4450:427/527
Communications System ECE 4450:427/527
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 of the link measured in decibels (dB): • C = W log2(1+S/N) • W: Available bandwidth of link (Hz) ECE 4450:427/527
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? ECE 4450:427/527
Link Capacity as Function of W ECE 4450:427/527
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) ECE 4450:427/527
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. ECE 4450:427/527
Link Electromagnetic spectrum ECE 4450:427/527
Links Common services available to connect your home ECE 4450:427/527
1) Encoding ECE 4450:427/527
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? ECE 4450:427/527
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 ECE 4450:427/527
NRZ: Problems • Problem: Long periods of silence (0s) or high signals (1s) are possible • Baseline wander • Clock recovery ECE 4450:427/527
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 ECE 4450:427/527
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 ECE 4450:427/527
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 ECE 4450:427/527
Other Coding Scheme: Manchester • Merging the clock with signal by transmitting Ex-OR of the NRZ encoded data and the clock • In Manchester encoding (used widely in 802.3) • 0: low high transition • 1: high low transition ECE 4450:427/527
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 ECE 4450:427/527
4B/5B Encoding • Encode 4-bit symbols into 5-bit codes • 24 symbols must be mapped to 24codewords 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) ECE 4450:427/527
4B/5B Encoding 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
4B/5B Encoding 4B/5B: popularized by Fiber Distributed Data Interface (FDDI); also adopted by 802.3, Multichannel Audio Digital Interface ECE 4450:427/527
Other Schemes • RZ, RZ-L • Bi – Phase, Bi-Phase-L • Miller Code, Miller L etc. ECE 4450:427/527
Example • Show 4B/5B encoding and the resulting NRZI signal for the following bit sequences • 1101 1110 1010 ECE 4450:427/527
2) Framing ECE 4450:427/527
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 ECE 4450:427/527
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 ECE 4450:427/527
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) ECE 4450:427/527
Frame/Packet Format • Frame/packet: Sequence of labeled fields • Above each field: A number indicating the length of that field in bits • Frame/packet: transmition beginning with the leftmost field ECE 4450:427/527
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 ECE 4450:427/527
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 ECE 4450:427/527
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? ECE 4450:427/527
PPP Framing • Recent PPP which is commonly run over Internet links uses sentinel approach • Special start of text character denoted as Flag • 0 1 1 1 1 1 1 0 • 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% ECE 4450:427/527
HDLC –Bit-oriented Framing • Bit-oriented Protocol • HDLC : High Level Data Link Control • Beginning and Ending Sequences 0 1 1 1 1 1 1 0 HDLC Frame Format ECE 4450:427/527
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 ECE 4450:427/527
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 ECE 4450:427/527
Example Example of Bit-stuffing Sender 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 0 Receiver 1 1 1 1 1 0 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 0 1 1 1 1 1 0 0 Length of frame Variable, depends on the data We can calculate and optimize the overhead of bit stuffing 0 0 0 0 x x x x ECE 4450:427/527
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 : The total # of bits for all frames: 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 ECE 4450:427/527
Example Frame Size • Kmax = M? • Why just make • Pipelining delay: frame must be received before forwarding ECE 4450:427/527
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. ECE 4450:427/527