Transcript for:
Understanding the Transport Layer in Networking

welcome back to the ccna cisco netacad introduction to networks lecture series if you are interested in the previous lectures i will leave a link in the description for the playlist today we will be focusing on module number 14 which is the transport layer in this module we will compare the operations of transport layer protocols in supporting end-to-end communication we will cover the transportation of data tcp overview udp overview port numbers which are most common port numbers that you should be familiar with in this course tcp communication process reliability and flow control and udp communication process transportation of data role of the transport layer the transport layer is responsible for logical communications between applications running on different hosts the link between the application layer and the lower layers that are responsible for the network transmission the transport layer provides the end-to-end communications between host to host so that is a very important concept that you should familiar with the transfer protocols only run on n devices and it provides the end to end communication between host to host on the right hand side of the screen you have this diagram of the tcp ip model and you can see the transport layer sandwiched between the application layer and the internet layer and therefore the transport layer moves data between applications on devices in the network if you look at the osi model the transport layer sandwiched between the session layer and the network layer however the purpose of this layer even in the osi model is the transmit data using transmission protocols such as tcp and udp in this course you should be familiar with bot osi model as well as the tcp ip model because these models will show up on new quizzes and exams transport layer responsibilities the transport layer has the following responsibilities tracking individual conversations segmenting data and reassembling segments adds header information identify separate and manage multiple conversations uses segmentation and multiplexing to enable different communication conversations to be inter-levered on the same network so what this but this basically means is that transport layer is responsible for tracking the the communications between the end devices and it is also responsible for segmenting data when data is segmented it is also responsible for reassembling data so if we have segment of data coming from one end to the other and transport layer also responsible for putting them together it also adds header information and it is able to manage those different pieces of information by separating them using the you know configurations of the transport layer and that's what this slide is trying to get you and make sure that you understand those concepts ip does not specify how the delivery or transportation of the packets take place transport layer protocols specify how to transfer messages between host and are responsible for managing reliability requirements of a conversation the transport layer includes the tcp and udp protocols so if you look at in here the transport layer is using the tcp protocol and the udp protocol for its processors in the next few slides we will go over this tcp and udp in little bit in depth transmission control protocol or tcp provides reliability and flow control tcp basic operations includes number and track segments transmitted to a specific host from a specific application acknowledge receive data re-transmit any unacknowledged data after a certain amount of time sequence data that might arrive in wrong order in other words if the speed of transmission is different in different links of the your your network this those data may arrive in wrong order but the tcp can make sure that it can resequence them together in correct order send data at an efficient rate that is acceptable by the receiver so we will go over this a little bit uh later in this course uh so what happen is sometimes when you send data the data that been sent from one device to the next device may not be coming at the same rate so the the tcp has the ability to communicate that information with the sender and then make sure those are efficiently controlled so those the data rates are acceptable by the receiving end user datagram protocol or udp udp provides the basic functions for developing datagrams between the appropriate applications with very little overhead and data checking this is a very important concept the reason why we use udp is it has a very little overhead udp is a connection less protocol udp is known as best effort delivery protocol because there is no acknowledgement that the data is received at the destination if you are watching this youtube video right now what youtube uses to buffer your video is the udp protocol what the advantage of udp protocol over tcp even though it it does not have that those verifications that used by the tcp protocol is that it has a very little overhead so it's perfect for certain applications the right transport layer protocol for the right applications so udp is used by request and reply applications where the data is minimal and retransmission can be done quickly if it is important that all data arrives and that it can be processed in its proper sequence then you need to use the tcp so for example udp are used in wipe the voice server internet protocol and dns while the tcp is used for emails smtp imap and uh http https web uh host so in udp remember it is fast low overhead does not require acknowledgement does not resend lost data and delivers data as it arrives as opposed to tcp is very reliable and acknowledges data resend the lost data and delivers data in sequence order and remember we use both protocols udp and tcp today tcp overview there are a few tcp features that you should be familiar with they include the establish a session ensure reliable delivery provides same order delivery and support flow control so what it's mean is basically establishing a session a tcp is a connection oriented protocol that negotiates and establishes a permanent connection or session between the source and the destination devices prior to forwarding any traffic and it ensures the reliable delivery and how it does is it is possible for a segment to become corrupted or lost completely as it transmit over the network so what the tcp does is ensure that each segment that is sent by the source arrive at the destination correctly it provides the same order delivery because the networks may provide multiple routes that can have different transmission rate as i mentioned before and data can arrive in wrong order and the tcp can put them together in the correct order it also supports the flow controls where the network costs have limited resources such as memory or processing power when the tcp is aware of that and it is overextended it can request that the sending application reduce the rate of data flow if you look at the tcp header remember tcp is a stateful protocol which mean it keeps track of the state of the communication session and the tcp records which information it has sent and which information has been acknowledged so if you look at the header we have the source port we have the destination port we have the sequence numbers acknowledgement number and bunch of other information contained within them i will go over which information in the tcp header is important for the cisco netacad ccna exams on my next slide so if you look at the tcp header fields we have the source port destination port sequence number acknowledgement number header length we have a reserved field control bits window size checksum and the urgent field what's important to discuss are highlighted in blue and i will quickly go over them this is a very important slide for your exams and quizzes for ccna as well as on ccnp exams so make sure that you really understand the ones that are highlighted so on the tcp header fields the important one of the important one is the source port which is a 16-bit field used to identify the source of the application by port number and the next one is the destination port which is a 16 bit field used to identify the destination application by port number the sequence number is a 32-bit field used for data reassembly purposes acknowledgement number is a 32-bit field used to indicate the data that has been received and the next byte expected from the source the window size is a 16-bit field used to indicate the number of bytes that can be accepted at one time while the checksum is like a fingerprint a 16-bit field used for error checking for segment header and the data so for your exams and quizzes for this particular class and lecture series what you need to remember is the one that highlighted in blue those are very important concepts and you should know them by hand applications that use tcp tcp handles all tasks associated with dividing the data stream into segments providing reliability controlling data flow and reordering segments those applications include ftp smtp ssh http etc that's shown on the right hand side of your screen next we will cover udp udp features includes data is reconstructed in the order that it is received and any segments that are lost are not resent in udp there is no session establishment which we have in tcp the sending is not informed about the resource availability so these are key features in udp so if you contrast ctcp with udp you can already see the differences by just looking at this list udp header the udp header is far simpler than the tcp header because it only has four fields and require eight bytes so that's a very important concept that you should also know and those four fields include the source port destination port the length and checksum and if you look at the tcp header uh you should know all of these four the source port destination port length and checksum the source port and destination port is same as the tcp it is a six there are 16 bit fields to identify the source and destination application by port number the length is the same as the tcp which is a 16 bit field indicating the length of however in this case the day udp datagram header similar to tcp not exactly the same but you know it still has that length uh field but in this case we have a 16-bit field that indicates the length of the udp datagram header and the checksum again same or similar to the tcp header we have the 16-bit field used for error checking datagram header and data the applications that use udp live video and multimedia applications that includes the youtube use udp and this application can tolerate some data loss but require little or no delay for example wipe and live streaming videos right and simple request and reply applications applications with simple transactions where a host sent a request and many or sorry may or may not receive a reply an example would be dns or dhcp so when you connect a an end device to a network and it is looking for a dscp server you know the the request may or may not receive a reply because there may not be any available dhcp servers for example applications that handles reliability themselves unidirectional communications where flow control error detection acknowledgements and error recovery is not required or can be handled by the application itself can also use the udp those include the snmp and tftp protocols on the right hand side you will see a diagram with some of those protocols that mentioned here so the udp is used by dhcp dns snmp tftp wipe and video conferencing another example i give you is the live stream and videos from youtube for example even this video some of the buffering is happening at the udp level port numbers multiple separate communications tcp and udp transport layer protocols use port numbers to manage multiple simultaneous conversations the source port number is associated with the originating application on the localhost whereas the destination port number is associated with the destination application on the remote host remember there are two fields in both tcp and udp which includes the source port and the destination port and that's where the tcp udp port numbers come into play socket pairs the source and destination ports are placed within the segment the segments are then encapsulated within an ip packet the combination of the source ip address and source port number or the destination ip address and the destination port number is known as a socket so this is a very important concept that you should understand it shows up on ccna ccnp exams and quizzes almost guaranteed so if you were to ask what is considered as a socket a socket is the combination of the source ip address and the source port number or the destination ip address and the destination port number that's what define as a socket sockets enable multiple processors running on a client to distinguish themselves from each other and multiple connections to a server process to be distinguished from each other so what sockets enable you to do is multiple processes running on a client to distinguish themselves from each other and also multiple connections to a server process to be distinguished from each other so what that basically means is that if you have a client that is accessing a single server to obtain let's say two types of data in this case they are trying to access the ftp data and http data and what the source can do is to use the port 1305 on the ftp and 10.99 on the http and the web server gonna respond using the port 21 and the the port 80 on the server itself so the web server gonna use actually the port 80 and their file service is going to use the port 21 but they are all in the same server so that's what they you know that's what the importance of the socket itself port number groups the internet assigned numbers authority iana orina is the standard organization responsible for assigning various addressing remember i mentioned about this organization on our very first lecture i believe in module one this is one of those organizations aina that is responsible for the assigning various addresses so there are a couple of things you need to remember for this class those are the the range for the well-known ports range for the registered ports and you should know roughly the range for the private and no dynamic ports so the well-known ports falls between 0 to 1023 the registered port falls between 1024 to 49 151 and the private or dynamic ports uh start from forty nine thousand one hundred fifty two to sixty five thousand five hundred thirty five so well known ports are ports numbers that are reserved for common or popular services and applications such as web browsers email clients and remote access clients they are well defined and known ports for common server application and that enables clients to easily identify the associated service required the registered ports the support numbers that are assigned by aina 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 command applications that would receive a well-known port number an example of a registered port would be the cisco registered port 1812 or 1812 for the radius server authentication process used by the cisco devices private or dynamic ports are known as um ephemeral fault ports the client's os usually assign port numbers dynamically when a connection to a service is initiated the dynamic port is then used to identify the client application during communication so let's look at some of the well-known port numbers and for your exams you should be familiar with this i know it's a lot uh you but if you look at the all available port numbers this is way more than this is way less than what we have you know all the available port numbers so for these exams and quizzes you just have to remember this this set of port numbers and its associated application so we have port 20 which is used for ftp which is a tcp port 21 which is tcp again used for ftp port 22 is a tcp used for ssh which is a secure shell port 23 is a tcp for telnet for 25 for tcp for simple mail transfer protocol or smtp port 53 is used for udp and tcp 4067 is used for dscp port 68 is used for dynamic host configuration protocol clients so the dhcp clients um for port 69 ecs for uh tftp for 80 is tcp unused for http uh therefore web access port 110 is was used for emails uh 143 is also email as uh with the imap and then the port 161 and port 443 those are the ports numbers that you should be familiar with what i would say out of all of these things most of the exam question i got from is port 443 which is the tcp for https as opposed to port 80 which is http you may get questions related to port 21. so they will list bunch of port numbers and ask which one is the ftp and the other ones are not that important uh such as like the dhcp uh port number but you should be familiar with all of them as you go through all the labs as well as these course material you will eventually get to know these points if you are not familiar with them already if you have work in the industry or you have some interest in it you probably already know ports such as port 80 for http port 443 so tcp and port 21 for ftp you probably already familiar with this if you have you know use any devices such as raspberry pi and you know servers for example you should know all of these ports but you know just get familiar with it you don't need to really memorize it because as you learn go through this course you will probably gonna get to know them more than enough to write your final exam the net stat command unexplained tcp connections can pose a major security security threat the net stat is an important tool to verify connections so if you go to your windows computer and you open up your command prompt and type net stat and it will give you a screen similar to this and what is showing is any establish connections to your device and the associated addresses and the state of those established connections so that's a really neat command that you can use to test the connections not test actually to verify the connections associated with your end device so that's all you need to remember for with respect to the nest at command and again i have mentioned this on my previous modules some of these things that i actually go over i will cover it in a live demo video that i will be posting to my youtube channel later sometime tcp communication process tcp server processes each application process running on a server is configured to use a port number each application process running on a server is configured to use a port number an individual server cannot have two services assigned to the same port number within the same transport services an active server application assigned to a specific port is considered open which means that the transport layer accepts and process segments addressed to that port any incoming client request addressed to the correct socket is accepted and the data is passed to the server application so these are very important concepts like on the right hand side uh that's what they are trying to explain here you have two clients client one and client two and we have a server in here with two open ports uh configured ports http port which is a port 80 and smtp port which is the port 25. a server responds to tcp client uses the destination port from the request packet at the source port right so what's going to happen is when a client requests for a http page it's going to respond with the destination uh port so sorry the packet from the client goes to the server with the destination port 80 and the source port of the client going to be 49152 but if the client is requesting to smtp access uh from the server uh it's going to have the source port of 25 and the destination port which the client support going to be one uh sorry five one one five two so 51 152 so what that basically mean is tcp is using that the source and the destination port to determine how the packet should be routed tcp connection establishment so this is a very important topic i will post a link to a cisco created a demonstration as well as a like a presentation made by a cisco engineer that explained this concept as well this is very important that you understand the tcp connection establishment process for your exams as well as your labs otherwise you will be having a hard time uh you know understanding uh some advanced concepts that we'll be covering later down this lecture series so for tcp connection establishment the very first thing going to happen is the initiating the client request a server communication session with the server so the initiating client requests a client to serve a communication session with the server this is typically known as a sync or it's a syn sync it's sender sync and the server acknowledge the client to server communication session and request a server to client communication session so it's gonna send async arc back and then the next thing gonna happen is the initiating client acknowledge the server to client communication session so these steps are very important and it will show up on your exams and make sure that you understand that session termination this is also another concept that is very important that you understand and will show up on your exams both ccna and ccnp so in tcp session session community termination what's gonna happen when the client has no more data to send in the stream it send a segment with the fin flag set fin is like a n flag set so it send the fin flag the server sends an arc to acknowledge the receipt of the fin receipt of the fin to the termination to terminate the session from the client to server so basically the server sent an acknowledgement arc you know back to the client saying hey i got that information that you are stopping uh the data stream then the third thing is going to happen is the server send a fin to the client to terminate to server to client session and then the client respond with an arc to acknowledge the fin from the server so in this case what happened is we have the first step here so we have the client that has no more data so it send a message with the fin tag which is the end tag set and then the receiving end the receiving device or client or server gonna send an arc tag saying hey you know the arc was received uh so saying everything it got the you know fin tag and then it also send if um you know fin uh the to the client to terminate the server to the client session and as a result the the the the in in this case the device a gonna send an arc uh you know back to the uh the the other device the device b so that uh it is an acknowledgement saying that that has been received again this is a very important concept it will show up on your exams both ccna and ccnp make sure you understand the session termination process as well tcp three-way handshake analysis functions of the three-way handshake which we just covered in these two previous slides right here this is called the three-way handshake and then the termination so the establishment extermination so the functions of those three way handshake is to establish that the destination device is present on the network it verifies that the destination device has an active service and is accepting request on the destination port number that the initiating clients intends to use it informs the destination device that the source client intends to establish a communication session on that port number after the communication is completed the sessions are closed and the connection is terminated the connection and session mechanisms enable tcb reliability function so remember that the connection and the session mechanisms that we have in this tcp is the reason why we have the tcb reliability function tcp three-way handshake analysis the six control bit flags are urg arc psh rst sync and fin so urg is the urgent pointer field significant arc is the acknowledgement flag used in connection establishment and session termination psh is the push function rst is the rest sorry reset the connection when an error or timeout occurs sync is the synchronized sequence number used in connection establishment finn is saying that there is no more data sender and using this you know there is no more data to send in the particular session for your exams what is really important that you understand the arc sync and fin but you should also know that uh urg psh and rsd exist uh in the tcp 3v handshake as well unless the cisco changes the exam for ccna and ccnp i don't believe you will get a lot of questions about urg and psh but an artist team but you will definitely get questions about the arc sync and fin processors there's a video from cisco netacad called tcp three-way handshake that will cover exactly we just went over if you do not have access to cisco netacad either through your academic institution or through your registration with the cisco i will leave a link in the description for a copy of this video that you can watch and i will put a card at the top on right hand corner in this video so you can go ahead and watch that reliability and flow control tcp reliability guaranteed and ordered delivery tcp can also help maintain the flow of packets so that devices do not become overloaded there are times when tcp segment do not arrive at their destination or out of order all data must be received and the data is in these segments must be reassembled into original order sequence numbers are assigned in the header of each packet to achieve this call so tcp can maintain the flow of packets so that devices do not become overloaded and data not always going to arrive at the same time at the destination or you know in the correct order and all of those things can be you know mitigated using the tcp uh protocol and this is what they are trying to show here a little bit on the right hand side diagram and again to understand what we just talked about there is a video called tcp reliability sequence numbers and acknowledgement that video is a really good video you should watch and if you have access to your ccna cisco netacad modules please go ahead and watch them i will try to find a link to this video or i will post a copy of this video in the description if i can get hold of it and if i find one i'll post it on the top right hand corner with the card up here tcp reliability data lost and re-transmission no matter how well design a network is the data loss sometimes do happen tcp provide methods of managing these segment losses among these is a mechanism to re-transmit segments for unacknowledged data so for example if you have two devices that are communicating between each other and this device is sending data and this device is receiving those data if they are sending 10 segments and if two of the segments are lost well that means we have some missing pieces right but however the tcp provide a method of managing those losses by using that arc you know acknowledgement messages that been sent back to the sender so the host operating systems today such as you know windows computers mac computers typically employ an operational uh sorry optional tcp feature called selective acknowledgement or sac negotiated during the three-way handshake if both host support sac the receiver can explicitly acknowledge which segment or bytes were received including any discontinuous segments so that is what it's trying to describe here what you need to remember for your exams or quizzes is that the modern day operating systems do have this new this this feature called the selective acknowledgement and it is negotiated during the three-way handshake again there's a video called tcp reliability data loss and retransmission i will try to find a copy of this video and post it on my youtube channel and i if i find that i will put it on the top right hand corner up here with a card and i will leave that information in the description and if you do have access to your netacad account you should be able to watch that video and that will explain exactly the data loss and retransmission on with respect to tcp tcp flow control window size and acknowledgements tcp also provides mechanism for flow control by using the window size and those acknowledgement of those information flow control is the amount of data that the destination can receive and process reliably flow control helps maintain the reliability of tcp transmission by adjusting the rate of data flow between source and destination for a given session so mss which is the maximum segment size shown here on the right hand side is a like a window size that can be used uh for such uh such uh process and we'll be talking about that on our next slide so the maximum segment size or mss is the maximum amount of data that the destination device can receive a common mss is 1460 bytes when using ipv4 a host determines the value of its mss field by subtracting the ip and tcp headers from the ethernet maximum transmission unit or mtu which is 1500 bytes by default so what's going to happen is he's going to take that mtu 1500 minus you know in 60 which is 20 bytes for the ipv4 header and 20 bytes for the ipv i'm sorry for the tcp header so that means 40 bytes gone which um and plus that other you know headers for the overhead gonna gonna have 60 so we have 1500 for the mtu minus 60 that gonna leave us with 1460 bytes so what you need to remember is the maximum segment size is the maximum amount of data that can that the destination device can receive and it is determined by the mtu which is 1500 minus 60 which includes the 20 bytes for the ipv6 and 20 bytes for the ip sorry tcp header and that's all you need to remember for these things this slide for your exams and you can see on the right hand side this that information is shown with a diagram here congestion avoidance another part of the tcp flow control is a congestion avoidance so when the congestion occurs on a network it results in packets being discarded by the overloaded router so to avoid and control congestion tcp employs several congestion handling mechanisms timers and algorithms we don't go into depth of all of these mechanisms timers and algorithms in this class but you should know the congestion avoidance is built into the tcp flow control and it uses these mechanisms timers and algorithms to do it udp communication udp low overhead versus reliability so remember udp does not establish a connection udp provides low overhead data transport because it has a small datagram header and no network management traffic so that is a key important concept what makes udp different from tcp is utp does not establish a connection which i have mentioned on my previous slides and udp provides low overhead data transport because it has a small datagram header and no network management traffic udp datagram reassembly udp does not track sequence numbers the way tcp does udp has no way to reorder datagram into their transmission order udp simply reassembles their data in the order that it was received and forwards it to the applications remember unlike tcp udp simply reassembles the data in the order that it was received and forwarded to the application so that's an important thing that you should be familiar with so if you look at on the diagram on the right hand side that's what it is trying to uh you know trying to deliver here so we have a data a block of data and that is divided into datagrams and you have here six datagrams but when it goes to datagram one two six five four arrived on the destination and obviously they are in out of order and it needs to be reordered and there are also lost datagrams that are not resent in because it is using the udp right so that's what it is shown here udp server processors and request udp based servers applications are assigned well-known or registered port numbers udp receives a datagram destined for one of these ports it forwards the application data to the appropriate application based on its port number so those are two important concepts udp based server applications are assigned well-known port that are registered or or reports that are registered remember we've discussed the well-known ports versus registered port versus you know the other available ports so udp use either a well-known port or a registered port number and udp receive a datagram destined for one of these ports and it forwards the application data to the appropriate application based on its port number so that's an important concept such as for example the radius server the cisco radio server have its own registered port number for example you know those are all udps udp client processors the udp client processors dynamically selects a port number from the range of port numbers and uses this as the source port for the conversa conversation the destination port is usually the well-known or registered port number assigned to the server process as i mentioned before after a client has selected the source and destination ports the same pair of ports are used in the header of all datagrams in the transaction so this is all you need to remember for the udp so the udp client processor dynamically selects a port number from a range of port numbers and use this as the source port of the conversation so it's just gonna use a dynamic port as a source port the destination part is usually the well-known or the registered port number such as you know the radius server having a specific destination port number and then after a client has established the source and destination ports the same pair then be used in the header of all datagrams in the transaction so that all the data is being received between the sender and the receiver and that brings us to the end of this lecture and now i will cover quickly what did we learn in this particular module there's a packet tracer lab available on your cisco netacad it is called tcp and udp communications if you have access to the cisco netacad documentation please go ahead and download it and do it and it that will actually cover everything we learn or most of the things we learn in this particular lecture if you do not have access to cisco netacad i will try to find a copy of this file and see if i can post it on my website but this is a really good lab that will cover everything and you should go ahead and do them so what did i learn in this module so in this module we learn the transport layer is the link between the application layer and the lower layers that are responsible for the network transmission the transport layer includes the tcp and udp protocols the tcp establishes sessions ensure reliability provide same order delivery and supports flow control udp is a simple protocol that provides the basic transport layer functions udp reconstructs data in the order that it is received loss segments are not recent no session establishment and udp does not inform sender of resource availability tcp and udp transport layer protocols use port numbers to manage multiple simultaneous conversations and there are certain port numbers that you should be familiar with as you learn these modules in this particular course such as port number 80 for example for http each application process running on a server is configured to use a port number the port number is either automatically assigned or configured manually by a system administrator for the original message to be understood by the recipient all data must be received and the data in these segments must be reassembled into the original order sequence numbers are assigned in the header of each packet flow control helps maintain the reliability of tcp transmission by adjusting the rate of data flow between source and destination remember this is one of the key features of tcp as opposed to udp it has the ability to adjust the rate of data flow between the source and destination a source might be transmitting 1460 bytes of data within each tcp segment this is the typical mss that a destination device can receive the process of the destination sending acknowledgements as it process bytes received and the continual adjustment of the source send window is known as sliding windows unfortunately you know i didn't cover sliding windows clearly in this particular lecture but i will go through them later to avoid and control congestion tcp employs several congestion handling mechanisms and that's everything for this lecture if you like these modules and these lectures please make sure to thumbs up this video and subscribe to my channel in the next few weeks i will be posting the last few modules associated with cisco netacad introduction to networks lecture series if you have any questions or concerns regarding these lectures please feel free to leave a comment in any of my videos and i will try to get back to you until next time good luck with your exams and have a nice day