48
TCP,UDP, ICMP and the transport layer Lecture February 4,2001 Professor Tom Mavroidis

Transport Layer

Embed Size (px)

DESCRIPTION

The Transport Layer

Citation preview

Page 1: Transport Layer

TCP,UDP, ICMP and the transport layer

Lecture

February 4,2001Professor Tom Mavroidis

Page 2: Transport Layer

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: Transport Layer

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: Transport Layer

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: Transport Layer

Common error control ICMP messages 3 Destination Unreachable 4 Source Quench 5 Redirection 11 Time Exceeded 12 Parameter Problem

Page 6: Transport Layer

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: Transport Layer

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: Transport Layer

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: Transport Layer

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: Transport Layer

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: Transport Layer

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: Transport Layer

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: Transport Layer

Version Field

Carries the current version of IP Currently 4 IPv4 Next version will be 6 IPv6 Also called Ipng - next generation

Page 14: Transport Layer

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: Transport Layer

Total Length Field

Overall size of the datagram in bytes including the header

Maximum datagram size of 65,536 bytes or 64kb

Page 16: Transport Layer

Identification, Flags, and Fragment Offset fields Used to control fragmentation and

reassembly of datagrams if necessary

Page 17: Transport Layer

Time to live field

Counter that is decremented every time the packet crosses a gateway.

When counter reaches 0 packet is discarded

Page 18: Transport Layer

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: Transport Layer

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: Transport Layer

IP Checksum

Adds considerable overhead IPv6 is removing this checksum

Page 21: Transport Layer

Type of Service (TOS)

Allows a packet to be routed :– minimal delay– maximal throughput– maximal reliability– minimal cost

Page 22: Transport Layer

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: Transport Layer

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: Transport Layer

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: Transport Layer

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: Transport Layer

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: Transport Layer

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: Transport Layer

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: Transport Layer

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: Transport Layer

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: Transport Layer

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: Transport Layer

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: Transport Layer

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: Transport Layer

Connection Oriented

Two-way connection Similar to that of a telephone conversation Reliable guaranteed delivery of data

Page 35: Transport Layer

TCP Frame Format

Page 36: Transport Layer

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: Transport Layer

Sequence Number

Indicates the position of this segment in the data stream

Page 38: Transport Layer

Acknowledgment Number

Indication of how much of the data stream has been successfully received

Page 39: Transport Layer

HLEN

4-bits , gives the length of TCP in 32-bit words-max size 60 bytes-norm size 20 bytes

Page 40: Transport Layer

Code Bits field

Flags for reset,sync,finish,etc. reside here

Page 41: Transport Layer

Window Field

Indicates how many bytes the receiver can accept

Page 42: Transport Layer

Checksum

Covers data in the segment, its header and the source and destination IP addresses and protocol value from the IP address

Page 43: Transport Layer

Urgent Pointer

Mechanism for sending urgent data along with normal data

Page 44: Transport Layer

Options

Similar to IP, options can be added to the header

Page 45: Transport Layer

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: Transport Layer

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: Transport Layer

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: Transport Layer

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