tcp udp icmp and the transport layer
DESCRIPTION
Tcp Udp Icmp And The Transport LayerTRANSCRIPT
TCP,UDP, ICMP and the transport layer
Lecture
February 4,2001Professor Tom Mavroidis
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
IP - Internet Protocol
Unreliable protocol relies on best-effort delivery packets are not acknowledged Designed to be simple, efficient, and
straightforward to implement
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
Common error control ICMP messages 3 Destination Unreachable 4 Source Quench 5 Redirection 11 Time Exceeded 12 Parameter Problem
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
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
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
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
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
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
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
Version Field
Carries the current version of IP Currently 4 IPv4 Next version will be 6 IPv6 Also called Ipng - next generation
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
Total Length Field
Overall size of the datagram in bytes including the header
Maximum datagram size of 65,536 bytes or 64kb
Identification, Flags, and Fragment Offset fields Used to control fragmentation and
reassembly of datagrams if necessary
Time to live field
Counter that is decremented every time the packet crosses a gateway.
When counter reaches 0 packet is discarded
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
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
IP Checksum
Adds considerable overhead IPv6 is removing this checksum
Type of Service (TOS)
Allows a packet to be routed :– minimal delay– maximal throughput– maximal reliability– minimal cost
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.
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
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
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
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
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
Source Routing
Many routers refuse to accept source-routed packets
Routing is usually controlled via the use of policy-based dynamic routing protocols
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
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)
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
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
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)
Connection Oriented
Two-way connection Similar to that of a telephone conversation Reliable guaranteed delivery of data
TCP Frame Format
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
Sequence Number
Indicates the position of this segment in the data stream
Acknowledgment Number
Indication of how much of the data stream has been successfully received
HLEN
4-bits , gives the length of TCP in 32-bit words-max size 60 bytes-norm size 20 bytes
Code Bits field
Flags for reset,sync,finish,etc. reside here
Window Field
Indicates how many bytes the receiver can accept
Checksum
Covers data in the segment, its header and the source and destination IP addresses and protocol value from the IP address
Urgent Pointer
Mechanism for sending urgent data along with normal data
Options
Similar to IP, options can be added to the header
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
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
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
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