Microsoft PowerPoint - 20_TransportProtocols-1.ppt

Similar documents
슬라이드 제목 없음

TCP.IP.ppt

Microsoft Word doc

Subnet Address Internet Network G Network Network class B networ

7. TCP

슬라이드 1

SMB_ICMP_UDP(huichang).PDF

bn2019_2

ARQ (Automatic Repeat reQuest)

Network seminar.key

Microsoft PowerPoint _TCP_IP

<C0CCBCBCBFB52DC1A4B4EBBFF82DBCAEBBE7B3EDB9AE2D D382E687770>

슬라이드 1

歯규격(안).PDF

Microsoft PowerPoint - 4. 스캐닝-2.ppt [호환 모드]

SRC PLUS 제어기 MANUAL

자바-11장N'1-502

Microsoft PowerPoint - Lecture_Note_5.ppt [Compatibility Mode]

UDP Flooding Attack 공격과 방어

제20회_해킹방지워크샵_(이재석)

IP 주소란? 네트워크상에존재하는컴퓨터들을구분하고, 서로를인식하기위해사용하는특수한번호. 32-bit 체계의 IPv4 와, 128-bit 체계의 IPv6 가있다. About IPv4 32-bit 의길이로이루어지는 IPv4 는 1 byte (= 8-bit) 씩 4 개로나누

슬라이드 제목 없음

<4D F736F F F696E74202D E20B3D7C6AEBFF6C5A920C7C1B7CEB1D7B7A1B9D62E >

Switching

슬라이드 제목 없음

6주차.key

<3130C0E5>

°í¼®ÁÖ Ãâ·Â

hd1300_k_v1r2_Final_.PDF

Microsoft PowerPoint - 06-IPAddress [호환 모드]

2009년 상반기 사업계획

1217 WebTrafMon II

TCP for MANET

Microsoft PowerPoint - net3


Microsoft PowerPoint - 04-UDP Programming.ppt

The Pocket Guide to TCP/IP Sockets: C Version

The Pocket Guide to TCP/IP Sockets: C Version

¹Ìµå¹Ì3Â÷Àμâ

ARMBOOT 1

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션

슬라이드 제목 없음

Chapter11OSPF

The Pocket Guide to TCP/IP Sockets: C Version

[ 네트워크 1] 3 주차 1 차시. IPv4 주소클래스 3 주차 1 차시 IPv4 주소클래스 학습목표 1. IP 헤더필드의구성을파악하고요약하여설명할수있다. 2. Subnet ID 및 Subnet Mask 를설명할수있고, 각클래스의사용가능한호스트수와사설 IP 주소및네트

Chap06(Interprocess Communication).PDF

歯I-3_무선통신기반차세대망-조동호.PDF

TTA Verified : HomeGateway :, : (NEtwork Testing Team)

/ (application layer protocols) http ftp smtp pop dns 2

chapter4

untitled

전송계층프로토콜 TCP(Transmission Control Protocol) 전송계층에서동작하는연결지향형 (connectionoriented) 프로토콜 데이터의흐름을관리하고, 데이터가정확한지검증하며통신 쓰리웨이핸드셰이킹 (three-way handshaking) 을통

歯김병철.PDF

본 강의에 들어가기 전

Sena Device Server Serial/IP TM Version

(SW3704) Gingerbread Source Build & Working Guide

1. What is AX1 AX1 Program은 WIZnet 사의 Hardwired TCP/IP Chip인 iinchip 들의성능평가및 Test를위해제작된 Windows 기반의 PC Program이다. AX1은 Internet을통해 iinchip Evaluation

Microsoft PowerPoint - Chap09_TCP와 UDP [호환 모드]

Microsoft PowerPoint - L4-7Switch기본교육자료.ppt

