Presentation on theme: "CP476 Internet Computing TCP/IP 1 Lecture 3. TCP / IP Objective: A in-step look at TCP/IP Purposes and operations Header specifications Implementations."— Presentation transcript:
CP476 Internet Computing TCP/IP 1 Lecture 3. TCP / IP Objective: A in-step look at TCP/IP Purposes and operations Header specifications Implementations Internet protocol (IP) IP is an unreliable connectionless protocol for host-to-host datagram transmission. It includes rules for fragmentation and assembly of long datagram. It was first defined in RFC:791 (IPv4) Hosts are identified by fixed length IP addresses. 32 bits in IPv4. IP is called by local host protocol, it calls the local network protocol to carry the datagram to the next gateway or destination host. Gateways implement IP to forward datagram Operations –Addressing: insert the destination address in header –Routing: select path for transmission –Fragmenting: divide a datagram into some smaller units to accommodate the MTU of a data link –Services: type of service, time to live, options, header checksum
CP476 Internet Computing TCP/IP 2 An IP datagram consists of IP header and data. The maximum length of a datagram is 65,535 bytes. MTU is the maximum number of bytes that a data link protocol can encapsulate. MTU vary from data link to data link. IP headerData IP datagram The header format of IP datagram Total length 16 bits Identification 16 bits Header checksum 16 bits Source IP address Destination IP address Option Protocol 8 bits Time to live 8 bits Flag 3bits Fragmentation 13 bits Ver 4 bits HLEN 4 bits TS 8 bits
CP476 Internet Computing TCP/IP 3 The definition of each field –Version number (VER) – Head length (HLEN) – Types of Services (TS) 0-2: precedence; 3: delay; 4: throughout; 5: reliability, 6-7: future use – Identification: a datagram number assigned by IP process – Flag: first bit is reserved, second bit = 1: can not be fragmented third bit = 1, not the last fragment – Fragmentation offset: the offset of original datagram in 8 bytes (start from 0) – Time to live: time left in transmission – Protocol: higher layer protocols 00000001 (ICMP), 00000010 (IGMP), 00000110 (TCP), 00001001 (UDP), …
CP476 Internet Computing TCP/IP 4 –Checksum (16 bits) Calculated by sender, inserted in the header. Recalculated by receiver. If not correct, discard Sender: divide the datagram into k groups, each has 16 bits (take the checksum field as 0), then calculate the sum, the checksum is the one’s complements, the add th checksum to the checksum field Receiver: calculate the checksum. If the result is 0, accept, otherwise discard –Options Security option provides a way for hosts to hand restrictions by IP software 00000000 00000000 - Unclassified 11110001 00110101 – Confidential 01011110 00100110 - PROG 10101111 00010011 - Restricted 11010111 10001000 - Secret 01101011 11000101 - Top Secret
CP476 Internet Computing TCP/IP 5 IP implementation –Header-adding module Receives data from an upper-layer protocol, along with IP the destination IP address. It encapsulates the data in an IP datagram by adding the IP header. –Processing module Receives datagram from the header-adding module. Check if it is a loopback packet, or it arrives its destination, if yes, then sends it to assembly module. If the node is a router, it decrements the time TTL by one, if TTL is less than one, discard the packets, ICMP message. If the TTL is bigger than one, then passes it to the routing module. –Routing module Receives an IP packet from processing module, find the IP address of the next station from the routing table, and pass to fragmentation module.
CP476 Internet Computing TCP/IP 6 –Fragmentation module Receives IP datagram from the routing module, consults the MTU table to find MTU for the specific interface. If the datagram is larger than the MTU, then fragments the datagram, adds a header to each fragment and sends them to ARP package for address resolution and delivery. –Reassembly module Receives datagram from processing module, that arrives in the final destination, reassemblies the fragments back to original datagram by reassembly table (a linked list) and finally pass the whole datagram to the upper level protocol.
CP476 Internet Computing TCP/IP 7 Transmission Control Protocol TCP is a connection-oriented, reliable protocol, transport layer protocol. It responsible for process-to-process communication. It is between a user application protocol and IP. TCP was first defined in RFC:793 What it does? It transfers packets between two processes in the two hosts. A data unit transferred between two processes is called a segment. It has 20-60 bytes header, followed by a data segment from the application program. How is a process identified? A process is identified by a port number, which is set up when the process starts, and the IP address of its host. –A client process port number could be any number from 0 to 65535. –A sever side process port number is usually well-known. –The pair of IP address and the port number in either client or server is called a socket address.
CP476 Internet Computing TCP/IP 8 What operations it provides? – Connections – Reliability – Flow control: using slide window technique – Multiplexing – Precedence and security Source port 16 bitsDestination port 16 bits Sequence of number 32 bits Acknowledge number 32 bits Window size 16 bits Urgent pointer 16 bitsChecksum 16 bits Options and Padding HLEN 4 bits Reserved 4bits aclacl SynSyn pshpsh rstrst FinFin urgurg Data Segment syntax: header + data
CP476 Internet Computing TCP/IP 9 Semantics of the header –Source port: chosen by client TCP process Destination port: well-known or chosen by the server TCP process –Sequence of number: a random number generated to as the initial sequence number for the first byte of the data. Segment –Acknowledge number: if the receiver of the segment has successfully received byte number x from the other party, it defines x+1 as the acknowledge number. –Header length (HELN): The number of 4-byte words in the TCP header, can be between 20-60 –Control field URG (urgent pointer is valid), ACK (=1, acknowledgement is valid) PSH: request for push RET: reset the connection SYN: synchronize the sequence number FIN: terminate the connection –Window size: the size of window in byte –Checksum: the similar to IP checksum. –Urgent pointer: work with urgent flag in control field. –Options: many
CP476 Internet Computing TCP/IP 10 The communication between two processes is realized by setting up a logical connection between them Connection establishment: three-way-handshaking 1. Host A (client) sends a (SYN) segment to announce its whish for connection and includes its initialization info. (source and destination port number, ISN, window size) about the traffic from A to B. 2. Host B (server) sends a (SYN and ACK) segment to acknowledge the request of A. And Host B sends a segment that includes its initialization info. (port number, window size) about the traffic from B to A. 3. Host A sends a segment to acknowledge the request of B ( initial sequence number, server window size). Connection termination: Four-way-handshaking 1. Host A (client) sends a FIN segment to B. 2. Host B (server) sends an ACK segment to acknowledge the request of A 3 Host B sends a FIN segment to A 4. Host A sends an ACK segment to confirm the receipt of the FIN.
CP476 Internet Computing TCP/IP 11 Reliability is achieved by sequence numbers, acknowledgments, and timer. –Acknowledgments –TCP timer Retransmission timer: when TCP sends a segment, it creates a retransmission timer for that particular segment. Two situation may occur: If an acknowledgement is received for this particular segment before the time goes off, the timer is destroyed. If the timer goes off before the acknowledgement arrives, the segment is retransmitted, and the timer is reset. The calculate of retransmission time: RT = 2 * RTT (the round-trip time). RT = alpha * previous RRT + (1-alpha)*current RRT Flow control: using slide window technique send k (window size) continuous segments, wait for ACK move the window to the Multiplexing security
CP476 Internet Computing TCP/IP 12 Main module Input processing module output processing module Time r Application layer message to and from applications TCP software IP layer TCB TCP implementation –The TCP/user interface provides for calls made by the user on the TCP to OPEN or CLOSE a connection, to SEND or RECEIVE data, or to obtain STATUS about a connection. These calls are like other calls from user programs on the operating system, for example, the calls to open, read from, and close a file. –The TCP/internet interface provides calls to send and receive datagram addressed to TCP modules in hosts anywhere in the internet system. These calls have parameters for passing the address, type of service, precedence, security, and other control information.
CP476 Internet Computing TCP/IP 13 –TCB (Transmission Control Blocks) is used for each connection. An array of TCBs is kept for a group of connections. –TCP Modules: Input processing module receives segment from the processing module, pass it to the main module Main module, invoked by an arriving TCP segment, it does different things according state of TCB and the information in the segment header. It can be modeled as an FSM, actions are taken by cases of states Output processing module
Your consent to our cookies if you continue to use this website.