Tcp Udp Icmp And The Transport Layer


Published on

Tcp Udp Icmp And The Transport Layer

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 Udp Icmp And The Transport Layer

  1. 1. TCP,UDP, ICMP and the transport layer Lecture February 4,2001 Professor Tom Mavroidis
  2. 2. Protocols <ul><li>IP is a connectionless, datagram-oritented, and packet forwarding protocol </li></ul><ul><li>IP sends a packet based on the destination IP address and routing information held internally within the protocol </li></ul><ul><li>Packets may pass through several gateways or hops before reaching their destination </li></ul>
  3. 3. IP - Internet Protocol <ul><li>Unreliable protocol </li></ul><ul><li>relies on best-effort delivery </li></ul><ul><li>packets are not acknowledged </li></ul><ul><li>Designed to be simple, efficient, and straightforward to implement </li></ul>
  4. 4. ICMP - Internet Control Message Protocol <ul><li>Located in the Network Layer </li></ul><ul><li>Purpose is to provide error control to IP </li></ul><ul><li>Two basic types of messages: </li></ul><ul><li>error control and querying </li></ul>
  5. 5. Common error control ICMP messages <ul><li>3 Destination Unreachable </li></ul><ul><li>4 Source Quench </li></ul><ul><li>5 Redirection </li></ul><ul><li>11 Time Exceeded </li></ul><ul><li>12 Parameter Problem </li></ul>
  6. 6. ICMP Messages for Querying <ul><li>0 Echo Reply </li></ul><ul><li>8 Echo Request </li></ul><ul><li>9 Router Advertisement </li></ul><ul><li>10 Router Solicitation </li></ul><ul><li>13 Timestamp Request </li></ul><ul><li>14 Timestamp Reply </li></ul><ul><li>17 Address Map Request </li></ul><ul><li>18 Address Mask Reply </li></ul>
  7. 7. UDP - User Datagram Protocol <ul><li>Transport-layer Protocol </li></ul><ul><li>Used mainly for one way, short communications </li></ul><ul><li>datagrams don’t contain information about other packets </li></ul><ul><li>Each packet independent of each other </li></ul><ul><li>Messages can be no larger than the max UDP packet size </li></ul>
  8. 8. UDP - continued <ul><li>Lack of error control </li></ul><ul><li>Checksum is only check, packet is dropped if incorrect </li></ul><ul><li>Relies on ICMP for error control </li></ul><ul><li>Good alternative for short messages without large communications overhead used by TCP </li></ul>
  9. 9. TCP - Transmission Control Protocol <ul><li>Used where reliable communications is required </li></ul><ul><li>Provisions for error control, streaming data, and two way communications </li></ul><ul><li>Connections are managed both ways using flags in the TCP packet header </li></ul>
  10. 10. Three way handshake TCP <ul><li>SYN(synchronize) - sent at the beginning of a connection from source host. Contains initialization information. </li></ul><ul><li>ACK(acknowledgement) - sent when packet has been received by the destination host </li></ul><ul><li>SYN - then sent by destination host </li></ul><ul><li>ACK - sent by source host </li></ul>
  11. 11. TCP error control <ul><li>Implemented through the ACK flag </li></ul><ul><li>Each packet numbered and a timer is started on transmission </li></ul><ul><li>Packet is retransmitted if ACK not received before timeout </li></ul>
  12. 12. IP Packet Format - Header Length field <ul><li>Specifies length of header </li></ul><ul><li>Is in 32-bit works </li></ul><ul><li>Maximum header size of 60 bytes </li></ul><ul><li>Normally length is 5 </li></ul>
  13. 13. Version Field <ul><li>Carries the current version of IP </li></ul><ul><li>Currently 4 IPv4 </li></ul><ul><li>Next version will be 6 IPv6 </li></ul><ul><li>Also called Ipng - next generation </li></ul>
  14. 14. Service Type Field <ul><li>Used by some routers when deciding how to forward the datagram </li></ul><ul><li>Choices are quickest, cheapest, most reliable, or highest bandwidth </li></ul><ul><li>Datagram can be sent with no Service Type flag set </li></ul>
  15. 15. Total Length Field <ul><li>Overall size of the datagram in bytes including the header </li></ul><ul><li>Maximum datagram size of 65,536 bytes or 64kb </li></ul>
  16. 16. Identification, Flags, and Fragment Offset fields <ul><li>Used to control fragmentation and reassembly of datagrams if necessary </li></ul>
  17. 17. Time to live field <ul><li>Counter that is decremented every time the packet crosses a gateway. </li></ul><ul><li>When counter reaches 0 packet is discarded </li></ul>
  18. 18. Protocol Field <ul><li>Indicates which transport protocol is to receive the packet at the destination </li></ul><ul><li>All IP protocols (TCP,UDP,ICMP) carry checksums of their own headers and data </li></ul><ul><li>The header checksum only covers the IP header to avoid redundancy </li></ul><ul><li>Corrupt IP layer datagrams are discarded at the same layer at the receiving end </li></ul>
  19. 19. IP Options <ul><li>Can be used to cover the routing </li></ul><ul><li>strict- or loose-source routing </li></ul><ul><li>security and handling restrictions </li></ul><ul><li>can record the addresses of routers the datagram passes through and at what time </li></ul><ul><li>some routers ignore these options </li></ul>
  20. 20. IP Checksum <ul><li>Adds considerable overhead </li></ul><ul><li>IPv6 is removing this checksum </li></ul>
  21. 21. Type of Service (TOS) <ul><li>Allows a packet to be routed : </li></ul><ul><ul><li>minimal delay </li></ul></ul><ul><ul><li>maximal throughput </li></ul></ul><ul><ul><li>maximal reliability </li></ul></ul><ul><ul><li>minimal cost </li></ul></ul>
  22. 22. Fragmentation and Reassembly <ul><li>Transport layer passes data to IP </li></ul><ul><li>IP organizes data into datagram </li></ul><ul><li>If datagram is larger than Maximum Transmission Unit (MTU), IP will split data into smaller packets called fragments </li></ul><ul><li>Fragments are encapsulated in individual IP packets, sent to destination host, and then reassembled. </li></ul>
  23. 23. Fragmentation and Reassembly <ul><li>Packets could be routed via different routes </li></ul><ul><li>Therefore reassembly only takes place at the destination host </li></ul><ul><li>MTU’s may vary from network to network </li></ul><ul><li>If datagram containing a fragment encounters a network with a smaller MTU, the fragment is fragmented further </li></ul>
  24. 24. Fragmentation and Reassembly <ul><li>You can specify to the Transport layer that a datagram not be fragmented. </li></ul><ul><li>If the packet finds a network with a smaller MTU, it will be discarded and ICMP will cause an error message to be sent back </li></ul>
  25. 25. Record Route Option <ul><li>The route that the packet took is inserted into the IP Header in the sequence that it passed through all routers </li></ul><ul><li>The IP addresses of the routers is recorded </li></ul><ul><li>There is a limited amount of space to record this information, and data will be truncated </li></ul><ul><li>Instead use a utility like Traceroute </li></ul>
  26. 26. Timestamp Option <ul><li>Extension to Record Route </li></ul><ul><li>Time and date packet passed through router is recorded with its IP address </li></ul><ul><li>Same space limitations as Record Route </li></ul><ul><li>Times on routers may not be synchronized giving misleading information </li></ul><ul><li>Not a popular method and many routers don’t support it </li></ul>
  27. 27. Source Routing <ul><li>Specifies which route a packet follows </li></ul><ul><li>Two Methods </li></ul><ul><ul><li>Loose-source routing (specifies a list of routers the packet must pass through, may also pass through routers not listed) </li></ul></ul><ul><ul><li>Strict-source routing (explicitly specifies which routers the packet must pass through, and may not travel via any that are not listed </li></ul></ul>
  28. 28. Source Routing <ul><li>Many routers refuse to accept source-routed packets </li></ul><ul><li>Routing is usually controlled via the use of policy-based dynamic routing protocols </li></ul>
  29. 29. Error Handling - ICMP <ul><li>IP has no built in error handling </li></ul><ul><li>ICMP adds error reporting to IP </li></ul><ul><li>resides at the Network Layer </li></ul><ul><li>uses IP as its carrier </li></ul><ul><li>used for flow control as well -source quench </li></ul><ul><li>can request info i.e. timestamp, echo to ping </li></ul><ul><li>also sent in response to broadcast datagrams </li></ul>
  30. 30. ICMP Header Format <ul><li>ICMP messages are encapsulated in IP datagrams </li></ul><ul><li>Message has 4 parts </li></ul><ul><ul><li>type of message (15 different types) </li></ul></ul><ul><ul><li>message code (subtype, 16 different types) </li></ul></ul><ul><ul><li>checksum (covers both header and data) </li></ul></ul><ul><ul><li>data (will differ depending on type and code) </li></ul></ul>
  31. 31. ICMP Message types <ul><ul><li>8 echo request (sent by ping) </li></ul></ul><ul><ul><li>0 echo reply (received by ping) </li></ul></ul><ul><ul><li>3 destination unreachable </li></ul></ul><ul><ul><li>4 source quench </li></ul></ul><ul><ul><li>5 redirect </li></ul></ul><ul><ul><li>9 router advertisement </li></ul></ul><ul><ul><li>10 router solicitation </li></ul></ul><ul><ul><li>11 Time exceeded </li></ul></ul><ul><ul><li>12 Parameter problem </li></ul></ul><ul><ul><li>13 Timestamp request </li></ul></ul><ul><ul><li>14 Timestamp reply </li></ul></ul><ul><ul><li>15 Information request (obsolete) </li></ul></ul><ul><ul><li>16 Information reply (obsolete) </li></ul></ul><ul><ul><li>17 Address mask request </li></ul></ul><ul><ul><li>18 Address mask reply </li></ul></ul>
  32. 32. TCP and the Transport Layer <ul><li>Lives above the IP Layer </li></ul><ul><li>adds the missing pieces to IP </li></ul><ul><li>offers </li></ul><ul><ul><li>a way to talk to a specific application or host </li></ul></ul><ul><ul><li>reliable data transfer mechanism </li></ul></ul><ul><ul><li>way to send a continuous data stream </li></ul></ul><ul><ul><li>flow control of data </li></ul></ul>
  33. 33. The Transport Layer <ul><li>Directs data to and from applications across networks </li></ul><ul><li>Two types of protocols are </li></ul><ul><ul><li>connectionless (no guarantee of delivery to destination) </li></ul></ul><ul><ul><li>connection-oriented (establish connection, transfer data, close connection) </li></ul></ul>
  34. 34. Connection Oriented <ul><li>Two-way connection </li></ul><ul><li>Similar to that of a telephone conversation </li></ul><ul><li>Reliable </li></ul><ul><li>guaranteed delivery of data </li></ul>
  35. 35. TCP Frame Format
  36. 36. Frame Format <ul><li>TCP supports full duplex, byte-stream-oriented communication between processes </li></ul><ul><li>The data stream must be broken into segments that can be encapsulated in IP datagrams for transmissions </li></ul><ul><li>“ Source Port” and “Destination Port” identify the sending and receiving applications </li></ul>
  37. 37. Sequence Number <ul><li>Indicates the position of this segment in the data stream </li></ul>
  38. 38. Acknowledgment Number <ul><li>Indication of how much of the data stream has been successfully received </li></ul>
  39. 39. HLEN <ul><li>4-bits , gives the length of TCP in 32-bit words-max size 60 bytes-norm size 20 bytes </li></ul>
  40. 40. Code Bits field <ul><li>Flags for reset,sync,finish,etc. reside here </li></ul>
  41. 41. Window Field <ul><li>Indicates how many bytes the receiver can accept </li></ul>
  42. 42. Checksum <ul><li>Covers data in the segment, its header and the source and destination IP addresses and protocol value from the IP address </li></ul>
  43. 43. Urgent Pointer <ul><li>Mechanism for sending urgent data along with normal data </li></ul>
  44. 44. Options <ul><li>Similar to IP, options can be added to the header </li></ul>
  45. 45. TCP Handshaking <ul><li>Six flags </li></ul><ul><ul><li>SYN Sync seq #’s to initiate a connection </li></ul></ul><ul><ul><li>ACK Acknowledgment frame </li></ul></ul><ul><ul><li>RST Reset the connection </li></ul></ul><ul><ul><li>URG Urgent incoming data </li></ul></ul><ul><ul><li>PSH Pass data onto the app ASAP </li></ul></ul>
  46. 46. TCP Flow Control <ul><li>Indicates how many bytes of data can safely be received at any time, called the window </li></ul><ul><li>Window size is the max # of bytes that can be sent without receiving an ACK. </li></ul><ul><li>Receiver stores up segments regardless of the order they arrive in. </li></ul><ul><li>If duplicate segments are received they are discarded </li></ul>
  47. 47. Ports and Sockets <ul><li>A method for piping a data flow to and from a particular application </li></ul><ul><li>A socket is a pair of data queues for an application process (one send one receive) </li></ul><ul><li>A port is an address on a socket </li></ul><ul><li>Incoming data is bound via its port address to a socket </li></ul>
  48. 48. Port Numbers <ul><li>Servers listen on specific ports waiting for clients (RFC 1700) </li></ul><ul><li>Ports 1 to 1023 are managed by IANA (InterNet Assigned Numbers Authority) </li></ul><ul><ul><li>reserved for well-known services </li></ul></ul><ul><ul><li>known as privileged ports </li></ul></ul>