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