PWR PWR HDD HDD USB USB Quick Network Setup Guide xdsl/cable Modem PC DVR 1~3 1.. DVR DVR IP xdsl Cable xdsl Cable PC PC DDNS (

Microsoft PowerPoint - o8.pptx

BGP AS AS BGP AS BGP AS 65250

<30322D28C6AF29C0CCB1E2B4EB35362D312E687770>

Backup Exec


TTA Journal No.157_서체변경.indd

Microsoft PowerPoint - 4.스캐닝-1(11.08) [호환 모드]

이도경, 최덕재 Dokyeong Lee, Deokjai Choi 1. 서론

일반적인 네트워크의 구성은 다음과 같다

Network Security - Wired Sniffing 실습 ICNS Lab. Kyung Hee University

Microsoft PowerPoint - Supplement-03-TCP Programming.ppt [호환 모드]

Output file

Microsoft PowerPoint - 13_appl.ppt

USB USB DV25 DV25 REC SRN-475S REC SRN-475S LAN POWER LAN POWER Quick Network Setup Guide xdsl/cable Modem PC DVR 1~3 1.. DVR DVR IP xdsl Cable xdsl C

슬라이드 1

<4D F736F F F696E74202D20BBB7BBB7C7D15F FBEDFB0A3B1B3C0B05FC1A638C0CFC2F72E BC8A3C8AF20B8F0B5E55D>

Microsoft PowerPoint 권태경교수님Network-Research-CSE

Microsoft PowerPoint - Supplement-02-Socket Overview.ppt [호환 모드]

6자료집최종(6.8))

2-11Àå

슬라이드 1

3rd Edition: Chapter 3

원고스타일 정의

0125_ 워크샵 발표자료_완성.key

Microsoft PowerPoint - 03-TCP Programming.ppt

- 2 -

Chapter 18 - William Stallings, Data and Computer Communications, 8/e

PowerChute Personal Edition v3.1.0 에이전트 사용 설명서

Page 2 of 6 Here are the rules for conjugating Whether (or not) and If when using a Descriptive Verb. The only difference here from Action Verbs is wh

Assign an IP Address and Access the Video Stream - Installation Guide

FMX M JPG 15MB 320x240 30fps, 160Kbps 11MB View operation,, seek seek Random Access Average Read Sequential Read 12 FMX () 2

0. 들어가기 전

À©µµ³×Æ®¿÷ÇÁ·Î±×·¡¹Ö4Àå_ÃÖÁ¾

T100MD+

#Ȳ¿ë¼®

Microsoft Word - access-list.doc

歯3이화진

Microsoft PowerPoint ppt

제1장 Unix란 무엇인가?

Transcription:

Chapter 20 Transport Protocols The foregoing observations should make us reconsider the widely held view that birds live only in the present. In fact, birds are aware of more than immediately present stimuli; they remember the past and anticipate the future. The Minds of Birds, Alexander Skutch

Transport-layer protocols Provide logical communication between app processes running on different hosts Transport protocols run in end systems Reliable, in-order unicast delivery: TCP Congestion Flow control Connection setup Unreliable ( best-effort ), unordered unicast or multicast delivery: UDP application transport network data link physical network data link physical logical end-end transport network data link physical network data link physical network data link physical network data link physical application transport network data link physical

TCP Position

TCP Overview Shield upper layers from network details Point-to-point: End-to-end data transfer service One sender, one receiver Reliable data transfer 상위계층의응용프로그램에게완전무결한전송서비스를보장 오류제어, 흐름제어, 혼잡제어메커니즘제공 In-order byte steam No message boundaries TCP numbers each octet sequentially Segments are numbered by the first octet number in the segment

TCP Overview Full duplex data: Bi-directional data flow in the same connection Different MSS (Maximum Segment Size) for two directions: Connection-oriented: 3 단계 : 연결설정, 데이터전송, 연결해제 Provides establishment, maintenance & termination of a logical connection Handshaking (exchange of control msgs) before data exchange Flow and congestion controlled: Sender will not overwhelm receiver TCP congestion and flow control set window size

TCP Encapsulation

TCP vs IP Network layer: data transfer between end systems Transport layer: data transfer between processes

Interprocess Communication 클라이언트 / 서버방식이가장많이사용됨 클라이언트와서버프로세스는같은이름을가짐 하나의호스트에서여러개의서버와클라이언트프로그램실행 클라이언트프로세스 서버프로세스

