Chapter 9: Transport Layer
to terminate a single conversation supported by TCP
-4 exchanges are needed to end both sessions note: termination process can be initiated by any 2 hosts that have an open session
flags
-6 bits n Control Bits field of TCP segment header -a bit that is either set to on or off
TCP Feature: Same-Order Delivery
-Because networks may provide multiple routes that can have different transmission rates, data can arrive in wrong order -By numbering and sequencing segments, TCP can ensure that these segments are reassembled into proper order -ensures that segments are reassembled into proper order
Transport Layer Responsibility: Segmenting Data and Reassembling Segments
-Data must be prepared to be sent across media in manageable pieces -Most networks have a limitation on amount of data that can be included in a single packet -Transport layer protocols have services that segment application data into blocks that are an appropriate size -This service includes encapsulation required on each piece of data -At the destination, transport layer must be able to reconstruct pieces of data into a complete data stream that is useful to application layer -The protocols at transport layer describe how the transport layer header information is used to reassemble data pieces into streams to be passed to application layer
three-way handshake
-Establishes that destination device is present on network -Verifies that destination device has an active service and is accepting requests on destination port number that the initiating client intends to use -Informs destination device that source client intends to establish a communication session on that port number Note: to establish connection, hosts perform a 3-way handshake
TCP provides other services
-Establishing a session -Reliable Delivery Same-Order Delivery -Flow Control
to close a connection
-Finish (FIN) control flag must be set in segment header
Multiplexing
-Multiple applications can use network at same time
TCP Feature: Flow Control
-Network hosts have limited resources, like memory and processing power. -When TCP is aware that these resources are overtaxed, it can request that sending application reduce rate of data flow. -This is done by TCP regulating amount of data source transmits. -Flow control can prevent need for retransmission of data when receiving host's resources are overwhelmed. -ensures that receiver is able to process data received
TCP, 3 basic operations of reliability
-Numbering and tracking data segments transmitted to a specific host from a specific application -Acknowledging received data -Retransmitting any unacknowledged data after a certain period of time
Transport Layer services
-Segmentation allows conversation multiplexing -segmenting the data into smaller chunks enables many different communications, from many different users, to be interleaved (multiplexed) on the same network
conversation multiplexing
-Sending some types of data (like streaming video) across a network, as one complete communication stream, can consume all of available bandwidth -This will then prevent other communications from occurring at the same time -It would also make error recovery and retransmission of damaged data difficult
each TCP segment has 20 bytes of overhead in the header encapsulating the application layer data:
-Source Port (16 bits) and Destination Port (16 bits): Used to identify the application -Sequence number (32 bits): Used for data reassembly purposes -Acknowledgment number (32 bits): Indicates data has been received and next byte expected from source -Header length (4 bits): Known as ʺdata offsetʺ. Indicates length of TCP segment header. -Reserved (6 bits): This field is reserved for the future. -Control bits (6 bits): Includes bit codes, or flags, which indicate the purpose and function of the TCP segment -Window size (16 bits): Indicates number of bytes that can be accepted at one time -Checksum (16 bits): Used for error checking of segment header and data -Urgent (16 bits): Indicates if data is urgent
TCP connection is established in 3 steps
-Step 1: Initiating client requests a client-to-server communication session with the server -Step 2: Server acknowledges client-to-server communication session and requests a server-to-client communication session -Step 3: initiating client acknowledges server-to-client communication session
TCP Connection Termination
-Step 1: When the client has no more data to send in stream, it sends a segment with FIN flag set -Step 2: server sends an ACK to acknowledge receipt of FIN to terminate session from client to server -Step 3: server sends a FIN to client to terminate server-to-client session -Step 4: client responds with an ACK to acknowledge FIN from the server Note: when all segments have been acknowledged, session is closed
TCP Header
-TCP is a stateful protocol -To track state of a session, TCP records which information it has sent and which information has been acknowledged -The stateful session begins with session establishment and ends when closed with session termination.
Transport Layer Responsibility: Identifying the Applications
-To pass data streams to proper applications, the transport layer must identify the target application -To accomplish this, the transport layer assigns each application an identifier called a port number -Each software process that needs to access network is assigned a port number unique to that host -transport layer ensures that even with multiple applications running on a device, all applications receive correct data
2 transport layer protocols TCP/IP provides
-Transmission Control Protocol (TCP) -User Datagram Protocol
Port Number groups
-Well-known Ports (Numbers 0 to 1023) -Registered Ports (Numbers 1024 to 49151) -Dynamic or Private Ports (Numbers 49125 to 65535) Note: Some client operating systems may use registered port numbers instead of dynamic port numbers for assigning source ports
Example of TCP Server Processes
-a host running a web server application and a file transfer application cannot have both configured to use same port (for example, TCP port 80) -An active server application assigned to a specific port is considered to be open, which means that transport layer accepts and processes segments addressed to that port -Any incoming client request addressed to correct socket is accepted, and data is passed to server application -There can be many ports open simultaneously on a server, one for each active server application
stateful protocol
-a protocol that keeps track of state of communication session
to end each one-way TCP session
-a two-way handshake, consisting of a FIN segment and an Acknowledgement (ACK) segment, is used
Dynamic or Private Ports (Numbers 49152 o 65535)
-also known as ephemeral ports -assigned dynamically by client's OS hen a connection to a service is initiated -dynamic port is then used to identify client application during communication
TCP transport
-analogous to sending packages -tracked from source to destination -more robust communication between applications -additional overhead could reduce usefulness of application and can even be detrimental -possible delays in transmission
UDP is used as the transport protocol in these situations
-application can tolerate some data loss during transmission over network, but delays in transmission are unacceptable note: -UDP is the better choice for these applications because less network overhead is required -UDP is preferable for applications like streaming live audio, live video, and Voice over IP (VoIP) -Acknowledgments and retransmission would slow down delivery
Example of when applications are designed to use TCP
-applications like databases, web browsers, and email clients, require that all data that is sent arrives at destination in its original condition -Any missing data could cause a corrupt communication that is either incomplete or unreadable
Registered Ports (Numbers 1024 to 49151)
-are assigned by IANA to a requesting entity to use with specific processes or applications -these processes are primarily individual applications that a user has chosen to install, rather than common applications that would receive a well-known port number -EX: Cisco has registered port 1985 for its Hot Standby Routing Protocol (HSRP) process
source port numbers acts
-as a return address for requesting application -transport layer keeps track of this port and application that initiated request so that when a response is returned, it can be forwarded to correct pplication
Unexplained TCP connections
-can pose a major security threat -indicate that something r someone is connected to local host -sometimes it is necessary to know which active TCP connections are open and running on a networked host
Destination Port
-client places a destination port number in the segment to tell destination server what service is being requested -EX: when a client specifies port 80 in the destination port, server that receives message knows that web services are being requested. A server can offer more than one service simultaneously like web services on port 80 at same time that it offers File Transfer Protocol (FTP) connection establishment on port 21.
Socket
-combination of source IP address and source port number -or, destination IP address and destination port number -used to identify server and service being requested by client
UDP Features
-considered a best-effort transport protocol -lightweight transport protocol that offers same data segmentation and reassembly as TCP, but without TCP reliability nd flow control -simple protocol that it is usually described in terms f what it does not do compared to TCP
most important requirements for delivering live video and voice over network
-data continues to flow quickly -Live video and voice applications can tolerate some data loss with minimal or no noticeable effect, and are perfectly suited to UDP
TCP Feature: Establishing a Session
-devices negotiate amount f traffic that can be forwarded at a given time -communication data between 2 can be closely managed -ensures application is ready to receive data
Source Port
-dynamically generated by sending device to identify a conversation between 2 devices -process allows multiple conversations to occur simultaneously -common for a device to send multiple HTTP service request to a web server at same time -each separate HTTP conversation is tracked based on source ports
TCP Server Processes
-each application process running on the server is configured to use a port number either by default or manually, by a system administrator -an individual server cannot have two services assigned to same port number within same transport layer services
IP uses TCP and UDP protocols to
-enable hosts to communicate and transfer data
reliability (in networking terms)
-ensuring that each segment that source sends arrives at destination
Segmentation (9.1.1.3 Conversation Multiplexing)
-facilitates data transport by lower network layers
TCP is used as the transport protocol in these situations
-for some application, segments must arrive in a very specific sequence to be processed successfully -other applications, all data must be fully received before any is considered useful
TCP connections
-host clients establishes connection with the server Connections on the network is similar like 2 people greeting each other by shaking each other's hand
Transport Layer Responsibility: Tracking Individual Conversations
-host may have multiple applications that are communicating across network simultaneously -each applications communicates with 1 or more applications on 1 or more remote hosts -responsibility of transport layer to maintain and track these multiple conversations -tracks each individual conversation flowing between a source application and a destination application separately
Example of when applications are designed to use UDP
-if one or two segments of a live video stream fail to arrive, it creates a momentary disruption in the stream -This may appear as distortion in the image or sound, but may not be noticeable to the user -If destination device had to account for lost data, stream could be delayed while waiting for retransmissions, therefore causing the image or sound to be greatly degraded -In this case, it is better to render best media possible with segments received, and forego reliability
Netstat
-important network utility that can be used to verify those connections
TCP header
-increases size of packet -increases delay
Control bits in the TCP header
-indicate progress -status of connection
netstat command
-lists protocols in use -lists local address and port numbers -lists foreign address and port numbers -lists connection state -will attempt to resolve IP addresses to domain names and port numbers to well-known applications
Transport layer is also responsible
-managing reliability requirements of a conversation -different applications have different transport reliability requirements
Socket enables
-multiple processes -running on a client -to distinguish themselves from each other -multiple connections to a server process to be distinguished from each other
Multiple separate conversations on transport layer
-must be able to separate and manage multiple communications with different transport requirement needs -Users expect to be able to simultaneously receive and send email and instant messages, view websites, and conduct a VoIP phone call -Each of these applications is sending and receiving data over network at same time, despite different reliability requirements. -Additionally, data from phone call is not directed to the web browser, and text from an instant message does not appear in an email.
stateless protocol
-neither client, nor server, is obligated to keep track of state of communication session
9.2.1.5: VD- TCP 3-Way Handshake
-no notes
Error Checking
-performed on data in segment to check if segment was changed during transmission
datagrams
-pieces of communication in UDP -are sent as best-effort by transport layer protocol -UDP has a low overhead of 8 bytes
TCP Feature: Reliable Delivery
-possible for a segment to become corrupted or lost completely, as it is transmitted over network -ensures that receiver is able to process data received
UDP transport/best-effort delivery protocol
-provides basic function for delivering data segments between appropriate applications -very little overhead -data checking -no transport layer processes that inform sender of a successful delivery -EX: similar to placing a regular, non-registered, letter in the mail
TCP
-reliable -full-featured transport layer protocol, which ensures that all of data arrives at destination -requires additional fields in TCP header
Well-known Ports (Numbers 0 to 1023)
-reserved for services and applications -commonly used for applications like web browsers, email clients, and remote access clients -defining these well-known ports for server applications, client applications can be programmed to request a connection to that specific port and its associated service
Transport layer
-responsible for establishing a temporary communication session between 2 applications and delivering data between them -application generates data that is sent from an application on a source host to an application on a destination host -without regard to destination host type. type of media over which data must travel, path taken by data, congestion on a link, or size of network -link between application layer and lower layers that are responsible for network transmission
source and destination ports are placed with the segment
-segments are then encapsulated within an IP packet. -IP packet contains the IP address of source and destination
After the communication is completed
-sessions are closed, and connection is terminated -connection and session mechanisms enable TCP's reliability function
Conversation
-set of data flowing between a source application and a destination application
UDP
-simpler transport layer protocol -does not provide for reliability -fewer fields -faster than TCP
Port numbers
-source port number is associated with originating application on local host -destination port number is associated with destination application on remote host
Transport protocols
-specify how to transfer messages between hosts
Internet Assigned Numbers Authority (IANA)
-standards body responsible for assigning various addressing standards -including port numbers
IP concerned only
-structure -addressing -routing -does not specify how delivery or transportation of packets takes place
identify each segment of data
-transport layer adds a header containing binary data organized into several fields -It is values in these fields that enable various transport layer protocols to perform different functions in managing data communication
port number
-transport layer assigns each application an identifier
Segmentation
-transport layer divides data into segments that are easier to manage and transport
context of networking, best-effort delivery
-unreliable because there is no acknowledgment that data is received at destination
Header
-used for reassembly -is added to each block of data -used to track data stream
-n option
-used to display IP addresses and port numbers in their numerical form
RST flag
-used to reset a connection when an error or timeout occurs
TCP and UDP manages these multiple simultaneous conversations by
-using header fields that can uniquely identify these applications -these unique identifiers are port numbers
connection-oriented protocol
-what TCP is -one that negotiates and establishes a permanent connection (or session) between source and destination devices prior to forwarding any traffic
client socket might look like
-with 1099 representing source port number: 192.168.1.5:1099 -socket on web server might be: 192.168.1.7:80 -together, these 2 sockets combine to form a socket pair: 192.168.1.5:1099, 192.168.1.7:80
9.1.2.6: Port Numbers
Note: Data for different applications is directed to correct application because each application has a unique port number