Upload
alina-flynn
View
243
Download
0
Embed Size (px)
Citation preview
TCP/IPTCP/IP
경북대학교 이동통신망 연구실2
Layering in a TCP/IP Internet Environment
Application
Transport
NetworkInterface
Internet
Application
Transport
NetworkInterface
Internet
Host AHost A Host BHost B
Internet
NetworkInterface
Physical Net 1
Router RRouter R
identicalmessage
identicalpacket
identicaldatagram
identicalframe
identicaldatagram
identicalframe
Physical Net 1
경북대학교 이동통신망 연구실3
Two Boundaries in the TCP/IP Model High-level protocol address boundary
Application programs as well as all protocol s/w from the Internet layer upward use only IP addresses; the network interface layer handles physical addresses
Operating system boundary
Software outside the operating systemApplication
Transport
Internet
Network Interface
Conceptual LayerConceptual Layer
Hardware
BoundaryBoundary
Software inside the operating system
Only IP addresses used
Physical addresses usedHigh-level protocol address boundary
Operating Systemboundary
경북대학교 이동통신망 연구실4
TCP/IP LayeringTCP/IP LayeringUser
ProcessUser
ProcessUser
ProcessUser
Process
TCP UDP
ICMP IP
ARP HardwareInterface
IGMP
RARP
application
transport
network
link
media
경북대학교 이동통신망 연구실5
EncapsulationEncapsulation
Application
TCP
Application
Ethernetdriver
IP
Ethernet
Application
TCP
Application
Ethernetdriver
IP
User data
User dataApplheader
Application dataTCP
header
Application dataTCP
headerIP
header
Application dataTCP
headerIP
headerEthernet
trailerEthernetheader Application data
TCPheader
IPheader
Ethernettrailer
Ethernetheader
Application data
Application dataTCP
header
User dataAppl
header User data
TCP (Transmission Control Protocol)
TCP (Transmission Control Protocol)
경북대학교 이동통신망 연구실7
TCP three-way handshakeTCP three-way handshake
Connection Request (SYN=1, seq=client_isn)
ACK(SYN=0, seq=client_isn+1, ack=server_isn+1)
Connection Response (SYN=1, seq=server_isn,
ack=client_isn)
Connection Establish
경북대학교 이동통신망 연구실8
TCP three-way handshakeTCP three-way handshake Connection Termination
FIN
ACK
FIN
ACK
Close
Close
Closed
Timed
wait
경북대학교 이동통신망 연구실9
TCP Segment FormatTCP Segment Format
SOURCE PORT DESTINATION PORT
SEQUENCE NUMBER
ACKNOWLEDGEMENT NUMBER
WINDOWHLEN RESERVEDCODE BITS
URGENT POINTERCHECKSUM
OPTIONS (IF ANY) PADDING
DATA
. . .
0 4 10 16 24 31
SOURCE PORT DESTINATION PORTSOURCE PORT
Identify the sending and receiving application
SEQUENCE NUMBERSEQUENCE NUMBER
ACKNOWLEDGEMENT NUMBERACKNOWLEDGEMENT NUMBER
HLEN
The length of the header in 32-bit words
CODE BITS
URG The urgent pointer is validACK The acknowledgment number is validPSH The receiver should pass this data to the application as soon as possibleRST Reset the connectionSYN Synchronize sequence numbers to initiate a connection FIN The sender is finished sending data
WINDOW
The number of bytes, starting with the one specified by the acknowledgmnet number field, that the receiver is willing to accept
CHECKSUM
This is a mandatory filed that must be calculated and stored by the sender and than verified by the reciever
URGENT POINTER
Valid only if the URG flag is set
Contains the next sequence number that the sender of the acknowledgment expects to receive
Identifies the byte in the stream of data from the sending TCP to the receiving TCP that the first byte of data in this segment represents
경북대학교 이동통신망 연구실10
Sliding windowsSliding windows
1 2 3 4 5 6 7 8 9 10 11 …
Offered window
(advertised by receiver)
Usable window
Sent andacknowledged
Sent, not ACKedCan send ASAP Window moves
Can’t send until
1 1024 1025 20482049 30723073 40964097 51205121 61446145 71687169 8192
Window advertised by segment2
Data sent inSegments 4, 5, 6
Window advertised by segment7ACKed bySegments 7
Data sent inSegments 11,12,13
Window advertised by segment10ACKed by
Segment 10Data sent
inSegments 9
Window ∼ segment8ACKed by
Segment 8ACKed by
Segments 14Window ∼ segment14
Data sent inSegments 15
경북대학교 이동통신망 연구실11
Congestion ControlCongestion Control
Transmissionrate adjustment
Transmissionnetwork
Small-capacityreceiver
Large-capacityreceiver
Internalcongestion
Congestion: a condition of severe delay caused by an overload of datagrams at one or more switching point (e.g., at routers) When the sum of the connection rates over a link is higher than the link’s rate segments can be dropped
경북대학교 이동통신망 연구실12
Congestion ControlCongestion Control To avoid congestion collapse, TCP must reduce transmission rates when congestion occurs Routers watch queue lengths and use techniques ICMP source quench to inform host that congestion has occurred TCP uses packet drops and timeout as congestion indication To avoid congestion in advance, the sender must adapt its transmission window to the available link bandwidth TCP connection’s rate is determined as transmission window/round trip time
경북대학교 이동통신망 연구실13
Flow ControlFlow Control TCP views the data stream as a sequence of octets that it divides into segments for transmission TCP uses a sliding window mechanism to adjust the sender’s transmission speed to that of the receiver The sliding window permits the sending of multiple segments before waiting for an ACK -> efficient transmission ACK segments indicate the last correctly received byte and the number of bytes the receiver is still willing to accept A sender keeps three pointers associated with every connection
1 2 3 4 5 6 7 8 9 10 11 . . .
current window
경북대학교 이동통신망 연구실14
Flow ControlFlow Control TCP allows the window size to vary over time ACK contains a window advertisement that specifies how many additional octets of data the receiver is prepared to accept (receiver’s buffer size) In response to an increased(decreased) window advertisement, the sender increases(decreases) the size of its sliding window Variable size window provides flow control as well as reliable transfer Flow control mechanism is essential in Internet environment, where machines of various speeds and sizes communicate through networks and routers of various speed and capacities
End-to-end flow control: sliding window scheme Congestion control: no explicit mechanism, implementation dependent
경북대학교 이동통신망 연구실15
A B
cwnd=1
cwnd=2
cwnd=3cwnd=4
cwnd=5cwnd=6
cwnd=8cwnd=7
cwnd=9
cwnd=16
Slow StartSlow Start
A B
cwnd=1
cwnd=2
cwnd=3cwnd=4
cwnd=5cwnd=6
cwnd=8cwnd=7
cwnd=9
cwnd=16
20
15
0
10
1 2 3 4
5
...
.
.
CWND/rtt
If CWND is less than or equal to SSTHRESTH : Slow start Slow start dictates that CWND start at one segment, and be incremented by one segment every time an ACK
is received
A B
cwnd=1
cwnd=2
cwnd=3cwnd=4
cwnd=5cwnd=6
cwnd=8cwnd=7
cwnd=9
cwnd=16
A B
cwnd=1
cwnd=2
cwnd=3cwnd=4
cwnd=5cwnd=6
cwnd=8cwnd=7
cwnd=9
cwnd=16
경북대학교 이동통신망 연구실16
CWNDCWND
If (cwnd >= ssthreshod) When Ack is received, Cwnd = cwnd+(1/cwnd)
The linear increase of CWND
Round-trip time
Cw
nd s
eg
men
t20
15
0
10
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
5
...
.
.
. .
.
.ssthreshold
.
. . . . . . .Time out occurs
Congestion avoidance
경북대학교 이동통신망 연구실17
Congestion control & AvoidanceCongestion control & Avoidance
Con
gesti
on
win
dow Slow startSlow start
ssthresh
time
Cwnd = ssthres + 3 * segment
Next ack arrivesthat acknowledgesnew segment
Fast recoveryFast recovery
Cwnd/2
[additive increase & multiplicative decrease]
Fast retransmit !
Congestion Congestion avoidanceavoidance
경북대학교 이동통신망 연구실18
Congestion control & AvoidanceCongestion control & Avoidance
Con
gesti
on
win
dow
Slow startSlow start
ssthresh
Congestion Congestion avoidanceavoidance
Cwnd = 1, Ssthresh = current window size / 2
timeoutSlow startSlow start
time
[Fast retransmit & fast recovery]
Timeout occurBy congestion!
Congestion Congestion avoidanceavoidance
경북대학교 이동통신망 연구실19
Congestion control & AvoidanceCongestion control & Avoidance
Congestion window
Slow start
ssthresh
time
ssthresh
Fast retransmit !Cwnd = ssthres + 3 * segment
Next ack arrivesthat acknowledgesnew segment
Fast recovery
Cwnd/2
Congestion window
Slow start
ssthreshCongesti
on avoidanc
e
Timeout occurBy congestion!Then,Cwnd = 1Ssthresh = current window size / 2
timeout
Slow startCongestion avoidance
time
[additive increase & multiplicative decrease] [Fast retransmit & fast recovery]
경북대학교 이동통신망 연구실20
Fast RetransmitFast Retransmit
duplicate ACK The purpose is to let the other
end know that a segment was received out of order, and to tell it what sequence number is expected
A BF1F2
A1
A10
D u p lica te A ck 1
D u p lica te A ck 3
D u p lica te A ck 2
F3
F5
F4
F6
F7
F8
F9
A1
A1
A1
F10
F2
A1
A1
A1
A1
F11
F14
A1
F12
A11
A12
A13
to a p p l (F 1 )
to a p p l (F 2 -F 1 0 )
to a p p l
to a p p l
to a p p l
(F 1 1 )
(F 1 2 )
(F 1 3 )
sa v e to b u ffer
F13
Fast Retransmission
When the third duplicate ACK is received- ssthresh : one-half of the minimum of the cwnd and the receiver’s advertised window- retransmit the missing segment- cwnd : ssthresh +3*the segment size
경북대학교 이동통신망 연구실21
Fast RecoveryFast Recovery
Fast recovery -governs the re-transmission of new data until non-duplicate ACKs are received - When 3 duplicate ACKs are received ssthresh = max (FlightSize/2,2*SMSS) - Re-transmit the lost segment and CWND = SSTHRESH + 3 * SMSS - For each duplicate ACK, CWND += SMSS - Transmit a segment if allowed by the values of CWND and RWND When a non-duplicate ACK arrives, CWND = SSTHRESH
Fast recovery
Packet loss
W
W/2
1st FastRetransmission
TimeoutCWNDInflate
W/4
2nd FastRetransmission
Wait forTimeout
Window Size
IP (Internet Protocol)
IP (Internet Protocol)
경북대학교 이동통신망 연구실23
IP Service ModelIP Service Model
Datagram: each packet is independent of all others
Best effort: packet may arrive or not after some time
Internet architecture and philosophy
Application Services
Reliable Transport Service
Connectionless Packet Delivery
Service
경북대학교 이동통신망 연구실24
IP Service Model A user thinks of an internet as a single
virtual network that interconnects all hosts, and through which communication is possible; its underlying architecture is both hidden and irrelevant
IP packet delivery service Unreliable: lost, duplicated, delayed, or
delivered out of order Best-effort Connectionless
IP protocol provides three important definitions Basic unit of data transfer Routing function A set of rules that embody the idea of unreliable
packet delivery
경북대학교 이동통신망 연구실25
IP Datagram FormatIP Datagram Format
VERSION TOTAL LENGTH
IDENTIFICATION
SOURCE IP ADDRESS
data
0 16 31HEADERLENGTH TOS
FRAGMENT OFFSETFLAGS
HEADER CHECKSUMPROTOCOLTTL
DESTINATION IP ADDRESS
OPTIONS
경북대학교 이동통신망 연구실26
Fragmentation Datagram Size, Network MTU, and Fragmentation
MTU: fixed upper bound on the amount data that can be transferred in one physical frame
e.g.) Ethernet: 1500 octets, FDDI: 4470 octets It is efficient to select a maximum datagram size such that a datagram would al
ways fit into one frame But, a datagram may travel across many types of physical networks Limiting datagrams to fit the smallest possible MTU in the internet --> inefficient
transmission Fragmentation: dividing large datagrams into smaller pieces when the datagram
needs to traverse a network that has a small MTU Fragments must be reassembled at the destination If any fragments are lost, the datagram cannot be reassembled. cf) reassembly
timer Fragmentation control
IDENTIFICATION FLAGS: Don’t Fragment bit, More Fragments bit, FRAGMENT OFFSET
경북대학교 이동통신망 연구실27
Fragmentation (cont.)
Example
HostA
MTU=1500
R1Net 2
MTU=620R2
Net 3Net 1
HostB
MTU=1500
경북대학교 이동통신망 연구실28
Fragmentation (cont.)Fragmentation (cont.)
DatagramHeader
data1600 octets
data2600 octets
data3200 octets
Fragment 1Header
data1 Fragment 1 (offset 0)
Fragment 3 (offset 1200)
Fragment 2 (offset 600)Fragment 2Header
data2
Fragment 3Header
data3
경북대학교 이동통신망 연구실29
Internet Datagram Options Included primary for network testing or debugging Option code (1 octet)
Option length (1 octet) Data (variable) Record route option Source route option
Strict source routing Loose source routing
Time stamp option (Rarely used <-> not all routes support them)
COPY OPTION CLASS OPTION NUMBER
0 1 2 3 4 5 6 7
경북대학교 이동통신망 연구실30
IP Record Route OptionIP Record Route Option
Source creates empty list of <= 9 IP addresses
Option: length, pointer, list of IP addresses
Routers note outgoing interface in list
경북대학교 이동통신망 연구실31
IP Source Route OptionsIP Source Route Options Source determines path taken by
packets(<= 9 hops) Loose: any number of hops between Strict: every hop; if not directly connected,
discard Same format as record route option route overwrites with address of outgoing
interface Must be copied to fragments Destination should reverse route for return
address Not too popular => degrade router
performance
New TCPNew TCP
경북대학교 이동통신망 연구실33
1. Tahoe1. Tahoe
Time-out 또는 duplicate Ack 가 3 개 수신된 경우 ,
ssthreshold = cwnd/2 cwnd = 1(dup ack 3 개 수신시 fast retr
ansmission 수행 ) 정상적인 Ack 인 경우
cwnd < ssthreshold, cwnd = cwnd + 1 : Slow Start 단계
그밖의 경우 , cwnd = cwnd + 1/cwnd : 혼잡회피 단계
W
W /2
S lowS ta r t
W a it for T im eout
T im eout
S lowS ta r t
C ong estionA v oid a nce
W ind ow S ize 패 킷 손 실
Fast retransmission
Duplicate ack 3 개 수신시
Fast recovery 과정이 없다 .
Slow start, Congestion avoidance, Fast retransmission
경북대학교 이동통신망 연구실34
W
W /2
1 st F a stR etra n sm iss io n
T im eo u tC W N DIn fla te
W /4
2 n d F a stR etra n sm iss io n
W a it fo rT im eo u t
W in d o w S ize
Ack 도달패킷손실
Fast recovery
2. Reno2. Reno
Duplicate Ack 가 3 개 수신된 경우 , fast retransmission, cwnd=ssthr
esh+3(ssthresh = cwnd/2), fast recovery, cwnd = ssthreshol
d - slow start 를 수행하지 않음 Time-out 시
ssthreshold = cwnd/2, cwnd =1(slow start 수행 )
정상적인 Ack 인 경우 cwnd < ssthreshold, cwnd = cwnd
+ 1 : Slow Start 단계 cwnd = cwnd + 1/cwnd :
혼잡회피 단계
Tahoe + fast recovery
송신기 정지
경북대학교 이동통신망 연구실35
W
W /2
1 st F a stR etra nsm iss ion
W /4
R ece iv e P a rtia l A C K .2 nd F a st R etra nsm iss ion
T im e
W ind ow S ize
R ece iv e P a rtia l A C K .3 rd F a st R etra nsm iss ion
R ece iv e N ew A C K .F a st R ecov ery
Æ Ð Å ¶ ¼ Õ ½ Ç
3. New Reno
• 한 윈도우 내에서 다수의 패킷손실이 발생할 때 , 송신기의 재전송 타이머가 종료될 때까지 , 송신기가 정지되는 문제를 해결한 알고리즘 .• Duplicate Ack 가 3 개 수신된 경우 ,
fast retransmission, cwnd=ssthresh+3(ssthresh = cwnd/2),fast recovery, duplicate ack 없이 RTT마다 손실된 패킷을 전송 , cwnd = ssthreshold - congestion avoidance 수행 .
• Time-out 시ssthreshold = cwnd/2, cwnd =1(slow start 수행 )
• Partial ack : 송신기가 손실된 패킷을 재전송하여 수신기에 수신되어 발생된 ack로 cwnd 의 크기를 변화시키지 않으며 fast recovery 를 유지한다 .
Tahoe + fast recovery
경북대학교 이동통신망 연구실36
4. Vegas
Reno + new slow start
new congestion avoidance new retransmission modified timeout
( 정교한 time tick 사용 )
40-70% 의 throughput 개선 , 1/2-1/5 의 loss 감소
경북대학교 이동통신망 연구실37
5. Vegas 의 주요 특징 new slow start : rtt 마다 기존의 방식을 따르되 , expected rate 가 실제 전송율에 비해 특정값보다 크면 ssthresh 와 무관하게 congestion avoidance 수행 . new retransmission : 1st duplcate 수신시 , rtt 값이 타임아웃값보다 크면 재전송 수행 . new congestion avoidance : 예측한 전송율을 기준으로 측한 전송율을 기준으로
실제 측정한 전송율이 크 면 윈도우를 증가시키고 , 실제 측정한 전송율이 작으면 윈도우를 감소시킴으로써 망의 혼잡을 피하여 패킷손실을 줄일 수 있다 .
Diff=expected rate-actual rate
Diff< : 윈도우 증가Diff> : 윈도우 감소
<Diff< : 윈도우 변화 무
여기서 , expected rate=window size/baseRTT
경북대학교 이동통신망 연구실38
6. SACK (Selective Ack) 6. SACK (Selective Ack)
한 윈도우 내에서 다수의 패킷손실이 발생한 상황에서
한 RTT 내에서 손실패킷을 전부 재전송 하는 알고리즘 .
SACK Option 으로 수신한 패킷상태를 송신기에게 알리고 , 송신기는 손실된 패킷만을 재전송하므로 타임아웃의 발생확률이 적다 .
Sack permitted( 송신기 ) Sack option( 수신기 )
W
W /2
R etra nsm it M ultip leS eq m ents
T im e
W ind ow S ize
F a stR ecov ery
패 킷 손 실
C ong estionA v oid a nce
SS, Fast recovery, multiple Retransmission, Congestion avoidance
경북대학교 이동통신망 연구실39
Characteristics of Wireless MediaCharacteristics of Wireless Media Channel Losses Low Bandwidth Signal Fading Movement across Cells Channel Asymmetry Link Latency
경북대학교 이동통신망 연구실40
Selective AcknowledgmentsSelective Acknowledgments receiver informs sender of contiguous and isolated
blocks of data that have been successfully received and queued
Receiver’s Buffer
300-399
200-299
300-399
ACK 200 SACK 300-400100-199
100 -199
ACK
200
400 -499
ACK 200 SACK 500-600,300-400 100-199 300-399
sen
der
recei
ver
500-599
100-199
300-399
경북대학교 이동통신망 연구실41
SMART RetransmissionSMART Retransmission
Build bitmask at sender Receiver sends both cumulative ack and packet
that caused ack
(6,6) (6,8) (6,10)
Send 7 Send 9
1 2 3 4 5 6 7 8 9 10 11 12
경북대학교 이동통신망 연구실42
TCP-ProbingTCP-Probing Three distinct tactics in response
to the error detected Slow Start (for congestion detect
ed by timeout) Fast Recovery (for moderated con
gestion detected by three duplicated acks)
Immediate Recovery (for congestion-free path): more effective than Reno and Tahoe when the sending window is not too small.
ESTAB
PR1_SENT PR2_SENT
PR1_RCVD
3 Dack or Timeout
Timeout
PR1_ACK
PR2_ACK
Probe Timeout
PROBE1 PROBE2
Probing State Transition Diagram
경북대학교 이동통신망 연구실43
Negative AcknowledgmentsNegative Acknowledgments Negative ACKs
in the options field of TCP header Explicitly indicate which packet has been received in
error The sender can retransmit the packet without modifyi
ng the congestion window size
경북대학교 이동통신망 연구실44
ACK pacingACK pacing The goal of pacing
to evenly spread the transmission of a window of packets across the entire duration of the round trip time.
A rate based approach to ACK generation at the receiver. Advantage vs drawbacks
Avoid bursty traffic Not distinguish between
congestion losses and wireless losses
Delayed congestion signal Queue situation
경북대학교 이동통신망 연구실45
Explicit Bad State Notification Explicit Bad State Notification Sending EBSN messages whenever
the base station is unsuccessful in transmitting a packet over the wireless network
Not pure End-to-end
TCP ReceiverTCP Sender Base Station
EBSN
Reset restart the TCP timer
something is wrong in
wireless link~!!!
Local recovery
경북대학교 이동통신망 연구실46
Explicit Loss Notification StrategiesExplicit Loss Notification Strategies Not pure End-to-end A base station
Monitoring TCP packets in either direction. Set ELN bit, to inform the sender that the packet
has been lost on the wireless link.
TCP ReceiverTCP Sender Base Station
ACK with ELN
4 3 2 1 4 3 2 1
1 1
Retransmission loss packet.
Packet has been loss on the
wireless link.
Ok… retransmit packet butNot reduce congestion
window
경북대학교 이동통신망 연구실47
Indirect TCP Indirect TCP Two separate connections
Violating the end-to-end semantics of TCP Flow/error control protocols, packet size, time-
out, may be different for each part Need Handoff mechanism
TCP ReceiverTCP Sender Base Station
application
transport
network
link
physical
application
transport
network
link
physical
경북대학교 이동통신망 연구실48
Delayed Duplicated ACKsDelayed Duplicated ACKs It is a TCP unaware scheme. TCP receiver reduces interference between TCP and link level retran
smission by delaying third and subsequent dupacks for interval d. The base station implements a link level retransmission scheme fo
r lost packets . It is preferred over snoop in IPSEC Link level ack’s are used to trigger link level retransmission Dupacks for further consecutive packets are delayed for duration d
not use general congestion control algorithm
application
transport
network
link
physical
application
transport
network
link
physical
retransmission
Waitinterval d