Chapter 3.4 La 4 Transport La 1 Think about 2 How do MAC addresses differ from that of the network la? What is flat and what is hierarchical addressing? Who defines the IP Address of a device? What is the decimal and binary range of the first octet of class B IP addresses? Which octet(s) represent the network portion of a class C IP address? Which octet(s) represent the host portion of a class A IP address? How many Host addresses can be used in a Class C Network? I it possible to have different La 3 Protocols using the same La 2 System? 1
Content Introduction La 4 TCP Protocol UDP Protocol Sockets 3 Protocol aspect of the OSI-Model Endsystem 1 La 7 protocol Endsystem 2 7 La 6 protocol 7 6 6 Transitsystem 5 5 4 4 3 3 3 2 2 2 1 1 1 transmission-system Protocols are defined between the same las of two systems. They define rules and formats of message/information exchange. 4 2
TCP/IP Referencemodel FTP Process / Application Application Port TCP UDP Transport IP IP-Address Internet Ethernet cable Ethernet Networkinterface MAC-Address Hardware Transceiver 5 Why we need a transport la? La 1 allows bit streams to be created and to travel. La 2 packages those data packets into frames to be converted to bit streams and makes data-link delivery possible. La 3 packages data from upper las in packets and makes routing and network delivery possible. But they made no provision for assuring our data reliably travels end-to-end across the often vast network path. 6 3
Purpose of the transport la Transport and regulate the flow of information from source to destination, reliably and accurately. The end-to-end control: Sliding windows. Sequencing numbers. Acknowledgments. Segmentation. Multiplexing. 7 TCP and UDP The TCP/IP protocol of the OSI model La 4 (transport la) has two protocols - TCP and UDP. 8 4
TCP/IP 9 Port Both TCP and UDP use port (or socket) numbers to pass information to the upper las. 10 5
Range of ports 2 bytes: 0 65535. Numbers below 255 : for public applications. Numbers from 255-1023 : assigned to companies for marketable applications. Numbers above 1023 : are unregulated. End systems use port numbers to select proper applications. Originating source port numbers are dynamically assigned by the source host; usually, it is a number larger than 1023. 11 Telnet port number 12 6
Content Introduction La 4 TCP Protocol UDP Protocol Sockets 13 TCP TCP supplies a virtual circuit between enduser applications. These are its characteristics: connection-oriented. reliable. divides outgoing messages into segments. reassembles messages at the destination station. re-sends anything not received. reassembles messages from incoming segments. 14 7
TCP Header format 15 Protocol that provides reliable full-duplex data transmission. TCP Header format: Port number Source Port 16 bits. Destination Port 16 bits. 16 8
TCP Header format: Sequence Sequence Number: 32 bits The sequence number of the first data octet in this segment (except when SYN is present). 17 TCP Header format: Acknowledgment Acknowledgment Number: 32 bits This field contains the value of the next sequence number the sender of the segment is expecting to receive. 18 9
TCP Header format: Code bits Control Bits: 8 bits ACK: Acknowledgment field significant ifi RST: Reset the connection SYN: Synchronize sequence numbers FIN: No more data from sender 19 TCP Header format: Window Window: 16 bits The number of data octets beginning with the one indicated in the acknowledgment field which the sender of this segment is willing to accept. 20 10
TCP: Three way handshaking 21 TCP: Simple acknowledgment 22 11
TCP: Sliding acknowledgment 23 TCP: Sliding Acknowledgement Principle Data-Packet includes Number of the first byte Acknowledgement: ACK Flag and Number of the next expected databyte Packet 1 Packet 2 Packet 3 Packet 4 Packet 5 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 S: Packet 1 (Seq.-No=0+1) R: ACK, (Ack.-No=0+7) S: Packet 2 (Seq.-No=0+7) R: ACK, (Ack.-No=0+13) S: Packet 1 (Seq.-No=0+13) R: ACK, (Ack.-No=0+19) 24 12
TCP: ACK and sliding window Packet 1 Packet 2 Packet 3 Packet 4 Packet 5 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 S: Packet 1 (Seq.-Nr=0+1) S: Packet 2 (Seq.-Nr=0+7) R: ACK, (Ack.-Nr=0+7) Paket 1 Paket 2 Paket 3 Paket 4 Paket 5 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 S: Packet 3 (Seq.-Nr=0+13) R: ACK, (Ack.-Nr=0+19) Paket 1 Paket 2 Paket 3 Paket 4 Paket 5 time 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 Timeout ACK Paket 4: S: Paket 4 (Seq.-Nr=0+19) S: Packet 5 (Seq.-Nr=0+25) S: Packet 4 (Seq.-Nr=0+19) R: ACK, (Ack.-Nr=0+31) 25 TCP: Sequence and acknowledgment 26 13
TCP: disconnect Process 1 Send FIN, sequence = n Process 2 Send ACK n+1 Receive FIN Receive ACK Inform Application Send FIN, ACK n+1 Sequence m Receive FIN Send ACK m+1 Receive ACK 27 Content Introduction La 4 TCP Protocol UDP Protocol Sockets 28 14
UDP UDP transports data unreliably between hosts. Following are the characteristics: Connectionless. Unreliable. Transmit messages (called user datagrams). Provides no software checking for message delivery (unreliable). Does not reassemble incoming messages. Uses no acknowledgements. 29 UDP Header format 30 UDP is a simple protocol that exchanges datagrams, without acknowledgments or guaranteed delivery. 15
Review Transport la regulates information flow to ensure end-to-end connectivity between host applications reliably and accurately. TCP and UDP port numbers. Three way handshaking and sliding windows. 31 Content Introduction La 4 TCP Protocol UDP Protocol Sockets 32 16
Ports and Sockets Port: 16 Bit, Process/Application well known ports: e.g..: FTP 20, 21 ephemeral Sockets API: Application Programming Interface socket: { tcp, 193.44.234.3, 4711} connection {TCP, source IP, source port, destination IP, destination Port} 33 TCP- interfaces OPEN (a/p) SEND RECEIVE STATUS CLOSE ABORT Timeout Flags, Daten snd rcv Process 1... port m... TCP IP reliable TCP connection unreliable IP connection Process 2... port n... TCP IP 34 17
TCP Connection states OPEN CLOSED ABORT disconnection ok connect Flags snd rcv Three-Way Handshake ok connected SEND, RECEIVE, STATUS Flags,Data Timeouts snd rcv disconnect Flags snd rcv CLOSE connection = Socket pair {TCP, source IP, source port} {TCP, destination IP, destination Port} 35 Connection states ABORT snd RST, delete TCB CLOSED OPEN (passive) CLOSE Create TCB delete TCB OPEN (active) Create TCB, snd SYN rcv SYN snd SYN, ACK LISTEN SEND snd SYN Timeout=2MSL delete TCB SYN RCVD CLOSE snd FIN FIN WAIT 1 rcv ACK of FIN FIN WAIT 2 rcv ACK of SYN CLOSE snd FIN rcv FIN snd ACK rcv FIN snd ACK rec SYN snd ACK ESTAB CLOSING rcv ACK of FIN TIME WAIT rcv SYN, ACK snd ACK rcv FIN snd ACK SYN SENT CLOSE WAIT CLOSE snd FIN LAST ACK rcv ACK of FIN delete TCB 36 18
TCP: Header Format 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Source Port Destination Port Sequence Number Acknowledgment Number Data Offset Reserved U R G A C K P S H R S T S Y N F I N Window Checksum Urgent Pointer Options data Padding 37 TCP: Pseudo Header 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Source Address Destination Address zero PTCL TCP Length PTCL: Protokoll-Code 6: UDP 7: TCP 38 19