nete0510: communication media and data communications 1 nete0510 data-link layer and protocols dr....

52
NETE0510: Communication Media an d Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan [email protected]

Upload: barnaby-sharp

Post on 03-Jan-2016

239 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

1

NETE0510Data-link Layer and Protocols

Dr. Supakorn [email protected]

Page 2: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

2

Outline

Encoding Techniques Data Link Layer Fundamental Direct-link Protocols

BSC, DDCMP, HDLC, PPP

Page 3: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

3

Signal Encoding Techniques

Page 4: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

4

Encoding Schemes

Page 5: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

5

Bit rate and Baud rate

Bit rate or data rate: number of bits transmitted over a period of time (bit per second)

Baud rate: number of symbols transmitted over a period of time (baud)

Page 6: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

6

Non-return to Zero-Level (NRZ-L)

two different voltages for 0 and 1 bits voltage constant during bit interval

no transition I.e. no return to zero voltage such as absence of voltage for zero (0 V), constant

positive voltage for one (+5V) more often, negative voltage (-5 V) for one value and

positive (+5 V) for the other

Page 7: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

7

Problems of NRZ-L

Long sequence of 0s or 1s signal leads to “baseline wander” Receiver maintains baseline of detecting 0 or 1 Too many 0s or 1s cause this baseline to change

Clock synchronization Frequent transitions of signals are necessary to enable clock

recovery Every clock cycle the sender transmits a bit and the receiver

recovers a bit Slightly difference in clocks at either sender and receivers may

cause a problem

Page 8: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

8

Non-return to Zero Inverted (NRZI)

nonreturn to zero inverted on ones constant voltage pulse for duration of bit data encoded as presence or absence of signal

transition at beginning of bit time transition (low to high or high to low) denotes binary 1 no transition denotes binary 0

example of differential encoding since have data represented by changes rather than levels More example of different encoding: Different Manchester more reliable detection of transition rather than level easy to lose sense of polarity

Page 9: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

9

Manchester Encoding has transition in middle of each bit period transition serves as clock and data no need to send clock low to high represents one (1), high to low represents zero (0) used by IEEE 802. Both 0s and 1s result in a transition to the signal, the clock

can be effectively recovered at the receiver

Page 10: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

10

Differential Manchester Encoding

midbit transition is clocking only transition at start of bit period representing 0 no transition at start of bit period representing 1

this is a differential encoding scheme used by IEEE 802.5 (Token Ring)

Page 11: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

11

Problems of Manchester Encoding

Double the rate at which signal transition are made on the link the receiver has half the time to detect each pulse of the signal. Bit rate is half of baud rate encoding is only 50%

efficient

Page 12: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

12

4B/5B

Used together with other encoding techniques Used in 100Base-TX transmission The idea is to insert extra bits into the bit stream so as to

break up long sequences of 0s and 1s Every 4 bits of actual data are encoded in a 5-bit code

4B/5B Each 5-bit code has no more than one leading 0s and no

more than two trailing 0s. No pair of 5-bit codes results in more than three

consecutive 0s solve problem of many consecutive 0s Then the 5-bit codes are then transmitted using the NRZI

encoding NRZI already solved the problem of consecutive 1s so 4B/5B

results in 80% efficiency

Page 13: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

13

4B/5B Encoding

4-bit data is encoded into 5-bit code

“One leading 0, two trailing 0s” rule

16 codes used, left the other 16 codes for other purposes

Code 00000 line is dead Code 1111 line is idle Code 00100 halt 7 of them violates the rule The other 6 represent control

symbols

Page 14: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

14

Outline

Encoding Techniques Data Link Layer Fundamental Direct-link Protocols

BSC, DDCMP, HDLC, PPP

Page 15: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

15

Data Link Layer

Because of transmission errors, or because the receiver may need to regulate data rate, it is necessary to have a layer of control communication devices

Need layer of logic above Physical to manage exchange of data over a link Frame synchronization: beginning and end of each frame

must be recognizable Flow control: sender must not send frames at a rate faster

that the receiver can absorb them Error control: correct bit errors Addressing: identify involving communication parties Control and data: receiver can distinguish control

information from transmitted data Link management: initiation, maintenance, and termination

Page 16: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

16

Flow Control

ensure sending entity does not overwhelm receiving entity by preventing buffer overflow

influenced by: transmission time

time taken to emit all bits into medium propagation time

time for a bit to traverse the link

Page 17: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

17

Stop and Wait

source transmits frame destination receives frame and replies with

