Professional Documents
Culture Documents
Chuong 04 Data Link
Chuong 04 Data Link
Chuong 04 Data Link
Ni dung
iu khin dng d liu iu khin li Mt s nghi thc iu khin lin kt d liu
Ni dung
iu khin dng d liu
iu khin li Mt s nghi thc iu khin lin kt d liu
Time
Garbled frame
Frame 5 Frame 5
Frame 5 Frame 5
Error-free transmission
B mn K thut my tnh Khoa Cng ngh thng tin
iu kin gi nh
Tt c frame u n ch Khng c frame li Cc frame n ng th t
C ch hot ng
Ngun pht d liu (di dng cc frame) ch nhn d liu v tr li bng ACK Ngun phi i ACK trc khi pht tip d liu
ch c th ngng truyn d liu bng cch khng gi ACK
t0 T
Frame t0 + 1 T R t0 + a T R
t0 + a T
t0 + 1 T
t0 + 1 + a T
t0 + 1 + a T
ACK t0 + 1 + 2a T R t0 + 1 + 2a T R
a>1
B mn K thut my tnh Khoa Cng ngh thng tin
a<1
10
11
Sliding windows
C ch hot ng
Cho php nhiu frame c th truyn ng thi Bn thu c b m vi kch thc W (c th nhn W frame) Bn pht c th truyn ti a W-1 frame m khng cn i ACK nh s th t cho cc frame ACK c cha s th t ca frame k tip c th truyn
12
Sliding windows
S th t c quay vng bi kch thc ca s (modulo 2k)
Frames buffered until acknowledged Frames already transmitted Window of frames that may be transmitted
Sender's perspective
Frames already received Window of frames that may be accepted
Receiver's perspective
B mn K thut my tnh Khoa Cng ngh thng tin
13
Destination System B
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
RR 3
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
F3 F4
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
F5
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
4 RR
F6
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
B mn K thut my tnh Figure Khoa Cng ngh thng tin 7.4 Example of a Sliding-Window Protocol
14
Sliding windows
Ci tin
Bn thu c th gi ACK m khng cho php bn pht gi tip d liu (Receive Not Ready)
Trong trng hp ny, bn thu phi gi ACK bnh thng ha vic truyn nhn d liu khi n sn sng
15
A A A A A A
Frame 1
B B
Frame 1
Frame 2
Frame a
Frame (a 1)
Frame 2
Frame 1
B B B
a+1
Frame (a + 1)
Frame a
Frame 3
Frame 2 A
2a + 1
Frame (2a + 1) A
Frame (2a)
Frame (a+3)
Frame (a+2)
(a) W ! 2a + 1
t=0
A A A A A A
Frame 1
B B
Frame 1
t=0
A A A A A A
Frame 1
B B
Frame (a 1)
Frame 2
Frame a
Frame 2
Frame 1
B B B B
Frame a
Frame (a 1)
Frame 2
Frame 1
B B B
a+1
Frame (a + 1)
Frame a
Frame 3
Frame 2 A
a+1
Frame (a + 1)
Frame a
Frame 3
Frame 2 A
Frame W
Frame (W 1)
2a + 1
Frame (2a + 1) A
Frame (2a)
Frame (a+3)
Frame (a+2)
2a + 1
Frame W A
Frame (a + 2)
W >= 2a+1
t=0
W < 2a + 1
B B
16
Ni dung
iu khin dng d liu
iu khin li
Mt s nghi thc iu khin lin kt d liu
17
iu khin li l g ?
iu khin li l cc k thut pht hin v sa li xy ra trong qu trnh truyn cc frame Bo m truyn nhn d liu chnh xc
18
K thut iu khin li
Phn loi li i vi frame
Mt frame: frame khng n ch hoc n nhng thng tin iu khin trn frame b h (bn nhn khng th xc nh l frame no) Frame h: thng tin iu khin trn frame xc nh c, nhng d liu trong frame b li
Pht hin li (CRC, Parity, ) Positive ACK xc nhn cc frame nhn c Negative ACK (NAK) yu cu truyn li cho cc frame b h Truyn li sau mt thi gian time-out
B mn K thut my tnh Khoa Cng ngh thng tin
19
C ch
Da trn iu khin dng K thut ARQ (Automatic Repeat Request)
Cho php cc nghi thc lin kt d liu qun l li v yu cu truyn li Phn loi
Idle RQ (stop-and-wait)
Dng vi c ch iu khin dng stop-wait
Continuous RQ
Dng vi c ch iu khin dng sliding-window Selective repeat Go-back-N
20
Idle RQ
C ch hot ng
A gi mt I-Frame (Information Frame) n B A i phn hi t B trc khi gi tip frame
ACK-Frame A gi d liu mi NAK-Frame A gi li d liu Khng nhn c tr li A gi li sau thi gian time-out
A
PDU transmission time Propagation time
frame
AC K
0
1
frame
AC K
1
0
frame
0
1
u/khuyt im
n gin hiu qu ng truyn thp
Time-out interval ACK0 lost; A retransmits
frame
1
0
ACK
frame
1
0
AC K
Time
StopandWait
Cc loi li
(E1) I-Frame khng n c bn nhn (E2) I-Frame n c bn nhn nhng ni dung I-Frame b sai (E3) ACK-Frame khng n c bn gi hay ACK-Frame n c bn gi nhng ni dung ACK-Frame b sai
22
StopandWait
Sa li E1
S dng timer: bn gi sau khi gi i mt I-Frame th khi ng mt b m thi gian, sau khong thi gian i T m cha nhn c tn hiu ACK/ NAK bo v th xem nh I-Frame cha ti v gi li frame ny.
23
StopandWait
Sa li E2
Truyn li Frame
24
StopandWait
Sa li E3
Khng nhn c ACK-Frame: truyn li Li lp li frame (duplicated frame): dng ch s tun t frame (sequential number) bn nhn c th loi b cc frame trng lp
25
GobackN
C ch hot ng
iu khin
RR = receive ready = ACK = acknowledge REJ = reject = NAK = negative acknowledge
26
GobackN Cc trng hp li
Cc kiu li tng t nh trong Idle RQ (c th xy ra ng thi trn nhiu frame)
(E1) I-Frame khng n c bn nhn (E2) I-Frame n c bn nhn, ni dung IFrame sai (E3) ACK-Frame khng n c bn gi
27
GobackN
Sa li E1
S dng danh sch truyn li (Retransmission list) lu cc I-Frame gi nhng cha c ACK Khi gi mi I-Frame th khi ng mt b m thi gian tng ng vi I-Frame Sau khong thi gian i T m cha nhn c frame ACK th xem nh I-Frame ny cha ti v gi li cc frame k t frame ny Bn nhn ch nhn cc frame ng trnh t nn s b nhng frame sau frame khng n
Ci tin bng cch gi NAK tng ng (bn nhn khng cn i timeout nn s nhanh hn)
28
GobackN
Sa li E2
Bn nhn pht hin li frame i Bn nhn bo cho bn gi bng NAKi v loi b cc frame sau i Bn gi gi li cc frame t framei Thi gian p ng nhanh hn so vi dng timeout.
29
GobackN
Sa li E3
ACKi b mt Nu sau c ACKi+1, ACKi+2... th truyn bnh thng Nu timeout bn gi s gi li I-Frame Bn nhn pht hin frame truyn li ny nhn nn s bo li ACK (hoc NAK) tng ng Khi nhn ACK, bn pht khng cn truyn li tt c cc frame m c th truyn frame t ch s trong ACK
30
A
fram e0 fram e1 fram e2
2 RR
e3 f r am
Go-back-N v d
f r am e4
fram e5
4 RR
fram e6 fra m
4 REJ
e4 f ram e5
discarded by receiver
4 retransmitted
RR 5
4, 5, and 6 retransmitted
fra m f r am e7
Timeout
fram e0
RR
e6
RR
7
Timeout
(P b i
t=1 )
RR 1
fra m
e1 fram
e2
Go-back-N ARQ
Sele
31
Selective Repeat
C ch hot ng
Tng t nh Go-Back-N Ch gi li cc frame b NAK hoc time-out Bn nhn c th nhn I-frame khng theo ng ch s tun t n nhn phi c buffer lu li cc frame n khng theo ng ch s tun t
32
Vn kch thc ca s
Tnh hung: window kch thc 7
A gi cc frame t 0 n 6 qua B B xc nhn tt c, nhng tt c ACK u b mt A i b timeout, nn gi li frame 0 B lc ny dch ca s nhn, c th nhn cc frame 7,0,1,...5. N tng frame 7 b mt v 0 l frame mi, nn chp nhn (trng frame)
33
Selective Repeat
Sa li E1
S dng danh sch truyn li (Retransmission list) lu cc I-Frame gi nhng cha c ACK Khi gi mi I-Frame th khi ng mt b m thi gian tng ng vi I-Frame Sau khong thi gian i T m cha nhn c frame ACK th gi li frame ny
34
Selective Repeat
Sa li E2
I-Frame truyn n bn nhn nhng b li Bn nhn bo cho bn gi bit thng qua NAKFrame Bn nhn vn ly cc frame tip theo vo b m (nhng cha a ln lp trn) Bn gi ch truyn li I-Frame b li Bn nhn nhn ng cc frame theo trnh t th c th a d liu ln lp trn
35
Selective Repeat
Sa li E3
S dng ch s tun t frame (sequential number): Khi ACK-frame b li hay khng n c bn gi, sau thi gian timeout bn gi s gi li I-Frame ny
36
B
fram e0 fram e1
2 RR RR 2
e3 fram
e0
e1
e2
fram e2
Selective Repeat v d
e7
7 RR
e0
fram
ack-N ARQ
4
fram e5 e6
f r am e4
4
4 REJ
f ram e6
fra m fram e7
J4 SRE
e4
buffered by receiver
fra m
e4
e5
RR 5
RR 7
fra m
e6
Timeout
fra m f r am e1
fram e
RR
e0
1 RR
2
(P b i
(P b i
t=1 )
t=1 )
RR 1
fra m
RR
3
e1
fra m
e3
e2
fram
e4
37
Selective-reject ARQ
Go-back-N protocol
38
Ni dung
iu khin dng d liu iu khin li
39
Ni dung
iu khin dng d liu iu khin li Mt s nghi thc iu khin lin kt d liu Nghi thc Binary synchronous communication (BSC)
Nghi thc High-level data link control (HDLC) Mt s nghi thc ta DLC khc
40
H tr truyn half-duplex Cu hnh point-to-point hoc multipoint Truyn dn ng b hoc bt ng b iu khin li Idle RQ
41
42
Khung BSC
Khung BSC
Khung iu khin
Khung d liu
43
44
45
46
47
48
Ni dung
iu khin dng d liu iu khin li Mt s nghi thc iu khin lin kt d liu
Nghi thc Binary synchronous communication (BSC)
49
50
51
52
Cc c tnh c bn
Phn loi cc trm
Trm chnh (primary station)
iu khin hot ng ca lin kt Cc khung (frame) pht ra c gi l lnh (command)
53
Cc c tnh c bn (tt)
Cu hnh lin kt (link configuration)
Khng cn bng (unbalanced)
Bao gm mt trm chnh v mt hoc nhiu trm ph H tr truyn half duplex v full duplex
Cn bng (balanced)
Bao gm hai trm t hp H tr truyn half duplex v full duplex
54
Cc c tnh c bn (tt)
Ch truyn (transfer mode)
Normal Response Mode (NRM)
c s dng trong cu hnh khng cn bng Trm chnh khi ng vic trao i d liu Trm ph ch c th truyn d liu p ng vi lnh t trm chnh c dng trong ng multidrop
55
9 10 11 12 13 14 15 16
8n
56
C iu khin (flag)
Dng phn cch khung (u v cui)
Gi tr: 01111110
C th dng va l kt thc khung ny va l bt u khung khc S dng k thut chn bit (bit stuffing) trnh xut hin c trong d liu
Bit stuffing: 0 c chn thm mi khi xut hin nm s 1 lin tip trong phn d liu
111111111111011111101111110 1111101111101101111101011111010
B mn K thut my tnh Khoa Cng ngh thng tin
57
nh hng nu li xy ra vi c
58
Trng a ch
Dng xc nh trm ph gi hoc s nhn khung Khng cn thit trong kt ni im-im nhng vn c gi nht qun) Thng Control Flag Address di 8 bit Information FCS Flag Gi tr 11111111 l a ch broadcast (gi n 8 8 or 16 variable 16 or 32 8 tt c)8 bits extendable C th m rng thnh bi s ca 7 bit
LSB ca mi octet bo y l octet cui cng (1) hay cha (0)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 8n
59
Trng iu khin
loi khung,FCS tng ng c HDLC nh ngha baInformation Flag Address Control Flag ba loi trngoriu khin 8 8 8 16 variable 16 or 32 8
bits extendable Khung thng tin (I-frame) cha d liu cn truyn (a) Frame format
1 2 4 5 6 7 8 10 11 12 13 14 15 8n Khung 3gim st 9(supevisor16frame, S-frame) dng 0 0 1 cho ARQ khi piggybacking khng c dng Khung khng s (unnumbered frame, U-frame) b (b) Extended Address Field sung cc chc nng iu khin lin kt
3 N(S)
7 N(R) N(R) M
8
N(S) = Send sequence number N(R) = Receive sequence number S = Supervisory function bits M = Unnumbered function bits P/F = Poll/final bit
0 1
S M
60
61
Khung thng tin v khung gim st c th (c) 8-bit control field format m rng 16 bit S dng ch s tun t l 7 bit
1 Information Supervisory 0 1 0 S 2 3 4 5 N(S) 0 0 0 0 6 7 8 9 P/F P/F 10 11 12 13 N(R) N(R) 14 15 16
62
63
Trng FCS
Dng pht hin li c tnh da trn cc bit cn li ca khung CRC 16 bit C th dng CRC 32 bit
64
65
Hot ng
Trao i khung thng tin, khung gim st v khung khng s 3 giai on
Khi to Trao i d liu Ngt kt ni
66
Cc lnh v p ng
Name Information (I) Supervisory (S) Receive ready (RR) Receive not ready (RNR) Reject (REJ) Selective reject (SREJ) Unnumbered (U) Set normal response/extended mode (SNRM/SNRME) Set asynchronous response/extended mode (SARM/SARME) Set asynchronous balanced/extended mode (SABM, SABME) Set initialization mode (SIM) Disconnect (DISC) Unnumbered Acknowledgment (UA) Disconnected mode (DM) Request disconnect (RD) Request initialization mode (RIM) Unnumbered information (UI) Unnumbered poll (UP) Reset (RSET) Exchange identification (XID) Test (TEST) Frame reject (FRMR) C C C C C R R R R C/R C C C/R C/R R Set mode; extended = 7-bit sequence numbers Set mode; extended = 7-bit sequence numbers Set mode; extended = 7-bit sequence numbers Initialize link control functions in addressed station Terminate logical link connection Acknowledge acceptance of one of the set-mode commands Responder is in disconnected mode Request for DISC command Initialization needed; request for SIM command Used to exchange control information Used to solicit control information Used for recovery; resets N(R), N(S) Used to request/report status Exchange identical information fields for testing Report receipt of unacceptable frame C/R C/R C/R C/R Positive acknowledgment; ready to receive Iframe Positive acknowledgment; not ready to receive Negative acknowledgment; go back N Negative acknowledgment; selective reject Command/ Response C/R Exchange user data Description
67
Khi to
Gi U-frame khi to 1 trong 6 ch
SNRM / SNRME SARM / SARME SABM / SABME
68
Trao i d liu
Sau khi kt ni C hai bn u c th gi I-frame (ch s tun t bt u t 0) Cc S-frame c th c dng iu khin dng v iu khin li nu
RR : ACK RNR : bn nhn bn, sau phi pht RR tip tc nhn d liu REJ: NACK (go-back-N) SREJ: NACK (selective repeat)
69
Ngt kt ni
Mt trong hai bn ngt kt ni bng cch gi U-frame DISC (disconnect) Bn kia phi chp nhn ngt kt ni, gi li U-frame UA(unnumbered acknowledgment) Cc khung qu c th b mt (vic phc hi phi do cc lp trn)
70
V d qu trnh hot ng
UA (a) Link setup and disconnect
(c) Bus
(c)
A B B
SABM
I , 3, 0
I , 2, 0
N(S) N(R)
A A BM
I, 0, 0 N(S) N(R) A
A B
3 I,A, 0
B
R B NR, 4
I, 4 , 0 I , 3 , 0 I, 4 , 0 5 B
,1 BI, 0
SABM
I , 0, 0
N(S) N(R)
I , 0, 0
I , 1, 1 I , 0, 1 I , 2, 1 I , 1 ,1 I , 2, 1 I , 1, 3 I , 3, 2
I , 0, 1
I , 1, 1 I , 2, 1
UA
SABM
I , 1, 3
ISC
DISC
UA
UA
DISC UA and disconnect (b) Two-way data exchange RR , 4 UA k setup and disconnect
I , 3, 2 I , 2, 4 I , 3, 4 I , 2, 4 RR , 4 I , 3 , 4 RR , 4
I , 1, 3
I , 3, 2
I , 2, 4 I , 3, 4
I , 5, REJ, 4 0 B RNR, 4 , II,3, 0 J, 4 P 4, E , 0, R0 RR RN 4 RNR, 4 RR, 0, P I, R, 0 5I, 4, 0 , ,F R NR , 4 P I 0, 5 , FRR,, 6I,, 0 ,0 , 0, P RR RNR,I4 , ,6F 0 , P RR, 4, RR, 0, F (d) RR, 4, Reject recovery F R, 0, P R ,0 I, 4 RR Examples FigureReject, recovery I, 4, 0 7.9 , 4 F
I , 3, 0 A
RR , 4
Timeout recovery
of HDLC Operation
Busy condition FigureI7.90 Examples of HDLC Operation , 4, (c) Busy condition Two-way data exchange B A A B (b) Two-way data exchange condition (c) Busy Link setup,A, 0 disconnect and I , 2, 0 I 3 B A B B mn K thut my tnh I, 2 I, 3 0 71 I, 3, Khoa 4 I, Cng ngh ,thng tin RR, 3 , 0
, 0
BSC Async/Sync Half-duplex SYN SYN Characters Numerous Header, control frames Contention or polling LRC, CRC-16, CRC-12 Transmission block only Stop-and-wait WACK 1 DLE
HDLC Sync Half/Full duplex Flag Flag 1 (3 types) Header (1-2 bytes) Header CRC-CCITT Entire frame Go-back-N or selective repeat Sliding window 7 or 127 Bit stuffing 72
Ni dung
iu khin dng d liu iu khin li Mt s nghi thc iu khin lin kt d liu
Nghi thc Binary synchronous communication (BSC) Nghi thc High-level data link control (HDLC)
73
74
75
76
LCC (tt)
MAC
Cung cp a ch thit b gi v thit b nhn Pht hin li (CRC - 32)
LLC
Cung cp im truy cp ngun v ch (Destination and source access points DSAP, SSAP) Trng iu khin ging HDLC
77
Frame relay
Kh nng truyn dng d liu tc cao qua mng chuyn mch c dng thay th cho X.25 iu khin lin kt d liu dng LAPF (Link Access Procedure for Frame-Mode Bearer Services) Thc s gm 2 nghi thc
iu khin (control protocol) tng t nh HDLC Nhn (core protocol) tp con ca nghi thc iu khin
Ch h tr ch truyn ABM
B mn K thut my tnh Khoa Cng ngh thng tin
78
79
80