トランスポートレイヤ技術
TCP; Transmission Control Protocol
-(1) TCPの基本動作
(2) TCP Interactive Data Flow
(3) TCP Bulk Data Flow
(4) TCP Data Retransmission
(5) TCP Persist Timer
(6) TCP Keep Alive Timer
(7) その他・将来
ping telnet
ftp
X
traceroute
tftp bootp smtp
NFS/RPC
TCP
UDP
IP
ICMP
IGMP
インターネットアーキテクチャ
TCP : Transmission Control Protocol
-• TCP (Transmission Control Protocol) ; end-to-end
– フロー制御
– エラー制御 / 再送制御
– コネクション管理
– セッションの多重化
NetworkIP
TCP
Application
IP
IP
Application
TCP
Network Networkトランスポートレイヤ技術
TCP; Transmission Control Protocol
-(1) TCPの基本動作
(2) TCP Interactive Data Flow
(3) TCP Bulk Data Flow
(4) TCP Data Retransmission
(5) TCP Persist Timer
(6) TCP Keep Alive Timer
(7) その他・将来
TCP Header Format
0
7 8
15 16
23 24
31
source port identifier
destination port identifier
sequence number
ACK number
0
20 Bytes
Offset(4)
Rsrvd(6)
control bitsUR AK PH R T SY FN
window size
Urgent Pointer
checksum
Option
1
2
3
4
5
6
TCP Header Format
UR
: Urgent Pointer Field Significant (URG)
AK
: Acknowledgement Field Significant (ACK)
PH
: Push Function
RT
: Reset the Connection
SY
: Synchronize Sequence Numbers (SYN)
FN
: No More Data From Sender (FIN)
TCP Features
・
“Stream”
Oriented Data Transmission
→ Connection確立(Three-way-handshake)
・ Connection (“Stream”) Identifier =
“Socket”
{dst_IP_addr, dst_port, src_IP_addr, src_port}
・
“Sequence Number”
; 32 bits
→ バイト番号 : 0 − (2^32-1)
→ 2^32 でSequence NumberがWrapされる
・
“Full-Duplex”
での通信
・ Acknowledgement (ACK) ;
→ 次に受信すべきバイト番号(SN)の通知
・ エラー回復: セグメント再送(Segment retransmission)
by
Time-out, Dupilicated-ACK
・
を用いたデータ転送制御
TCP Port Allocation (RFC1700)
1. Well-Known Ports
;
0 - 1,023
2. Registered Ports
; 1,024 - 49,151
3. Dynamic and/or Private Ports ; 49,152 - 65,535
最新情報 :
TCP Well-Known Ports
Port Number Keyword
Application
5
rje
Remote Job Entry
20
ftp-data
File Transfer [Default data]
21
ftp
File Transfer [Control]
23 telnet
Telnet
25
smtp
Simple Management Protocol
39
rlp
Resource Location Protocol
53 domain
Domain
Name
Server
63
whois++
Whois++
67
bootp
Bootstrap Protocol Server
69
tftp
Trivial File Transfer
70 gopher
Gopher
79 finger
Finger
80
http
World Wide Web HTTP
TCP Well-Known Ports
Port Number Keyword
Application
123
ntp
Network Time Protocol
137
netbios-ns NetBIOS Name
Service
138
netbios-dgm
NetBIOS Datagram Service
139
netbios-ssn
NetBIOS Session Service
179 bgp
Border Gateway Protocol (BGP)
202
at-nbp
AppleTalk Name Binding Protocol
213 ipx
IPX
220
imap3
IMAP3 (Interactive Mail Access Protocol)
396
netware-ip
Novell Netware over IP
540
uucp
uucp daemon
546
dhcpv6-client DHCPv6 Client
547
dhcpv6-server DHCPv6 Server
TCP Connection確立/開放
Log on the console;
svr4% telnet bsdi discard
#
port=“9” (server discard packet)Trying 140.252.13.35
Connected to bsdi.
Escape character is ‘^]’.
^]
telnet> quit
Connection closed.
tcpdump output
1 0.0 svr4.1037 > bsdi.discard: S 14155.14155(0) win 4096 <mss 1024> 2 0.024 (0.0024) bsdi.discard > svr4.1037: S 18239.18239(0) ack 14156 win 4096 <mss 1024> 3 0.007 (0.0048) svr4.1037 > bsdi.discard: . ack 18240 win 4096 4 4.155 (4.1482) svr4.1037 > bsdi.discard: F 14156:14156(0)ack 18240 win 4096
TCP Connection確立/開放
tcpdump output
1 0.0 svr4.1037 > bsdi.discard: S 14155.14155(0) win 4096 <mss 1024> 2 0.024 (0.0024) bsdi.discard > svr4.1037: S 18239.18239(0) ack 14156 win 4096 <mss 1024> 3 0.007 (0.0048) svr4.1037 > bsdi.discard: . ack 18240 win 4096 4 4.155 (4.1482) svr4.1037 > bsdi.discard: F 14156:14156(0)ack 18240 win 4096
5 4.158 (0.0013) bsdi.discard > svr4.1037: . ack 14157 win 4096 6 4.159 (0.0014) bsdi.discard > svr4.1037: F 18240.18240(0)
ack 14157 win 4096
7 4.189 (0.0225) svr4.1037 > bsdi.discard: . ack 18241 win 4096
[意味]
source.port > destination.port : flags SN_begin.SN_end(data_size) flags : S = SYN ; Synchronize sequence_number(SN)
F = FIN ; Finish data transmission R = RST ; Reset connection
P = PSH ; push data to receiving process asap . = ; none of above four flags is on
TCP Connection確立/開放
SYN
14155.14155(0)SYN
18239.18239(0) ACK 14156 ACK 18240FIN
14156:14156(0) ACK 18240 ACK 14157FIN
18240.18240(0) ACK 14157svr4.1037 (client)
bsdi.discard(server)
segment 1 segment 2 (14155+1) “次に受信すべきSN” segment 3 (18239+1) “次に受信すべきSN” segment 4 segment 5 (14156+1) “次に受信すべきSN” segment 6TCP Connection確立/開放
svr4.1037 (client)
SYN (a)
SYN_ACK(a+1,b)
ACK(b+1)
FIN (m,s)
FIN_ACK (m+1,s)
ACK (m+1)
ACK (s+1)
“Active open”
(appli. open :
telnet
)
“open”
“Active Close”
(application close:
quit
)
“Passive Close”
(application close)
“half close”
bsdi.discard(server)
“Passive open”
“open”
EOF to Application
“half close”
CLOSED
LISTEN
ESTABLISHED
SYN_SENT
SYN_RCVD
CLOSE_WAIT
LAST_ACK
FIN_WAIT_1
CLOSING
appl: passive open
send: <nothing> appl: active open send: SYN
appl: send data send: SYN Send : RST
recvl: SYN
send: SYN, ACK
recv: SYN send: SYN,ACK (simultaneous open) recv: SYN,ACK send: ACK recv: ACK send: <nothing>
appl: close send: FI
N
appl: close send: FIN
recv: FIN
send: ACK appl: close send: FIN recv: ACK send: <nothing> appl: close or timeout recv: ACK send: <nothing> recv: FIN send: ACK recv: ACK send: <nothing> recv: FIN,ACK send: ACK simultaneous close Active open passive open Passive close
TCP Layer Interfaces
Session
情報
データ
送信
データ
受信
異常終了
指示
正常終了
指示
開始
指示
Send (Service_Type, TTL, 擬似ヘッダ)
Recieve
TCP
IP
send
receive
OPEN
SEND
RECEIVE
STATUS
ABORT
CLOSE
Session
確立
データ
送信
データ
受信
Session
廃棄
Session
開放
TCP Layer Interfaces
(1) OPEN Call :
機能 ; コネクション開始の指示
引数 ; Local_port, Destination_socket, Open_Mode(Active/Passive),
[timeout_value]、[Priority], [security], [Options]
戻り値 ; Local_Connection_Name
TCP動作 ; LISTEN(Passive_Open)、 ESTABLISHED(Active_Open)
System calls; - socket(pf, type, protocol)
- bind(socket, localaddr, adddrlen)
- connect(socket, destaddr, addrlen)
(2) SEND Call :
機能 ; データの送信指示
引数 ; Local_Connection_Name, 送信データバッファアドレス、
送信データバイト数, [PUSH], [URG], [再送タイムアウト値]
戻り値 ; なし
TCP動作 ; データ送信(ESTASBLISHED)
TCP Layer Interfaces
(3) RECEIVE Call :
機能 ; データの受信指示
引数 ; Local_Connection_Name, 受信データバッファアドレス、
受信データバイト数
戻り値 ; 受信バイト数, URG, PUSH, [受信バッファアドレス]
TCP動作 ; データ受信格納 (ESTASBLISHED)
System calls ; read(descriptor, buffer, length)
recvfrom(socket, buffer, flags, fromaddr, addlen)
recvmsg(socket, messagestruct, flags)
(4) STATUS Call :
機能 ; コネクション状態の取得を指示
引数 ; Local_Connection_Name
戻り値 ; Local_Socket, Destination_Socket, Local_Conenction_Name,
受信window_size, 送信window_size, Connection_state,
ACK待ちバッファ数, 未受信バッファ数, URG, Priority, Security,
TCP Layer Interfaces
(5) ABORT Call :
機能 ; コネクションの異常終了指示
引数 ; Local_Connection_Name
戻り値 ; なし
TCP動作 ; コネクション廃棄 (CLOSED)
(6) CLOSE Call :
機能 ; コネクションの正常終了指示
引数 ; Local_Connection_Name
戻り値 ; なし
TCP動作 ; コネクション開放 (CLOSED)
System call ; close(socket)
トランスポートレイヤ技術
TCP; Transmission Control Protocol
-(1) TCPの基本動作
(2) TCP Interactive Data Flow
(3) TCP Bulk Data Flow
(4) TCP Data Retransmission
(5) TCP Persist Timer
(6) TCP Keep Alive Timer
(7) その他・将来
TCP Interactive Data Flow
Default and Basic Procedure
-Telnet client
Telnet server
echo of data byte
data byte
ack of data byte
key-stroke “d”
to telnet server
process “d”
echo from telnet
server process “d”
echo to display
process “d”
TCP Interactive Data Flow
Delayed ACK
-Telnet client
Telnet server
data byte
ack of data byte
echo of data byte
to telnet server
process “d”
echo from telnet
server process “d”
Aggregate message
→ Delayed ACK
key-stroke “d”
echo to display
process “d”
TCP Interactive Data Flow
Delayed ACK : PiggyBack
-Telnet client
Telnet server
echo of data byte
+ ack of data byte
de
lay w
indow
de
lay w
i
data byte
ndow
echo from telnet
server process “d”
TCP Interactive Data Flow
<Client>
<Server>
date¥n (6 bytes) => Sat Feb 6 07:52:17 MST 1993¥n (30 bytes)
1 0.0 bsdi.1023 > svr4.login: P 0:1(1) ack 1 2 0.016497 (0.0165) svr4.login > bsdi.1023: P 1:2(1) ack 1 3 0.139955 (0.1235) bsdi.1023 > svr4.login: . ack 2
4 0.458037 (0.3181) bsdi.1023 > svr4.login: P 1:2(1) ack 2 5 0.474386 (0.0163) svr4.login > bsdi.1023: P 2:3(1) ack 2 6 0.539943 (0.0656) bsdi.1023 > svr4.login: . ack 3
7 0.814582 (0.2746) bsdi.1023 > svr4.login: P 2:3(1) ack 3 8 0.831108 (0.0165) svr4.login > bsdi.1023: P 3:4(1) ack 3 9 0.940112 (0.1090) bsdi.1023 > svr4.login: . ack 4
10 1.191287 (0.2512) bsdi.1023 > svr4.login: P 3:4(1) ack 4 11 1.207701 (0.0164) svr4.login > bsdi.1023: P 4:5(1) ack 4 12 1.339994 (0.1323) bsdi.1023 > svr4.login: . ack 5
13 1.680646 (0.3407) bsdi.1023 > svr4.login: P 4:5(1) ack 5 14 1.697977 (0.0173) svr4.login > bsdi.1023: P 5:7(2) ack 5 15 1.739974 (0.0420) bsdi.1023 > svr4.login: . ack 7
16 1.799841 (0.0599) svr4.login > bsdi.1023: P 7:37(30) ack 5 17 1.940176 (0.1403) bsdi.1023 > svr4.login: . ack 37
“d”
“a”
“t”
“e”
“¥n”
→“CR/LF”bsdi.1023
svr4.login
1
3
4
6
7
9
10
12
13
15
D-ACK D-ACK D-ACK D-ACK D-ACK PSH 0:1(1) ack 1 (d) PSH 1:2(1) ack 1 (echo d) ack 2 ack 3 ack 4 ack 5 ack 7 PSH 1:2(1) ack 2 (a) PSH 2:3(1) ack 2 (echo a) PSH 2:3(1) ack 3 (t) PSH 3:4(1) ack 3 (echo t) PSH 3:4(1) ack 4 (e) PSH 4:5(1) ack 4 (echo e) PSH 4:5(1) ack 5 (¥n) PSH 5:7(2) ack 5 (echo CR/LF) PSH 7:37(30) ack 5 (date内容)2
5
8
11
14
16
Delayed ACKによる
メッセージのAggregate
・ D-ACK ; 200 msec
・ Piggy-back ;
→ echo + ack
・ segment 13 ; 1 byte data
“¥n”
segment 14 ; 2 byte date
“CR/LF”
TCP Negle Algorithm
(Receiver)
data packet flow
echo & ack packet flow
(e.g., ack_of_”d” & echo “d”)
aggregate
payload
+
+
: IP (20B)
: TCP(20B)
: Data
“d”
“e”
“
¥n
”
“t”
“a”
“¥n”
“e”
“t”
“te¥n”
“Large RTT”
(Sender)
Negle Algorithm
Telnet client
Telnet server
key-stroke
(sn=1) “c”
(sn=2) “a”
(sn=3) “t”
PSH 1:2(1) ack 2
PSH 2:4(2) ack 3
PSH 2:3(1) ack 2
1
3
5
echo;
“c” (sn=2)
“at” (sn=3,4)
2
ack 2 → OK sn=1
“a”+”t” → “at”
PSH 3:5(2) ack 4
4
ack 4 → “sn=4”を期待
(sn=3まで受信)
ack 5
ack 5
→ “sn=5”を期待
(sn=4まで受信)
Disable Negle Algorithm
Telnet client
Telnet server
PSH 1:2(1) ack 2
F1 key
(sn=1) “ESC”
(sn=2) “[”
(sn=3) “M”
to telnet server
“ESC” (sn=2)
“[” (sn=3)
“M” (sn=4)
1
2
3
5
PSH 2:3(1) ack 2
PSH 3:4(1) ack 2
PSH 5:6(1) ack 4
PSH 2:5(3) ack 3
4
ack 4 → OK 1,2,3
sn=“5” → missing 2,3,4
ack 2
“^[[”
“M”
ack 2 → “^”を期待“timeout”
PSH 2:6(4) ack 4
ack 6
“^]]M”
6
ack 2 以上を受信せず ack 2以降を再送F1 key echo結果 :
“^[[M”
7
ack 6 → OK 2,3,4,5
トランスポートレイヤ技術
TCP; Transmission Control Protocol
-(1) TCPの基本動作
(2) TCP Interactive Data Flow
(3) TCP Bulk Data Flow
(4) TCP Data Retransmission
(5) TCP Persist Timer
(6) TCP Keep Alive Timer
(7) その他・将来
TCP Bulk Data Transmission
Sliding Window
-・ Window制御を用いたパケット転送
①Sliding Window (Receiver設定)
②Congestion Window(Sender設定)
(1) ACKなしにwindow数のパケットを転送
(2) ACKのAggregation(ACKパケットの減少)
(3) Receiver側によるwindow幅の制御
TCP Sliding Window
Offered window
(advertised by receiver)
Unsent window
1
2
3
4
5
6
7
8
9
10
11 …
sent and
ACKed
Can send ASAP
Can not send until
window slides
TCP Sliding Window
Sent “3” and “4”
Offered window
(advertised by receiver)
Unsent window
1
2
3
4
5
6
7
8
9
10
11 …
Can not send until window slides
Can send ASAP
sent but not ACKed
sent and ACKed
3+window=9
5+window=11
Receive ack “5”
TCP Sliding Window
Window advertise by receiver
shrink
enlarge
window
closed by
ACK reception
= ACKed SN
Opend by
ACK reception
(=ack+window)
bsdi.1023
svr4.discard
1
2
3
4
5
6
7
9
8
10
SYN 0:0(0) win4096 <mss1024>SYN 3:3(0) ack 1 win4096 <mss1024> ack 4 win4096 PSH 1:1025(1024) ack 4 win4096 PSH 1025:2049(1024) ack 4 win4096 ack 2049 win4096 PSH 3073:4097(1024) ack 4 win4096 PSH 2049:3073(1024) ack 4 win4096 ack 3073 win3072 ack 4097 win4096
11
12
13
14
15
16
PSH 4097:5121(1024) ack 4 win4096 ack 6145 win4096 PSH 7169:8193(1024) ack 4 win4096 PSH 5121:6145(1024) ack 4 win4096 ack 8193 win4096 PSH 6145:7169(1024) ack 4 win409618
FI 8193:8193(0) ack 4 win4096 ack 8194 win409617
19
・ Window制御
- window = 4096
- mss = 1024
→ 4 segments は、ACK
なしに転送可能。
・ Window Shrink ;
“7”: 4096 → 3072
(*) aggregate ACK
- “7” ← “4” & ”5”
- “10” ← “6” & “9”
- “14” ← “11” & “12”
- “16” ← “13” & “15”
bsdi.1023
svr4.discard
4
5
6
8
9
10
SYN 0:0(0) win4096 <mss1024>SYN 3:3(0) ack 1 win4096 <mss1024> ack 4 win4096 PSH 1:1025(1024) ack 4 win4096 PSH 1025:2049(1024) ack 4 win4096 ack 4097 win 0 PSH 2049:3073(1024) ack 4 win4096 ack 4097 win 4096
10
12
13
14
16
PSH 4097:5121(1024) ack 4 win4096 ack 8193 win 0 PSH 5121:6145(1024) ack 4 win4096 PSH 6145:7169(1024) ack 4 win4096 PSH 3073:4097(1024) ack 4 win4096FIN PSH 7169:8193(1024) ack 4 win4096
ack 8193 win 4096
11
15
1
2
3
・ Window shrink
- “8” : 4096 → 0
- “14” : 4096 → 0
・ Window enlarge
(= window update)
- “9” : 0 → 4096
- “15” : 0→ 4096
(*) segment “13” :
TCP Congestion Window
Offered window
(advertised by receiver)
Unsent window
1
2
3
4
5
6
7
8
9
10
11 …
Congestion window
(“cwnd”=1 )
sent and
ACKed
Shall not send ASAP
Can not send until
window slides
TCP Congestion Window
Sent “3”
Offered window
(advertised by receiver)
Unsent window
1
2
3
4
5
6
7
8
9
10
11 …
Can not send until window slides
Shall not send ASAP
Shall send without
ACK ASAP;
cwnd=2 (cwnd
←
cwnd*2)
sent and ACKed
4+window=10
TCP Congestion Window
・
Slow Start Policy
(cwnd ; exponential increase)
cwnd = 1 ;
for (
セグメント転送
)
{
for (not congestion)
{
if (
セグメント転送
ACK
受信)
{ cwnd = cnwd +1 }
cwnd = 1
}
(*)注意 : Congestion Avoidance では若干異なる。
TCP Congestion Window
advertised_window
advertised_window
congestion
cwnd
cwnd
time
time
< Congestion
経験の場合 >
< Congestion
なしの場合 >
TCP Congestion Window(1)
1
1
1
[受]
[受]
[送]
[送]
1
1
1
1
1
TCP Congestion Window(2)
2
3
2
2
3
[受]
[受]
[送]
[送]
2
3
2
3
2
3
2
3
TCP Congestion Window(3)
4
5 4
7 6 5
4
4 5
4 5 6
4 5 6 7
7 6
7
[受]
[受]
[送]
[送]
6 5 4
7 6 5 4
TCP Congestion Window(4)
9 8
8
5 6 7
12 11 10 9
13 12 11 10
14 13 12 11
15 14 13 12
8
8 9
8 9 10
[受]
[受]
[送]
[送]
10 9 8
6 7
7
11 10 9 8
bsdi.1029
svr4.discard
5
8
11
12
14
15
16
17
ack 513 win 8192 ack 3073 win 8192 FIN PSH 3585:4097(512) ack 1 win4096ack 3585 win 8192 513:1025(512) ack1 win4096 1025:1537(512) ack1 win4096 ack 1025 win 8192 1537:2049(512) ack1 win4096 2049:2561(512) ack1 win4096 ack 1537 win 8192 2561:3073(512) ack1 win4096 3037:3585(512) ack1 win4096 ack 2049 win 8192 ack 2561 win 8192 ack 4098 win 7680
2
1:513(512) ack1 win4096cwnd =1
1
cwnd =2
3
4
cwnd =3
6
7
cwnd =4
9
10
cwnd =5
cwnd =6
13
TCP Congestion Window
1. Advertised Window by Receiver
2. Congestion Window (cwnd ) defined by sender
(*) ローカルに決めることが可能な値
最適なWindow(Advertised window)サイズ
(1) 廃棄が起こらないくらいの大きさ
→ Congestion Avoidance
(2) 最適パイプライン転送
→ RTT x 帯域幅
トランスポートレイヤ技術
TCP; Transmission Control Protocol
-(1) TCPの基本動作
(2) TCP Interactive Data Flow
(3) TCP Bulk Data Flow
(4) TCP Data Retransmission
(5) TCP Persist Timer
(6) TCP Keep Alive Timer
(7) その他・将来
TCP Data Retransmission
(1) Expire of Retransmission Timeout
(RTO) Value
- RTO calculation using RTT
- Exponential Back-off (Max. 64 sec.)
(2) Reception of Duplicated ACK
- Fast Retransmission / Fast Recovery
(3) Congestion Window (cwnd ) Control
bsdi.1023
svr4.discard
RTO Expired Retransmission
SYN 3:3(0) ack 1 win4096 <mss1024>ack 4 win4096 PSH 1:15(14) ack 4 win4096 PSH 15:23(8) ack 4 win4096 ack 15 win 4096 PSH 15:23(8) ack 4 win4096 PSH 15:23(8) ack 4 win4096 PSH 15:23(8) ack 4 win4096 PSH 15:23(8) ack 4 win4096
6
7
8
9
17
SYN 0:0(0) win4096 <mss1024>1
2
3
再送トライ (RTO; 再送タイマ)
RTO = 1.5 sec /* 変更可能*/
for ( 9 minutes)
{
if ( RTO expired)
{
retransmission;
RTO=RTO x 2;
RTO=min{64sec, RTO};
}
}
end /* 諦める */
4
5
再送間隔
1.5 sec
3 sec
6 sec
64 sec
RTO Expired Retransmission
1
0.0
bsdi.1029 > svr4.discard: S 1:1(0)
win 4096 <mss 1024>
2
0.0048 ( 0.0048) svr4.discard > bsdi.1029: S 4:4(0) ack 2
3
0.0064 ( 0.0016) bsdi.1029 > svr4.discard: . ack 5
4
6.1022 ( 6.0958) bsdi.1029 > svr4.discard: P 1:15(14) ack 5
5
6.2594 ( 0.1571) svr4.discard > bsdi.1029: . ack 15 win
6
24.4801 (18.2207) bsdi.1029 > svr4.discard: P 15:23(8) ack 5
7
25.4937 ( 1.0136) bsdi.1029 > svr4.discard: P 15:23(8) ack 5
8
28.4937 ( 3.0001) bsdi.1029 > svr4.discard: P 15:23(8) ack 5
9
34.4937 ( 6.0002) bsdi.1029 > svr4.discard: P 15:23(8) ack 5
10
46.4844 (11.9905) bsdi.1029 > svr4.discard: P 15:23(8) ack 5
11
70.4851 (24.0007) bsdi.1029 > svr4.disacrd: P 15:23(8) ack 5
12 118.4864 (48.0013) bsdi.1029 > svr4.discard: P 15:23(8) ack 5
13 182.4881 (64.0018) bsdi.1029 > svr4.discard: P 15:23(8) ack 5
14 246.4899 (64.0018) bsdi.1029 > svr4.discard: P 15:28(8) ack 5
15 310.4910 (63.9917) bsdi.1029 > svr4.discard: P 15:23(8) ack 5
RTO Expired Retransmission
RTO Exponential BackOff
-64 sec
32 sec
16 sec
面積(S)
If (S ≦ 9 minutes)
{
continue;
}
else
{
abort;
}
RTO
48 sec
0 1 2 3 4 5 6 7 8 9 10 11
Timeout and Retransmission
RTO (Retransmission TimeOut)
(1) 古い計算方法 ; RTTの変動に弱い
- RTO = 2 x RTT
where RTT = α・RTT
p
+ (1-α)・RTT
M
= 0.9xRTT
p
+ 0.1xRTT
M
(2) 最近の計算方法 ; 平均偏差の利用
- RTO = 平均RTT + 4 x 平均偏差
Retransmission by Duplicated ACK
(2) Reception of Duplicated ACK
- Fast Retransmission / Fast Recovery
Segment廃棄特性 ;
→ “single (or few) segment(S)” あるい
は連続多数。
→ 未ACKの同一ACK Segmentsを
複数(3回)受信したら、再送。
Fast Retransmission by Duplicated ACK
6401:6657(256) ack1
6657:6913(256) ack1
6913:7169(256) ack1
8193:8449(256) ack1
6657:6913(256) ack1
“Fast Retransmission”
ack 5889
ack 6145
ack 6401
7169:7425(256) ack1
ack 6657
7425:7681(256) ack1
ack 6657
①
7681:7937(256) ack1
ack 6657
②
7937:8193
(
256) ack1
ack 6657
③
ack 6657
ack 6657
ack 6657
ack 8449 win5888
8449:8705(256) ack1
Congestion Window Control
[目的]
cwndの大きな振動を防ぎ、
適切なcwndで運用する
[1] cwndの制御
(i) ssthresh以下のcwndサイズ
→ Exponential increase
(slow start)
(ii) ssthresh以上のcwndサイズ
→ Liner increase
(congestion avoidance)
[2] ssthreshの制御
(i) Timeout ; goto “1”
cwnd=1;
ssthresh=65KB;
for ()
{
if (“Timeout”)
{ cwnd=1;
ssthresh = cwnd/2;
}
if (“duplicated ACK”)
{ ssthresh=cwnd / 2;
cwnd=ssthresh;
}
if (cwnd
≦
ssthresh)
{ slow_start;
/* exponential */
}
else
{ congestion_avoidance;
/* liner */
}
}
Congestion Window Control (続)
・ ICMP 制御メッセージ
(1) ICMP Source Quench
→ cwnd = 1 ;
ssthresh = as is ;
(2) Host unreachable
Congestion
avoidance
slow-start
Congestion
avoidance
Congestion
avoidance
slow-start
“ssthresh”
(cwnd_
1)
/ 2
(c
wnd_3
) /
2
cwdn_1
Target
cnwd
cwdn_3
cwnd
トランスポートレイヤ技術
TCP; Transmission Control Protocol
-(1) TCPの基本動作
(2) TCP Interactive Data Flow
(3) TCP Bulk Data Flow
(4) TCP Data Retransmission
(5) TCP Persist Timer
(6) TCP Keep Alive Timer
(7) その他・将来
TCP Persist Timer
[機能]
Advertised window size = “0” でも
1 Byte のデータは送信できるように
する。
[目的]
window=“0”時の デッドロックの回避。
受信側プロセスの生存確認
[Timer値制御]
TCP Persist Timer
1 bsdi.1027 > svr4.5555: P 1:1025(1024) ack 1 win 4906 2 ( 0.1920) svr4.5555 > bsdi.1027: . ack 1025 win 4906
3 ( 0.0050) bsdi.1027 > svr4.5555: . 1025:2049(1024) ack 1 win 4096 4 ( 0.0034) bsdi.1027 > svr4.5555: . 2049:3073(1024) ack 1 win 4096 5 ( 0.0072) svr4.5555 > bsdi.1027: . ack 3073 win 4096
6 ( 0.0052) bsdi.1027 > svr4.5555: . 3073:4097(1024) ack 1 win 4096 7 ( 0.0034) bsdi.1027 > svr4.5555: P 4097:5121(1024) ack 1 win 4096 8 ( 0.0039) bsdi.1027 > svr4.5555: P 5121:6145(1024) ack 1 win 4096 9 ( 0.0079) svr4.5555 > bsdi.1027: . ack 5121 win 4096
10 ( 0.0051) bsdi.1027 > svr4.5555: P 6145:7169(1024) ack 1 win 4096 11 ( 0.0040) bsdi.1027 > svr4.5555: P 7169:8193(1024) ack 1 win 4096 12 ( 0.0039) bsdi.1027 > svr4.5555: P 8193:9217(1027) ack 1 win 4096 13 ( 0.1612) svr4.5555 > bsdi.1027: . ack 9217 win 0
14 ( 4.9494) bsdi.1027 > svr4.5555: . 9217:9218(1) ack 1 win 4096 15 ( 0.0040) svr4.5555 > bsdi.1027: . ack 9217 win 0
16 ( 4.9961) bsdi.1027 > svr4.5555: . 9218:9219(1) ack 1 win 4096 17 ( 0.0040) svr4.5555 > bsdi.1027: . ack 9218 win 0
18 ( 5.9962) bsdi.1027 > svr4.5555: . 9219:9220(1) ack 1 win 4096 19 ( 0.0040) svr4.5555 > bsdi.1027: . ack 9219 win 0
トランスポートレイヤ技術
TCP; Transmission Control Protocol
-(1) TCPの基本動作
(2) TCP Interactive Data Flow
(3) TCP Bulk Data Flow
(4) TCP Data Retransmission
(5) TCP Persist Timer
(6) TCP Keep Alive Timer
Keep Alive Timer
[目的] ; プロセスダウンへの対応
(*) TCPコネクションの終了条件
(i) 明示的終了 (FIN segment)
(ii) プロセスのダウン
[機能] ; TCPコネクションの生存確認
- 2時間ごとにprobe
- 10回(75秒間隔でprobe送信)応答なし
TCP Keepalive Timer
1 bsdi.1055 > svr4.echo: P 1:14(13) ack 1 2 ( 0.0061) svr4.echo > bsdi.1055: P 1:14(13) ack 14 3 ( 0.0087) bsdi.1055 > svr4.echo: . ack 14
4 (7199.8797) arp who-has svr4 tell bsdi
5 ( 0.0021) arp reply svr4 is-at 0:0:c0:c2:9b:26 6 ( 0.0009) bsdi.1055 > svr4.echo: . ack 14
7 ( 0.0041) svr4.echo > bsdi.1055: . ack 14 8 (7200.1545) arp who-has svr4 tell bsdi
9 ( 0.0021) arp reply svr4 is-at 0:0:c0:c2:9b:26 10 ( 0.0009) bsdi.1055 > svr4.echo: . ack 14
11 ( 0.0040) svr4.echo > bsdi.1055: . ack 14
12 (7200.1769) arp who-has svr4 tell bsdi ① 13 ( 75.0021) arp who-has svr4 tell bsdi ② 14 ( 75.0020) arp who-has svr4 tell bsdi ③ 15 ( 75.0021) arp who-has svr4 tell bsdi ④ 16 ( 75.1123) arp who-has svr4 tell bsdi ⑤ 17 ( 75.0021) arp who-has svr4 tell bsdi ⑥ 18 ( 75.0020) arp who-has svr4 tell bsdi ⑦ 19 ( 74.9920) arp who-has svr4 tell bsdi ⑧ 20 ( 75.0018) arp who-has svr4 tell bsdi ⑨
トランスポートレイヤ技術
TCP; Transmission Control Protocol
-(1) TCPの基本動作
(2) TCP Interactive Data Flow
(3) TCP Bulk Data Flow
(4) TCP Data Retransmission
(5) TCP Persist Timer
(6) TCP Keep Alive Timer
トランスポートレイヤ技術
その他・将来
-(1) Silly Window Syndrome
(2) MTU Discovery
(3) Window scaling for long fat-pipe
(4) T/TCP (Transaction TCP)
(5) Rate Control
Path MTU Discovery
[目的]
経路上でフラグメントされない最大のセグメン
トサイズ(Path MTU)の検索
[方法]
ICMPエラーメッセージの利用
(DF; Don’t Fragment オプション)
[頻度]
1 (0.0 ) solaris.33016 > slip.discard: S 1:1(0) win 8760 <mss 1460> (DF) 2 (0.1016) slip.discard > solaris.33016: S 1:1(0) ack 1
win 4096 <mss 512>
3 (0.5290) solaris.33016 > slip.discard: P 1:513(512) ack 1 win 4096 <mss 512>
4 (0.0038) bsdi > solaris: icmp: slip unreachable - need to frag, mtu = 296 (DF)
5 (0.0259) solaris.33016 > slip.discard: F 513:513(0) ack 1 win 9216 (DF)
6 (0.0923) slip.discard > solaris.33016: . ack 1 win 4096 7 (0.3577) solaris.33016 > slip.discard: P 1:257(256) ack 1
win 9216 (DF)
8 (0.3290) slip.doscard > solaris.33016: . ack 257 win 3840 9 (0.3308) solaris.33016 > slip.discard: FP 257:513(256) ack 1
win 9216 (DF) 10 (0.3208) slip.discard > solaris.33016: . ack win 3840
11 (0.0422) slip.discard > solaris.33016: F 1:1(0) ack 514 win4096 12 (0.1719) slip.discard > splaris.33016: . ack 2 win 9216 (DF)
<mss 1460>
<mss 296>
Window Scaling for Long Fat Pipe
RFC1323
-Network Bandwidth(bps)
RTT(ms)
BWxRTT(B)
Ethernet
10.000 M
3
3,750
T1(大陸間)
1.544 M
60
11,580
T1(衛星)
1,544 M
500
96,500
T3(大陸間)
45,000 M
60 337,500
OC12(大陸間)
2,400,000 M
60
7,500,000
・ Max. Window Size ; 2^(16) Bytes = 64KB
→ Window Scaling ; “wscale”
Window Scaling for Long Fat Pipe
1 vangogh.4107 > bsdi.echo: S 1:1(0) win 65535<mss 512, nop, wscale 1, nop, nop, timestamp, 995351>
2 ( 0.0031) bsdi.echo > vangogh.4107: S 1:1(0) ack 1 win 4906 <mss 512> 3 ( 0.2972) vangogh.4107 > bsdi.echo: . ack 1 win 65535
4 (16.6198) vangogh.4107 > bsdi.echo: P 1:14(13) ack 1 win 65535 5 ( 0.0030) bsdi.echo > vangogh.4107: P 1:14(13) ack 14 win 4096 6 ( 0.2971) vangogh.4107 > bsdi.echo: . ack 14 win 65535
7 ( 9.4202) vangogh.4107 > bsdi.echo: F 14:14(0) ack 14 win 65535 8 ( 0.0024) bsdi.echo > vangogh.4107: . ack 15 win 4096
9 ( 0.0013) bsdi.echo > vangogh.4107: F 14:14(0) ack 15 win 4096 10 ( 0.2363) vangogh.4107 > bsdi.echo: . ack 15 win 65535
11 (17.5200) vangogh.4107 > bsdi.echo: S 1:1(0) win 65535
<mss 512, nop, wscale 2, nop, nop, timestamp 995440>
12 ( 0.0031) bsdi.echo > vangogh.4107: S 1:1(0) ack 1 win 4096 <mss 512> 13 ( 0.2967) vangogh.4107 > bsdi.echo: . ack 1 win 65535
nop; no operation
RFC 1379 ; T/TCP
Transaction TCP
-[目的]
TCPコネクションの確立・開放手続きの
速度アップ
[方法]
・ CC (Connection Count) Option
・ SYNへのPiggy-back ; “half-synchronization”
(1) SYN, Data, FIN, CC
(2) SYN, SYN-ACK, Data, FIN, FIN-ACK,
CC, CC-Echo
RFC 1379 ; T/TCP
Server
Client
SYN (a)
SYN_ACK(a+1,b)
ACK(b+1)
FIN (m,s)
FIN_ACK (m+1,s)
ACK (m+1)
ACK (s+1)
Data (a+2)
Data_ACK(a+2,b+1)
Server
Client
SYN,Data,FIN,CC
SYN,S-ack,Data,
F,F-ack
FIN-ACK
9 セグメント
→ 3 セグメント
TCPレート制御
Destination
Node 1
Source
Node 1
Window
制御
Rate
制御
Shaped Transmission with Window Line Speed
TCPレート制御
Window
制御
Line Speed with WindowWind
ow
帯
パケット廃棄 平 均転送 速度 パケット廃棄 ピ ー ク転 送速度 パケット廃棄Rate
制御
Shaped Transmission with Window