TCP/IP Basics


Published on

Get introduced to the basics of Communication Protocols and understand how TCP/IP works

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

TCP/IP Basics

  1. 1. TCP/IP <ul><li>Objective: Understand the Basic Concepts of Protocols and Get to know the basics of TCP/IP (the building blocks of the Web) </li></ul>
  2. 2. Communications Architecture: Introduction <ul><li>Communications functions can be divided into subset activities </li></ul><ul><ul><ul><li>concept of layered communications </li></ul></ul></ul><ul><li>Each activity can be looked as a layer </li></ul><ul><ul><li>A layer provides a specific service (function) to other layers </li></ul></ul><ul><ul><li>A layer has a specific protocol (control messages) to connect to other systems </li></ul></ul><ul><li>Two standards: </li></ul><ul><ul><li>IBM’s proprietary SNA </li></ul></ul><ul><ul><li>ISO’s Reference Model for Open Systems Interconnection (OSI model) </li></ul></ul>
  3. 3. The OSI Model Lower Layer connects one node to another Upper Layer directly assist the user 7 Application 6 Presentation 5 Session 4 Transport 3 Network 2 Data Link 1 Physical Layer Function Network Choosing the next node and the link to it Data Link Controls the flow of messages on the chosen link Physical Connecting to the physical medium that provides the link Layer Function Application Provides services directly to an application program Presentation Presentation of information to user in a format that the user will understand Session Controls the user to user dialogue – its direction and synchronization Transport Raises the quality of service provided by the network to the level required by user
  4. 4. The Internet Protocol Suite Fiber Telnet DNS UDP TCP IP Ethernet Wi-Fi Co-ax HTTP Radio Application Transport Network Link Physical
  5. 5. TCP/IP Transmission Control Protocol/Internet Protocol <ul><li>TCP/IP allows networks of different types to interconnect </li></ul>
  6. 6. Inter-net Protocol & Internet Addresses <ul><li>Network layer protocol whose job is to send packets or datagrams to send packets from one point to another </li></ul><ul><li>Each destination is specified by an IP address </li></ul><ul><ul><li>IPv4: Each address has 4 8 bit numbers </li></ul></ul><ul><ul><li>Represented in dotted decimal places </li></ul></ul><ul><ul><li>A 8 bit number can represent 0-255 in decimal place </li></ul></ul><ul><ul><li>A typical number therefore looks like </li></ul></ul><ul><ul><li>IPv6 allows a larger number of addresses (among other advantages) </li></ul></ul><ul><li>IP Addresses: Static or Dynamic </li></ul><ul><ul><li>Static useful on infrastructure situations </li></ul></ul><ul><ul><li>Dynamic addresses changes everytime a machine logs on </li></ul></ul><ul><ul><li>Dynamic addresses are most often assigned by Dynamic Host Configuration Protocol (DHCP) </li></ul></ul>
  7. 7. IP Characteristics <ul><li>IP is a connectionless protocol </li></ul><ul><ul><li>No concept of a job or a session (each packet is treated as an entity in itself) </li></ul></ul><ul><li>IP is an unreliable protocol </li></ul><ul><ul><li>It is unconcerned with whether a packet reaches its eventual destination, or whether they arrive in the original order </li></ul></ul><ul><ul><li>IP cannot tell if packets were lost or whether they were received out of order </li></ul></ul><ul><li>IP packets are not identified as a part of a sequence or belonging to a particular job. </li></ul>
  8. 8. IP Packet Header <ul><li>The protocol field in the header information identifies which higher level TCP/IP protocol sent the data. When data arrives at its destination this field tells IP which protocol module to pass it on to. </li></ul><ul><li>The time-to-live (TTL) field, specifies how long the packet is allowed to reamin in the internet delivery system and is decremented by by every router that the packet passes through. When it reaches zero the packet is discarded and the sender. This prevents packets from traveling the Internet forever. </li></ul><ul><li>The checksum is an error detection checksum covering only the fields of the header. </li></ul>Version Header length Service type Total length Identification Flags Fragment Offset Time to live Protocol Header checksum Source address Destination address IP Options Padding
  9. 9. ARP & ICMP: Accompanying Protocols <ul><li>Address Resolution Protocol (ARP) finds out the physical address corresponding to an IP address </li></ul><ul><ul><li>When an IP Packet is received, an ARP request is brodcasted on the network. When a host recognizes an ARP request containing its own IP address, it sends an ARP reply containing its hardware address. This address is cached. </li></ul></ul><ul><ul><li>There is also a Reverse ARP (RARP) protocol. This is used by a host to find out its own IP address if it has no way of doing this except via the network. </li></ul></ul><ul><li>Internet Control Message Protocol: </li></ul><ul><ul><li>Defines the format of control messages that are sent to the sender indicating that a problem has occurred </li></ul></ul>
  10. 10. TCP Characteristics <ul><li>TCP is a connection-oriented protocol </li></ul><ul><ul><li>The client & the server must establish a connection before any data can be transferred between them. </li></ul></ul><ul><li>TCP provides reliability </li></ul><ul><ul><li>TCP knows that data it sends is received at the other end, and that it is received correctly. </li></ul></ul><ul><ul><li>TCP uses checksums on both headers and data. </li></ul></ul><ul><li>TCP ensure Data which arrives out of sequence is put back into order </li></ul><ul><li>TCP also implements flow control, so a sender cannot overwhelm a receiver with data. </li></ul>
  11. 11. TCP Packet Header <ul><li>TCP sends data using IP, in blocks which are called segments . </li></ul><ul><li>The Port number identifies a particular user within a machine (which is identified by the IP address </li></ul><ul><li>The sequence number identifies the position in the data stream </li></ul><ul><li>The acknowledgement number is used to convey back to the sender that data has been received correctly. </li></ul><ul><li>The window size gives the number of bytes the receiver can accept. </li></ul><ul><li>The checksum covers both header and data </li></ul><ul><li>The urgent pointer identifies the start of data in the stream that must be processed urgently. </li></ul>Source Port Destination Port Sequence Number Acknowledgement Number Header Length Code Bits Window Checksum Urgent pointer Options Padding
  12. 12. What is a Port? <ul><li>Refers in this context a software port </li></ul><ul><li>Multiple applications or upper layer protocols may use TCP simultaneously </li></ul><ul><ul><li>Ports are used to map TP data to a specific process </li></ul></ul><ul><ul><li>The combination of an IP address and a port number is called a socket </li></ul></ul><ul><ul><li>Sockets can be full duplex (data transmitted in both directions) or half duplex </li></ul></ul><ul><li>Typical Port numbers: </li></ul><ul><ul><li>20/21 FTP </li></ul></ul><ul><ul><li>23 Telnet </li></ul></ul><ul><ul><li>25 Simple Mail Transfer Protocol </li></ul></ul><ul><ul><li>37 Time </li></ul></ul><ul><ul><li>53 Domain Name System </li></ul></ul><ul><ul><li>80 HTTP </li></ul></ul><ul><ul><li>110 POP3 </li></ul></ul><ul><ul><li>443 HTTPS </li></ul></ul>
  13. 13. TCP Communication: Making a Connection <ul><li>A connection must be established before any data is sent </li></ul><ul><li>Segments are only sent between client and server if there is data to flow. </li></ul><ul><li>No status polling takes place. </li></ul><ul><li>To Start: </li></ul><ul><ul><li>The server listens out for connection requests. </li></ul></ul><ul><ul><li>The client requests a connection by sending specifying its own port number and the port that it wants to connect to . </li></ul></ul><ul><ul><li>The SYN (synchronize sequence numbers) flag is set and the client’s initial data sequence number is specified. </li></ul></ul><ul><li>Next: </li></ul><ul><ul><li>The server responds with a segment in which the header contains its own initial data sequence number. </li></ul></ul><ul><li>To complete the connection : </li></ul><ul><ul><li>the client acknowledges the server’s data sequence number by sending back a segment with the ACK flag set and the acknowledgement field containing the server’s data sequence number plus one. </li></ul></ul>
  14. 14. TCP Communication: Data Transmission <ul><li>TCP is a sliding window protocol , and does not wait for acknowledgement </li></ul><ul><li>To prevent overflow of receiver buffer: </li></ul><ul><ul><li>An acknowledgement is sent containing the with the window size set to zero. </li></ul></ul><ul><ul><li>Later a windows update is sent, specifying the new window size. </li></ul></ul><ul><li>For efficiency: </li></ul><ul><ul><li>TCP can specify an acknowledgement delay in the hope that within that time some data will need to be sent the other way, and the two can ride together </li></ul></ul><ul><ul><li>The Nagle algorithm allows a TCP segment containing less data than the receiver’s advertised window size can only be sent if the previous segment has been acknowledged. This allows aggregation of small amounts of data </li></ul></ul>
  15. 15. TCP Communication: Error Correction <ul><li>In error situations TCP can: </li></ul><ul><ul><li>detect whether data has been successfully received at the other end </li></ul></ul><ul><ul><li>take steps to rectify the situation. </li></ul></ul><ul><ul><li>inform the sending application of the problem and failure, if all else fails, </li></ul></ul><ul><li>Data lost or corrupted. </li></ul><ul><ul><li>TCP keeps track of the acknowledgements for the data it sends. </li></ul></ul><ul><ul><li>If an acknowledgement is not received within an specified time data is resent </li></ul></ul><ul><ul><li>Time interval TCP will wait before depends on the connection speed (The protocol monitors the time it normally takes to receive an acknowledgement) </li></ul></ul><ul><ul><li>Data is resent repeatedly, at ever-increasing intervals, until either a response is received or an application timeout value is exceeded </li></ul></ul><ul><li>Deadlock of flow </li></ul><ul><ul><li>a receiver stops the data flow by setting its window size to zero and the window update segment that is meant to start data flowing again is lost. </li></ul></ul><ul><ul><li>To prevent deadlock from occurring, TCP sends out window probe messages at regular intervals to query the receiver about its window size. </li></ul></ul>
  16. 16. TCP Communication: Communication Closure <ul><li>Each direction of data flow must be closed down separately. </li></ul><ul><li>Steps: </li></ul><ul><ul><li>One end of the connection sends a segment in which the FIN (finished sending data) flag is set. </li></ul></ul><ul><ul><li>The receipt of this segment is acknowledged, </li></ul></ul><ul><ul><li>The receiving end notifies its application that the other end has closed that half of the connection. </li></ul></ul>
  17. 17. User Datagram Protocol <ul><li>UDP is a simple protocol </li></ul><ul><li>UDP is unreliable and connectionless </li></ul><ul><ul><li>A connection with a host is not necessary before exchanging data </li></ul></ul><ul><ul><li>No mechanism for ensuring that data sent is received </li></ul></ul><ul><li>Main function is to specify the upper layer protocols </li></ul><ul><li>Useful for broadcasting since it does not require a connection </li></ul>
  18. 18. UDP Packet Header <ul><li>Two different application one using UDP and another using TCP may use the same port number. The two data streams are distinguished by the protocol field in the IP address header </li></ul><ul><li>The checksum is optional. </li></ul>Source Port Destination Port Message length Checksum
  19. 19. Unicast, Broadcast, Multicast Unicast One sender – one receiver Broadcast Sends data to all possible receivers Multicast Sends data to interested receivers Applications of IP Multicast: Pay TV File Transfer Financial Information But is complex to implement