acknowledgement (ACK) source waits for ACK before sending next destination can stop flow by not send ACK works well for a few large frames Stop and wait becomes inadequate if large block

of data is split into small frames

Page 18: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

18

Sliding Windows Flow Control allows multiple numbered frames to be in transit receiver has buffer W long transmitter sends up to W frames without ACK ACK includes number of next frame expected sequence number is bounded by size of field (k)

frames are numbered modulo 2k

giving max window size of up to 2k - 1 must send a normal acknowledge to resume Piggybacking: insert acknowledgement number field in

data frame so that a frame can contain both sequence number and ACK numbers

Page 19: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

19

Sliding Window Diagram

Page 20: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

20

Error Control

detection and correction of errors such as: lost frames damaged frames

common techniques use: error detection positive acknowledgment (ACK) retransmission after timeout negative acknowledgement (NAK) & retransmission

Page 21: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

21

Automatic Repeat Request (ARQ)

collective name for such error control mechanisms, including:

stop and wait go back N selective reject (selective retransmission)

Page 22: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

22

Stop and Wait

source transmits single frame wait for ACK if received frame damaged, discard it

transmitter has timeout if no ACK within timeout, retransmit

if ACK damaged,transmitter will not recognize it transmitter will retransmit receive gets two copies of frame use alternate numbering and ACK0 / ACK1

Page 23: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

23

Stop and Wait

see example with both types of errors

pros and cons simple inefficient

Page 24: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

24

Go Back N

based on sliding window if no error, ACK as usual use window to control number of outstanding

frames if error, reply with rejection

discard that frame and all future frames until error frame received correctly

transmitter must go back and retransmit that frame and all subsequent frames

Page 25: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

25

Go Back N - Handling

Damaged Frame error in frame i so receiver rejects frame i transmitter retransmits frames from i

Lost Frame frame i lost and either

transmitter sends i+1 and receiver gets frame i+1 out of seq and rejects frame i

or transmitter times out and send ACK with P bit set which receiver responds to with ACK i

transmitter then retransmits frames from i

Page 26: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

26

Go Back N - Handling

Damaged Acknowledgement receiver gets frame i, sends ack (i+1) which is lost acks are cumulative, so next ack (i+n) may arrive before

transmitter times out on frame i if transmitter times out, it sends ack with P bit set can be repeated a number of times before a reset

procedure is initiated Damaged Rejection

reject for damaged frame is lost handled as for lost frame when transmitter times out

Page 27: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

27

Selective Reject

also called selective retransmission only rejected frames are retransmitted subsequent frames are accepted by the receiver and

buffered minimizes retransmission receiver must maintain large enough buffer more complex logic in transmitter hence less widely used useful for satellite links with long propagation delays

Page 28: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

28

Go Back N vsSelective Reject

Page 29: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

29

Error Detection

Two-dimensional parity Internet checksum Cyclic Redundancy Check

Page 30: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

30

Internet Checksum

Not used in the link layer checksum for the internet protocol:

Sum 16-bit data blocks Take one complement of the result to produce the checksum

E.g. calculate checksum of 5 and 3 5 (0101) + 3 (0011) = 8 (1000) Checksum = -8 (0111) Send 5, 3, -8 to receiver send 010100110111 Calculate 5+3+(-8)

0101001101111111

Page 31: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

31

Outline

Encoding Techniques Data Link Layer Fundamental Direct-link Protocols

BSC, DDCMP, HDLC, PPP

Page 32: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

32

BSC (or BISYNC) Protocol

Binary Synchronous Communication Byte-oriented approach: view each frame as a collection

of bytes (characters) rather than a collection of bits Support a particular character set: ASCII, EBCDIC, and

IBM’s 6-bit Transcode

Page 33: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

33

Problem of BISYNC

ETX character may appear in the body of a frame

Solved by “character stuffing” insert a special character called DLE (data-link-escape) character whenever it appears in the body

Page 34: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

34

Point-to-point (PPP) Protocol

Designed to encapsulate IP inter-network data Commonly run over dial-up modem links, but can be

used on any leased line for point-to-point connections not supported by FR or ATM.

Have character stuffing Several of the field sizes are negotiated rather than fixed

using LCP (Link Control Protocol) Two sub protocols: LCP (Link Control Protocol) and NCP

(Network Control Protocol) to negotiate options for a network-layer protocol running on top of PPP IPCP (Internet Protocol Control Protocol) for IP IPXCP for IPX, ATCP for AppleTalk

Page 35: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

35

PPP Frame Format

Flag: 011111110 Protocol: identify high-level protocol e.g. IP or IPX Payload: size is negotiated, default at 150 bytes Checksum: 2-4 bytes long