Addressing Establish identity of process by network address and port number (socket number) Must know address ahead of time 서버프로세스는미리동작하고있어야한다 ( 서버는클라이언트의접속을받아들이는소켓을생성해놓아야한다 ) Well known port Eg. common servers like FTP, SMTP etc Request to a well known port spawns a new process to handle it 서버는대기상태에서클라이언트와의연결이설정되면자식프로세스를생성하여서비스를제공하고상대방으로부터종료요청이오면연결해제 서버는자식프로세스가실행되는동안다른클라이언트의접속을기다림

Socket Address 소켓주소 : 각종단프로세스의식별을위한 IP 주소와포트번호의조합

Port Number 프로세스식별하는데사용 포트번호범위 : 0 ~ 65,535 사이정수 임시포트 ( 동적포트 ) : 클라이언트프로세스는임의로포트번호선택 (49,152 ~ 65,535) 잘알려진포트 (well-known port number) 서버프로세스는포트번호를미리배정받아야함 (0 ~ 1,023) IANA (Internet Assigned Numbers Authority) 에의해배정 모든클라이언트프로세스는대응하는서버프로세스의포트번호를미리알고있어야한다. 등록된포트 (registered port): IANA 가제어하지않으나중복을피하기위해등록가능 (1,024 ~ 49,151)

Well Known Port Port Protocol 7 Echo 9 Discard 11 Users 13 Daytime 17 Quote 1 Chargen 2 FTP, Data 3 FTP, Control 23 TELNET 25 SMTP 53 DNS 67 BOOTP 79 Finger 80 HTTP 111 RPC

Example Daytime 프로세스 : 날짜와시간리턴 클라이언트프로세스 : 임시포트번호 =52000 서버프로세스 : well-known port = 13

Example 클라이언트프로세스가시작될때운영체제에게임시포트번호요청 구현에따라입력큐만단독으로또는입 / 출력큐동시생성 서버프로세스는시작할때잘알려진포트를사용하여입출력큐생성 메시지가도착하면큐에삽입 큐가생성되어있지않으면데이터그램은폐기되고 ICMP 가 port unreachable 메시지를발신지로보냄

Multiplexing Gathering data from multiple app processes, enveloping data with header Multiple users employ same transport protocol 포트번호가다른여러프로세스로부터메시지를받으면헤드를추가하여 IP 로보냄

Multiplexing Identified by sender, receiver port numbers, IP addresses in each segment 32 bits source port # dest port # other header fields application data (message) TCP/UDP segment format

Demultiplexing Demultiplexing: delivering received segments to correct app layer processes applicationlayer data P3 receiver M M P4 segment header segment Ht M Hn segment P1 M application transport network application transport network M P2 application transport network

Examples host A source port: x dest. port: 23 server B Web client host C source port:23 dest. port: x port use: simple telnet app Source IP: C Dest IP: B source port: y dest. port: 80 Source IP: C Dest IP: B source port: x dest. port: 80 Web client host A Source IP: A Dest IP: B source port: x dest. port: 80 Web server B port use: Web server

Reliable Data Transfer Characteristics of unreliable channel will determine complexity of reliable data transfer protocol

Reliable Data Transfer rdt_send(): called from above, (e.g., by app). Passed data to deliver to receiver upper layer deliver_data(): called by rdt to deliver data to upper send side receive side udt_send(): called by rdt, to transfer packet over unreliable channel to receiver rdt_rcv(): called when packet arrives on rcv-side of channel

Data Transfer Data transfer by a logical stream of octets Octets numbered modulo 2 23 Data buffered at transmitter and receiver Sent when transport entity ready unless PUSH flag used to force send Flow control uses credit allocation of number of octets socket door application writes data TCP send buffer application reads data TCP receive buffer socket door segment

TCP Buffer

Stream service 송신 TCP 송신응용프로그램으로부터문자스트림의형태로전달 바이트단위로번호를부여한후 IP로전달 수신 TCP 데이터를추출하여문자스트림으로응용프로그램에전달 Buffer Hello dear friend. I am sending a letter I am sending a letter TCP Segment 2 Hello dear friend. TCP Segment 1

