OSI Model: A Practical Perspective - Part 2 - Networking Fundamentals - Lesson 2

330.39k views2594 WordsCopy TextShare
Practical Networking
Module 1 of the Networking Fundamentals course will illustrate the core of networking: How data mov...
Video Transcript:
hello welcome to another video from the first module of my new course on networking fundamentals this module will teach you everything you need to know to understand how packets move through the internet in this video we'll continue our discussion of the osi model from a practical perspective in the first part of this lesson we unpacked how layer 1 layer 2 and layer 3 contribute to the overall goal of networking we discussed that layer 1 the physical layer was responsible for transporting ones and zeros across the wire we then illustrated how if this host has some data needs to send to this host it needs to start by adding a layer 3 header which will facilitate carrying the data from one end to the other then a new layer 2 header will be added to carry the data from one hop to the next this will continue across the entire path between these two hosts if you haven't watched that video go ahead and pause this video and watch that one first there'll be a link in the description otherwise we'll continue right where we left off by discussing layer 4 of the osi model the transport layer the overall goal of the transport layer of the osi model is what i'm going to call service to service delivery let me explain what i mean by that here is a computer this computer has an ip address and has a mac address in a pretty common scenario whoever is using this computer has a web browser open and is browsing the web but maybe at the same time that user is also running some sort of chat program something like slack or discord or irc and at the very same time that user might also be running some sort of online game well each of those programs is meant to send and receive data on the wire all that data will be destined to this layer 3 header to accomplish end to end delivery and this layer 2 headers to accomplish hop to hop delivery the question then is how do we make sure the right program receives the right packets well that's where layer 4 comes into play layer 4 is there to distinguish data streams it's going to take all the incoming data and make sure that the right program receives the right data just like layer 3 had an addressing scheme to do end-to-end delivery and layer 2 had an addressing scheme to do hopped hop delivery layer 4 is also going to be using its own addressing scheme to accomplish its goal of service to service delivery layer 4's addressing scheme involves ports now there are two sets of ports there's zero to sixty five thousand for tcp and zero to sixty five thousand for udp tcp and udp are two different strategies for distinguishing data streams tcp favors reliability and udp favors efficiency both tcp and udp are simply different strategies for accomplishing the goal of layer 4. their inner workings are both significant and fascinating but unfortunately they are outside the scope of this lesson they will both be covered in detail in a later lesson in this course but the way they work is that every single program that's expected to receive or send data on the wire is going to be associated with a particular port number then when data arrives on the wire it's going to include a layer 4 header in addition to the layer 3 and the layer 2 header that we've already discussed that layer 4 header will indicate which particular program should be receiving that data and that's what layer four is going to use to make sure the right program receives the right ones and zeros so that's a high level overview of how layer four distinguishes data streams but let's pick it apart in more detail here is a client and three servers as we discussed in the first lesson a server is nothing more than a computer which is running software which knows how to respond to specific requests each of these pieces of software is assigned a predefined well-known port number which correlates to the underlying network application let's say bank. com is listening for secure web request using https which is assigned tcp port 443 and the server for site.
com is responding to general web requests using http which by default listens on tcp port 80. and this chat server is running irc which stands for internet relay chat which is an online chat application which runs on udp port 6667 when the client is making a request to these servers it's not only making a request to the ip address it's also going to make a request to the specific port in question then for each request made by the client the client is going to choose a random port number to use as the source port for the connection so a connection from our client to site. com would look like this includes a source port of 9999 that's the port that the client randomly selected for this particular connection the destination of this packet is destined to the ip address of site.
com going to tcp port 80 which is the http application keep in mind that the source and destination ip addresses are going to exist in the layer 3 header of the packet and the source and destination port are going to exist in the layer 4 header of the packet now this randomly selected source port is actually very important it is actually the port the client will listen to for the response to the original request meaning when this server responds to this web request that packet will look like this notice the destination port is 9999 that's the same port that was initially selected by the client randomly on the outbound initial packet so for all connections there is always a source port and a destination port that are involved the destination port is typically governed by the application in use and the source port is randomly selected by the client so our connection from the client to site. com has the following attributes it is a tcp connection from this ip address and port to this ip address and port notice that in the initial packet this was the source and this was the destination and in the response packet it's the exact opposite this was the source and this was the destination this process occurs for each connection made by the client in each case the client is selecting a new random source port this makes it so that when all these servers respond whatever comes back on port 8888 will be given to the web browser and whatever comes back on port 7777 will be given to the irc client in this way the data streams are kept isolated from each other these ports will ensure that the right application gets the right data this process also allows the client to make multiple connections to the same server consider when you are browsing the internet i imagine you've often had multiple tabs open to the same website well the reason each of those browser tabs don't accidentally display the data from another tab is that each time you open a new tab your client meaning your web browser generates a new random source port so that is how data streams are distinguished from one another it is a function of udp or tcp which are both layer 4 protocols and again layer 4's ultimate goal is what i'm calling service to service delivery of data which finally brings us to the last three layers of the osi model back when they first created the osi model each of these layers had a distinct function independent from the rest however currently the distinction between these layers is somewhat vague every application is in fact free to implement the functions of layer 5 6 and 7 as they choose therefore often these three layers are simply considered as a single universal application layer in fact the other popular internet communication model actually does exactly that the tcp model combines all the functions of the osi layers 5 6 and 7 into a single layer now the goal of this module is to teach you how data flows through the internet and the most critical layers to understand for that is layers one through four therefore we aren't going to pick apart the original intended distinction between layers 5 6 and 7. if you're curious however go ahead and let me know in the comments below and i can cover it in another video as for us we're going to follow the tcp model's lead and simply consider all three of these layers as the application so now that we've talked through the entire osi model i want to show you what's actually happening when hosts are communicating to each other using this networking stack this host has an application that's going to generate data that is meant to be sent to the other side what that host is going to go through is what's known as the encapsulation process that data will be first sent to layer 4.
layer 4 is going to add a header to that data which can facilitate the goal of layer 4 which is service to service delivery in this case it is a tcp header which is going to include the source port and destination port for this particular data the construct of a layer 4 header plus data is known as a segment that segment is going to be passed down the osi stack to the next layer in this case layer 3 the network layer and the network layer is going to add another header to this data this header is going to facilitate the goal of layer 3 which is end to end delivery meaning in this header you'll have something like a source ip address and a destination iputrus the construct of a layer 3 header and its data is known as a packet now notice that inside the data of the packet is the layer 4 header that was above it but from layer 3's perspective it doesn't know or doesn't care what's inside that data it's simply a bunch of ones and zeros that need to be delivered to the other end either way layer 3 will then take that packet and hand it off to layer 2 and layer 2 will once again add another header to that data to accomplish layer 2's goal of hop to hop delivery meaning this header will include something like a source mac address and a destination mac address the construct of a layer 2 header and its ensuing data is known as a frame and that frame gets converted into ones and zeros and finally put on the wire on the other side the receiving host is going to do the opposite process it's going to do d encapsulation meaning it's going to take those ones and zeros off the wire to convert them back into their frame layer two is going to look at the layer two header to make sure that it is indeed addressed to this host's nic if it is it's going to discard that header and pass that up the stack then layer 3 is going to look at the ip header to confirm it is indeed addressed to this host's ip address if it is it's going to discard that layer 3 header and pass it up the stack to the transport layer layer 4 will then take a look at the layer 4 header to identify the port that this data is destined to and will deliver the data to the appropriate application the application can then finally process the data that is the process of encapsulation and de-encapsulation notice each layer is going to add information to the data in order to accomplish its goal and this brings us to the final idea i want to communicate to you about the osi model throughout this lesson we've mentioned that networking devices operate at specific layers for example switches and routers operate at layer 2 and layer 3 respectively what that means is that they only look into the datagram up to their respective layer for example switches which are layer 2 devices are only looking at the frame meaning they're only looking at the layer 2 header to make a decision they're not looking inside the data payload into the layer 3 and layer 4 headers which we know exists there they're only looking up to the layer 2 header moreover we've discussed that there are various protocols which operate at specific layers for instance the ip protocol is a layer 3 protocol tcp and udp are layer 4 protocols that said neither of these are strict rules there are exceptions to each of these that exist for example if you take a router which typically operates at layer 3 but configure access list on that router now that router is looking into the layer 4 header to make a decision so the router isn't purely a layer 3 device anymore moreover earlier in this lesson we discussed the arp protocol and we discussed how arp links a layer 2 address to a layer 3 address links an ip address to a mac address which means arp doesn't purely fit in layer 3 nor does it purely fit in layer 2.
Copyright Ā© 2024. Made with ā™„ in London by YTScribe.com