Page 36: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

36

LCP

Negotiation of payload size is conducted by LCP Frame payload size can be negotiated, 1500 byte by default LCP sends control messages encapsulated in PPP frames

Such messages are denoted by an LCP identifier in the PPP Protocol field

Sizes are changed based on the information contained in those control messages

Page 37: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

37

PPP (cont’d)

PPP tends to be reserved for dialup or a mixed-vendor environment, whereas HDLC is the default for T1 serial connections

Page 38: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

38

DECNET’s DDCMP

Byte-Counting Approach: include number of bytes contained in a frame as a field in the frame header

Transmission error can corrupt the COUNT field framing error

Page 39: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

39

High-level Data Link Control (HDLC)

Previously known as Synchronous Data Link Control (SDLC) protocol

Most popular data link control (L2) protocol Form the basis of ISDN and FR protocols and services specified as ISO 33009, ISO 4335 station types:

Primary - controls operation of link Frames issued are called “commands”

Secondary - under control of primary station Frames issued are called “responses”

Combined - issues commands and responses link configurations

Unbalanced - 1 primary, multiple secondary Balanced - 2 combined stations

Page 40: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

40

HDLC Transfer Modes

Normal Response Mode (NRM) unbalanced config, primary initiates transfer, secondary may

only transmit data in response to a command used on multi-drop lines, e.g. host + terminals

Asynchronous Balanced Mode (ABM) balanced config, either station initiates transmission, has no

polling overhead, widely used Asynchronous Response Mode (ARM)

unbalanced config, secondary may initiate transmit without permission from primary, rarely used

Page 41: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

41

HDLC Frame Structure

synchronous transmission of frames (no start-stop bits required)

single frame format used

header trailer

Page 42: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

42

Flag Fields and Bit Stuffing delimit frame at both ends with 01111110 sequence The sequence is transmitted any time that the link is idle

to keep clock synchronized “bit stuffing” used to avoid confusion with data

containing flag sequence 01111110 0 inserted after every sequence of five 1s if receiver detects five 1s it checks next bit

if next bit is 0, it is deleted (was stuffed bit) if next bit is 1 and seventh bit is 0, accept as the end-of-frame

flag if sixth and seventh bits 1, sender is indicating abort (error

occurred)

Page 43: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

43

Flag Fields and Bit Stuffing (cont’d)

In both bit stuff and character stuffing, the size of a frame is dependent on the data being sent in the payload.

Not possible to make all the frames exactly the same size

Page 44: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

44

Address Field

identifies secondary station that sent or will receive frame usually 8 bits long may be extended to multiples of 7 bits

LSB indicates if is the last octet (1) or not (0) not needed for point-to-point link all ones address 11111111 is broadcast

Allow primary station to broadcast a frame for reception by all secondaries

Page 45: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

45

Control Field different for different frame type

Information (I-) frame - data transmitted to user (next layer up)

Flow and error control piggybacked on information frames Supervisory (S-) frame - ARQ when piggyback not used Unnumbered (U-) frame - supplementary link control

first 1-2 bits of control field identify frame type

Page 46: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

46

Control Field (cont’d) use of Poll/Final bit depends on context in command frame is P bit set to1 to solicit (poll)

response from peer in response frame is F bit set to 1 to indicate response

to soliciting command Sequence number in S- and I-frames usually 3 bits

can extend to 8 bits as shown below

Page 47: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

47

Information & FCS Fields

Information Field in information and some unnumbered frames must contain integral number of octets variable length

Frame Check Sequence Field (FCS) used for error detection either 16 bit CRC or 32 bit CRC

Page 48: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

48

HDLC Operation

consists of exchange of information, supervisory and unnumbered frames

have three phases initialization

by either side, set mode & seq data transfer

with flow and error control using both I & S-frames (RR, RNR, REJ, SREJ)

disconnect when ready or fault noted

Go Back N reject

Selective reject

Page 49: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

49

HDLC Commands and Responses

Page 50: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

50

HDLC Operation Example

Return from busy condition

busy

A must respond with RR or RNR

Send seq no Receive seq noSet sync balanced mode

Unnumbered acknowledgement

Disconnect

Page 51: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

51

HDLC Operation Example

Page 52: NETE0510: Communication Media and Data Communications 1 NETE0510 Data-link Layer and Protocols Dr. Supakorn Kungpisdan supakorn@mut.ac.th

NETE0510: Communication Media and Data Communications

52

Questions?

Next LectureLANs and Hi-speed LANs