Stream service 스트림데이터서비스 : 송수신 TCP buffer 사용 송신 : write 동작 수신 : read 동작 응용프로그램의데이터생성시 TCP 로전달 예 : 키보드입력시응용프로그램은한문자씩 TCP 로전달 예 : 파일로부터입력시응용프로그램은한라인또는한블록씩 TCP 로전달 여러번의 write 동작으로하나의세그먼트생성 응용프로그램에서 PUSH 를요구하면즉각하나의세그먼트생성가능

SEQ Number Each octet has sequence number Each transport segment has SEQ number (SN), ACK number (AN) in header 순서번호 (SEQ): TCP 세그먼트가운반하는데이터의첫번째바이트의번호 연결설정시 TCP 는난수발생기를사용하여초기순서번호 (Initial Sequence Number: ISN) 을생성 각연결마다독립적인순서번호사용 TCP Header

ACK Number 데이터세그먼트또는제어세그먼트의수신확인 Seq no of next byte expected from other side The acknowledgment number is cumulative. ( 가장최근에수신한바이트의수신확인으로써그이전의모든바이트에대한수신확인이누적적으로이루어짐 ) ACK includes (AN=i) which means All octets through SN = i-1 acknowledged, want i next TCP 에서는 NAK 가사용되지않음 Piggyback ACK on suitable outbound data segments

Example Host A Host B time Seq=42, ACK=79, data Seq=79, ACK=43, data Seq=43, ACK=80, data

Example Q : A TCP connection is transferring a file of 6000 bytes. The first byte is numbered 10010. What are the sequence numbers for each segment if data is sent in five segments with the first four segments carrying 1,000 bytes and the last segment carrying 2,000 bytes? A : Segment 1 SN=10,010 (10,010 to 11,009) Segment 2 SN=11,010 (11,010 to 12,009) Segment 3 SN=12,010 (12,010 to 13,009) Segment 4 SN=13,010 (13,010 to 14,009) Segment 5 SN=14,010 (14,010 to 16,009)

TCP Primitives/Parameters Primitives Passive & active open Active open with data Close Abort Send Allocate Status Parameters Source port, destination port & address, timeout, security, data, data length, PUSH & URGENT flags, send & receive windows, connection state, amount awaiting ACK

TCP segment structure TCP 간에전달되는데이터단위

TCP segment structure URG: urgent data (generally not used) ACK: ACK # valid PSH: push data now (generally not used) RST, SYN, FIN: connection estab (setup, teardown commands) checksum 32 bits source port # dest port # head len sequence number acknowledgement number rcvr window size U A P R checksum S F ptr urgent data Options (variable length) application data (variable length) counting by bytes of data (not segments!) # bytes rcvr willing to accept

TCP Segment 포트번호 : 발신지 / 목적지응용프로그램의포트번호 순서번호 (SEQ): 첫번째데이터바이트의번호 ACK 번호 : 수신확인번호 ( 상대방으로부터 다음에받아야할바이트의번호 ) 헤더길이 : 4바이트단위 (5~15) 윈도우크기 : 상대방으로부터수신가능한바이트개수 ( 자신의수신버퍼상태를기반으로결정 ) 검사합 (checksum) : 오류검출 제어플래그 옵션 (option) : 옵션정보 ( 최대 40 바이트 )

Control Flag

PUSHING 응용프로그램이자신의 TCP 에게 즉각세그먼트를만들어전송 하도록요구 Requires transmission of all data up to push flag Avoids waiting for full buffers 상대방 TCP 에게 세그먼트를응용프로그램에게즉각전달 하도록요구 예 : 대화형응용프로그램이키보드로입력된문자를즉시전송하고자하는경우 PSH flag 를 1 로설정 대부분의 TCP 구현에서는상위계층의 Push 요구를무시

Urgent Data 긴급하게전송할데이터가있음 을알림 URG flag를 1 로설정 상대방 TCP는수신한세그먼트에서긴급데이타를추출하고순서번호와상관없이응용프로그램에게즉각전달 예 : 데이터전송을중단하기위하여상대방응용프로그램에게 Control-C 를보낼경우 긴급포인터는긴급데이타의끝 ( 즉, 일반데이터의시작 ) 을가르킴 URG: 1 Urg. Pointer: xxx Urgent Data Normal Data

Checksum Mandatory Pseudoheader를임시로추가하여 checksum 계산한후제거 프로토콜의값 : 6

TCP Operation 연결관리 연결설정 연결해제 데이터전송제어 오류제어 흐름제어 혼잡제어

Connection Establishment TCP sender, receiver establish connection before exchanging data segments Need connection establishment and termination procedures to allow: Negotiation of optional parameters Seq no, flow control info (receive window) Triggers allocation of transport entity resources (buffers) Connection determined by source and destination sockets (IP address of host, port number) Can only have a single connection between any unique pairs of ports But one port can connect to multiple different destinations (different ports)

TCP Connection TCP 각연결마다독립적인상태변수 ( 순서번호등 ) 와자원 ( 버퍼등 ) 을유지관리함 TCP TCP TCP

Connection Establishment TCP user issues OPEN primitive Transport entity sends a SYN segment (SYN flag=1) Active open with data sends data with open Passive open indicates will accept connections

Connection Open (2-Way) A send SYN, B replies with SYN Lost SYN handled by retransmission Ignore duplicate SYNs once connected Lost or delayed data segments can cause connection problems Eg. Segment from old connection

Example Normal Delayed DATA segement

Example Delayed SYN segement New SYN segement SN = i+1 인 DATA segment 를기다리고있는상태이므로폐기됨

Example Delayed SYN segement DATA, SN=k DATA, SN=j-1 AN = i+1 는부적합할경우연결거절됨 (AN = k+1 을기대 ) 또는미존재포트일경우에도연결거절 RST-i is sent in response to any i segment arriving

Example Delayed SYN AN = p 는부적합하므로연결거절됨 (AN = i+1 을기대 ) 또는미존재포트일경우에도연결거절

Connection Open (3-Way) 3-way handshaking 을통한양방향연결설정 SYN segment, SYN + ACK segment 는데이터운반불가능하지만 1 개의순서번호사용 ACK segment 는데이터운반가능 ( 데이터를운반하지않을경우에는순서번호사용하지않음 )

Connection Open (3-Way) 1) 클라이언트프로그램은자신의 TCP 에게데이터전송을요청 (active open) 2) 서버프로그램은자신의 TCP 에게연결수락준비를통보 (passive open) 서버프로세스는자신이먼저연결개설요청불가 3) 클라이언트 TCP 는서버 TCP 에게 SYN 세그먼트를전송 ( SYN = 1 ) 하여연결요청 세그먼트의초기순서번호 (ISN: Initial Seq Number) 포함 4) 서버 TCP 는연결요청수락과서버 - 클라이언트방향의연결설정을요구하는 SYN 세그먼트전송 서버 TCP 는 SYN+ACK 전송 ( SYN=1, ACK=1 ) 서버 TCP 가전송하는세그먼트의 ISN 포함 클라이언트 TCP 의윈도우 (rwnd) 크기 ( 클라이언트가전송할수있는세그먼트의최대크기 ) 지정 5) 클라이언트 TCP 는서버 TCP 에게 ACK 를전송하여서버 - 클라이언트간에양방향연결설정완료 클라이언트 TCP 는서버 TCP 의연결요청을수락 ( ACK=1 ) 서버 TCP 의윈도우 (rwnd) 크기지정 첫번째데이터배달가능

Connection Open (3-Way) CLOSED : 연결미설정상태 SYN-SENT : 연결요청을하고이에대한 ACK를기다리는상태 LISTEN : 클라이언트로부터연결요청을기다리는상태 SYN-RCVD : 클라이언트의연결요청에대한수락과더불어역방향연결요청을하고이에대한 ACK를기다리는상태 Active open CLOSED SYN CLOSED LISTEN Passive open SYN SENT ESTABLISHED ACK+SYN ACK 데이터전송 SYN RCVD ESTABLISHED

Simultaneous open 서버 / 클라이언트가없는환경에서상대방의 local port number 를아는두프로세스가동시에 active open 을요구할경우, 두 TCP 는서로에게연결설정요구를하게되고최종적으로단일연결이설정됨 두프로세스는클라이언트와서버의역할을동시수행

Connection Close Graceful close TCP user issues CLOSE primitive Transport entity sets FIN flag on last segment sent with last of data Abrupt termination by ABORT primitive Entity abandons all attempts to send or receive data RST segment transmitted to other end

Graceful Close FIN 수신이후에도착하는데이터세그먼트가있을경우 (misordered segments) 데이터분실됨 Receiver waits for all segments before FIN sequence number 자신이보낸 FIN 에대한 ACK 를받은후연결종료 (FIN 이분실될경우재전송하여야함 )

Connection Close (3-way)

Connection Close (3-way) 1. 클라이언트프로세스가더이상보낼데이터가없으면자신의 TCP에게연결종료요구 (active close) 하고클라이언트 TCP는 FIN을전송 ( FIN=1 ) 한다음서버 TCP로가는방향의연결해제 FIN segment 가데이터를운반하지않을경우에는순서번호를쓰지않음 2. 서버 TCP 는클라이언트 TCP 의연결종료요구에대해 FIN+ACK 으로회신하고클라이언트로가는방향의연결종료 (passive close) - 서버프로세스가보낼데이터가없을경우 3. 클라이언트 TCP 는 ACK 로써응답하고서버 TCP 는연결종료

Connection Close (3-way) FIN-WAIT-1 : 응용프로세스로부터오는데이터스트림이종료된상태 TIME-WAIT : FIN을받은이후2MSL 동안대기하는상태 (FIN이재전송되는경우이에대한 ACK를보내기위하여머무르는상태 ) CLOSE-WAIT : 응용프로세스로부터오는데이터스트림의종료를기다리는상태 LAST-ACK : 연결종료요청 (FIN) 에대한ACK를기다리는상테

Connection Close (3-way) 1. 클라이언트는 FIN 을보내고 FIN-WAIT-1 ( 또는 - 2) 상태에서서버의연결종료요청 (FIN) 을대기 2. 서버는역방향으로 FIN 을보내고이에대한 ACK 를대기 3. 서버가 ACK 를받지못하면 (FIN 분실된경우 ) RTO (Retransmission Timeout) 만료후 FIN 을다시보냄 4. 클라이언트가 FIN 을받으면 ACK 를보내고 2MSL (twice maximum expected segment lifetime) 동안대기한후 CLOSED 상태로천이함 클라이언트 TCP 가 FIN 을받은이후 ACK 를보내고바로 CLOSED 상태로가서연결종료해버리면자신이보낸 ACK 가분실될경우서버가재전송되는 FIN 을수신할수없음

Connection Close (4-way) 각방향의연결을별도로해제 (half close) 데이터송신은중단한반면상대방으로오는데이터의수신은지속됨 양방향연결종료를위해서는 4-way handshaking

Connection Close (4-way) Active close 2MSL timer ESTABLISHED FIN-WAIT-1 FIN-WAIT-2 TIME-WAIT FIN ACK ACK 데이터 FIN ACK ESTABLISHED CLOSE-WAIT LAST-ACK Passive close timeout CLOSED CLOSED FIN-WAIT-2 : 서버로향하는연결이종료된상황에서역방향의데이터를수신하는상태

Simultaneous close CLOSING : Both sides have decided to close simultaneously

Connection Reset 존재하지않는포트로연결요청할경우, 상대방에게 RST 세그먼트 ( RST 비트 = 1) 를보내어연결요청거부 비정상적인상황에서 RST 세그먼트를보내어연결파기 상대방 TCP가오랫동안 idle 상태에있으면 ( 연결상에서데이터전송이오랫동안이루어지지않을경우 ) RST 세그먼트를보내어연결파기 Wait for ACK for (RTO) * (number of retries) When keep-alive timer is expired, close connection and inform user Send RST i in response to any i segment arriving All state info is lost after restart RST에대한ACK는전송되지않음 If received data is not for current connection, RST flag is set on next segment to reset connection

Connection Reset

Connection Reset