How Data moves through the Internet - Networking Fundamentals

364.22k views4889 WordsCopy TextShare
Practical Networking
This is the summary lesson to the Networking Fundamentals series. In this lesson we illustrate every...
Video Transcript:
so you see everything we did in this video was in service of answering this very common interview question hello welcome to the final lesson in our free module from the networking fundamentals course this lesson is the summary lesson to everything we have learned so far the purpose of this series was to teach you the very core of networking how data flows through a network in this series we talked through the osi model and the different functions each layer is responsible for we talk through how hosts on the same network communicate with each other regardless of how they are connected we talk through switches and how they facilitate communication within a network we also talk through how hosts on four networks speak with each other whether they are connected behind one router or multiple routers or on opposite sides of the internet we discussed what routers do and how they learn routes and hand data off to one another we covered each of these things in detail in prior videos in this module and in this lesson we're going to tie elements from each of those videos together into a comprehensive summary lesson at its core understanding how data flows through a network comes down to understanding three specific tables a mac address table an arp table also referred to as an arp cache and a routing table each of these tables is a mapping of something to something else a mac address table is a mapping of a switch port to a mac address an arp table is a mapping of an ip address to a mac address and a routing table is a mapping of an ip network to an interface or an ip network to an ip address of the next router in the path also known as the next hop ip address these three tables are crucial to moving data through a network and we're going to show you everything that happens with these three tables as data is flowing through this network topology this topology has three routers routers one two and three and three hosts host a b and c each host exists within a network and all the devices have ip addresses in their respective network and finally each of these wires are connected to nics and each of those nics have unique mac addresses and again i'm only showing you the first four digits of mac addresses to keep things simple now in the case of the switch since we are only sending traffic through the switch and not to or from the switch the switch's mac address and or ip addresses are irrelevant we elaborated on this point back in lesson four so for our switch we only need a label for the two switch ports that these wires are connected to in this case they're going to be port 4 and port 5. each of the devices in this topology are going to use one or more of these tables to process data and we're going to show them to you in these gray boxes our switch is only going to have a mac address table and you're going to see the entries of the mac address table right there our routers have both an arp table and a routing table and our hosts being very similar to routers as we discussed back in lesson five also have both an arc table and a routing table now both the mac address table and the arp tables are going to be populated dynamically as traffic is flowing through this network the routing table however must be populated ahead of time recall that back in lesson 5 we said that if a router receives a packet with a destination ip address not in the routing table that packet would be dropped so at this point if our host started sending packets since our routers have empty routing tables everything would just be dropped therefore the routing tables must be populated before any data can be sent through this topology so let's fill in all the entries for all the routing tables in this topology starting with host a's routing table host a only needs a default gateway also known as a default route the default route will be represented as a route for the 0. 0.
0. 0 network which includes all ipv4 addresses this route is pointing to the ip address of this interface of router 1 11. 8.
8. 1 this will tell host a to use router 1 anytime it's trying to speak to anything on a foreign network host b will also have a default gateway pointing to this interface ip address on r2 22. 7.
7. 1 and host c will also have a default gateway pointing to this interface ip address on router 3 the ip address 33. 6.
6. 1 each of our routers will have two routes first they will have a directly connected route for the network that they are attached to notice r1 has a directly connected route for the 11. 8.
8. 0 24 network then each of the routers are going to have a default route pointing to the internet now normally that default route would point to a specific router ip address somewhere on the internet but to keep things simple we'll simply abstract that away and say that this route is pointing simply to the internet and now we are ready for host a to send some data i want to show you the details of this data but there isn't enough room here to show you the source and destination information instead i'll show you this data in more detail in this box right here inside this data payload is just a bunch of ones and zeros the network doesn't know or doesn't care what specifically those ones and zeros are doing it's just arbitrary computer code that needs to be sent to another host host a will start by adding a layer 3 header to this data this will facilitate the end to end delivery of this data to begin host a will be sending this packet to host b so the source ip address of this packet is going to be the ip address of host a 11. 8.
8. 11 and the destination ip address of this packet is going to be the ip address of host b 22. 7.
7. 22 and now we are at the starting point of our illustration and we are ready to follow this packet as it travels through this topology the first thing that happens when host a is trying to send this data is host a will compare the destination ip address of the packet with its own ip address and subnet mask to determine that the destination ip address is on a foreign network therefore this packet must be sent to host a's default gateway which is router 1. but at this point host a's arc table is empty which means host a doesn't know router one's mac address and therefore is unable to put together the necessary layer two header which will take this packet across this hop so host a will hang on to this packet and first go through the arp process to resolve router 1's mac address the arp request is also going to have a layer 2 header that layer 2 header is going to have a source mac address of host a and a destination mac address of all fs that's the broadcast mac address this will tell the network that this arp request should be sent to everybody in this network when host a puts that on the wire it'll arrive on our switch anytime something's received on a switch it's going to try and learn the mapping between the receiving switchboard and the source mac address in this case the source mac address of this frame is a1a1 and the receiving switch port is port 4.
therefore our switch is going to learn that something out port 4 owns the mac address a181 then the switch is going to look at the destination mac address in this case the destination mac address is all fs which tells the switch that no matter what it's going to do the flooding action to send this frame out all ports now in our topology there's only two devices in this network but if there were other devices plugged to this switch they would also receive a copy of this frame but for us that frame would only be sent out port 5 where it'll arrive on router 1. upon arriving to router 1 router 1 will get to learn the arp mapping of the sender recall that when we discussed arp we told you that inside the arp request is the arp mapping of the sender so by simply receiving the arp request router 1 is able to learn that a device with the ip address 11. 8.
8. 11 maps to the mac address a1a1 then router1 will generate an arp response this arp response is going to look like this it's going to have a source mac address of router 1's nic and a destination mac address of host a this is a unicast arp response meant to be delivered directly back to host a router 1 will put that on the wire where it'll arrive on our switch and again just like before since the switch receives something on port 5 it's able to learn that a device out port 5 owns the mac address eee1 then the switch will again take a look at the destination mac address in this case the destination mac address is a1a1 and our switch already knows that that mac address exists out port 4 and will therefore forward this frame out port 4 where it'll finally arrive back to host a once host a receives it host a will learn the mac address that it was trying to resolve in this case that the ip address 11. 8.
8. 1 maps to the mac address ee 1 and now host a has the necessary information to complete this layer 2 header which will take our data packet to the router that layer 2 header will have a source mac address of host a and a destination mac address of the router now that host a knows the router's mac address this layer 2 header will handle delivering this packet across its first hop which in fact is the goal of layer 2 hop to hop delivery now if that idea isn't familiar to you we unpacked it when we discussed the osi model back in lesson 2. either way host a will put all of this onto the wire where it'll arrive onto the switch once it gets to the switch the switch will again try and learn what it can from this incoming frame this frame arrived on port 4 and had a source mac address of a181 and our switch already has that entry in its mac address table so there's nothing new for the switch to learn but this particular entry will be refreshed in the switch's mac address table then again the switch is going to look at the destination mac address to determine that this frame should be forwarded out port 5 where it'll put it on the wire and send it out towards router 1.
once that arrives to router 1 router 1 will strip the layer 2 header the purpose of that header was again to take the packet from host a to router 1. it did that successfully and we no longer need it then router 1 will take a look at its routing table to determine where it's going to send this packet next the destination ip address of this packet is the ip address 22. 707.
22 which matches this route for router 1 which means router 1 knows that this packet is going to be sent across the internet as we discussed earlier in this module the internet is really just a bunch of other routers that will hand data off to one another and normally this route would point specifically to one of these routers but we unpacked the details of how routers hand data to other routers back in lesson five so rather than repeat myself i'll simply direct you to that video if you want more information on this process i'll also mention that there are actually many more ways that this packet can get through the internet to router 2. all of those ways are contained in what's known as wan technologies and the details of each of them are outside the scope of this module one way or another this packet will be passed from router to router across the internet until it finally gets to router 2. and when it gets to router 2 router 2 is going to take a look at its routing table to try and figure out how to deliver this packet the destination ip address at this packet hasn't changed which means this packet matches this route and router 2 knows it's going to be delivering this packet to its final hop within the directly connected network that router 2 is attached to however at this point router 2's arp table is empty which means router 2 is unable to put together the layer 2 header necessary to take this packet to host b so just like before router 2 is going to have to put that packet on hold and send out an arp request the arp request will be sent to the broadcast mac address but this time the source mac address is going to be router 2's mac address this packet will be put onto the wire where it'll arrive on host b upon receiving the arp request host b gets to learn the arp mapping of the sender of that app request in this case the ip address 22.
7. 7. 1 maps to the mac address ee 2.
then host b will generate a response that arp response will look like this it's going to be a unicast frame sent with a source mac address of b2b2 and a destination mac address of ee2 that arp response will be put onto the wire where it'll arrive on router 2. and router 2 will learn the arp mapping that it was trying to learn that the ip address 22. 7.
7. 20 maps to the mac address b2b2 and now router 2 has all the information necessary to put together the layer 2 header that'll take this packet to host b that layer 2 header is going to have a source mac address of router 2 and a destination mac address of host b router 2 can now put the packet on the wire where it'll finally arrive on host b now normally you wouldn't see a host plug directly into a router normally this host be connected to a switch which would then possibly be connected to other switches which would then finally connect to the router but we've already illustrated a switch's operation back here and we discussed how frames travel through multiple switches back in lesson four so to keep things simple this network does not have any switches but if you want to understand how data flows through multiple switches check out lesson four either way once this packet arrives on host b the first thing host b does is strip the layer 2 header again that header only existed to take this packet from router 2 to host b the next thing host b does is strip the layer 3 header again the purpose of that header was to handle the end to end delivery of this data which it did so successfully and now host b can finally process all those ones and zeros contained within that data payload once it's processed that data it can now generate a response and that response just like before is simply a data payload which includes a bunch of ones and zeroes and now we'll step through all the steps required to get this data payload back through the network to host a what you'll see is that this is going to go much quicker than before because most of our tables have already been populated host b will start by throwing a layer 3 header onto that data that layer 3 header is going to have a source ip address of host b and a destination ip address of host a in this case since this packet is going to something on a foreign network we know that it must be sent to router 2 sip address and at this point host b already has the arp mapping for router 2's ip address and can therefore already put together the layer 2 header necessary to get this packet across its first hop this is what will allow this packet to make it across this hop upon arriving on router 2 router 2 will strip the layer 2 header and then router 2 will take a look at its routing table to figure out where this package should go next in this case the destination ip address 11. 8.
8. 11 only matches the default route so router2 knows that this is going to be sent out towards the internet and again we've abstracted that process out so it'll be handed from router to router across the internet where it will finally arrive on router 1. upon arriving on router 1 router 1 will take a look at its routing table and determine that the destination ip address matches the directly connected route so router 1 knows that this destination ip address is the final hop for this particular packet and router 1 also happens to already know the mac address for that particular ip address so router 1 has all the necessary information to put together a layer 2 header that'll take this packet across its final hop that layer 2 header is going to have a source mac address of router 1 and a destination mac address of host a router 1 can then put that packet onto the wire it'll arrive on our switch and just like before our switch is going to try to learn it'll try and map the receiving switch port which is 5 to the source mac address of the incoming frame ee-1 and it'll notice that it already has that entry in its mac address table so there's nothing new to learn so this entry will simply be refreshed in the switch's mac address table then the switch will look at the destination mac address a1a1 and the switch knows how to deliver a frame to the destination mac address a1a1 this frame will be sent out port 4.
it'll then finally arrive back on host a host a will strip the layer 2 header again that header took the packet from this nick to this nick host a will then strip the layer three header which took the data from this end to this end and finally host a will process that response data so we just showed you everything that happens to get data from host a all the way to host b and back again and we showed you how each of the devices involved in this process used a mac address table an arp table and a routing table to make that happen next host a is going to send some data to host c now if you feel that this is beginning to get repetitive awesome that's great that's exactly right and it means you're learning how it all works remember all these devices hosts switches routers all follow simple consistent packet processing rules if you understand those rules you can scale this topology to hundreds of devices and still walk your way through each step necessary for this last packet going from host a to host c i want you to test yourself try to guess what happens next at each step just before i explain it with that in mind the first thing that host a does to send this data to oc is throw a layer 3 header onto that data that layer 3 header is going to have a source ip address of host a and a destination ip address of host c then since host a knows this packet is going to a foreign network host a is going to look at its default route to determine the default gateway's ip address which is router 1 and since host a already has the arp mapping for its default gateways ip address it can already put together the layer 2 header which will take this packet to router 1. that layer 2 header is going to have a source mac address of host a and a destination mac address of router 1. host a will put this onto the wire where it'll arrive on the switch the switch will try and update its mac address table with an entry for port 4 mapping to the source mac address a1a1 since that entry already exists that entry is simply going to be refreshed in the mac address table then the switch is going to look at the destination mac address to determine where to send this packet next that mac address exists out port 5 which will have this switch send this frame out port 5.
it'll then arrive on the router and the router is going to strip the layer 2 header and now router 1 is going to look at its routing table to determine where to send this packet next the destination ip address on this packet matches the default route which means router 1 is going to send this packet across the internet where it will finally arrive on router 3. when router 3 gets it router 3 is going to again look at the destination ip address and determine that it matches the directly connected route in router 3's routing table this tells router 3 that it's going to have to put a layer 2 header onto this packet that matches the mac address associated with this ip address right here but at this point router 3 does not have anything in its arp table so it cannot put together the appropriate layer 2 header therefore just like before router 3 is going to put that packet on hold and then router 3 is going to send out an arp request that arp request will be sent to the broadcast mac address which will ensure that this arp request gets delivered to everybody on this particular network which means host c will definitely receive that arp request upon receiving the arp request host c will learn the arp mapping of the sender of that arp request which in this case is the ip address 33. 6.
and the mac address ee 3. then ho c will put together the arp response that arp response will look like this the arp response is sent as a unicast frame meaning it's going from a specific mac address to another specific mac address this will get the arp response back to router 3 and then router 3 or finally learn the art mapping it was trying to learn and now router 3 has everything it needs to put together the appropriate layer 2 header which will take this packet across its final hop to host c router 3 will put that onto the wire where it will arrive on host c host c will strip the layer 2 header host c will strip the layer 3 header and host c will finally process the data and as with most internet communication when you send something you generally expect a response so oc is now going to send that response back to host a host c will throw a layer 3 header onto that packet that layer 3 header is going to have a source ip address of host c and a destination ip address of host a host c knows it's trying to speak to something on a foreign network soho c knows that this must be sent to the default gateway in this case router 3 and host c happens to already have the arp mapping for the default gateway so it has all the information it needs to put together this layer 2 header which includes the destination mac address of router 3. host c will put that onto the wire where it'll arrive on router 3.
router 3 will strip the layer 2 header and then router 3 will take a look at its routing table to determine where to send this packet the destination ip address of this packet matches the default route so router 3 will send that packet out towards the internet where it will finally arrive on router 1. router 1 will take a look at its routing table and compare the destination ip address to see which route matches in this case this destination ip address matches our directly connected route which means router 1 knows that this packet will be delivered to its final hop and router 1 happens to already know the arp mapping for this particular destination ip address so router 1 has all the necessary information to put together a layer 2 header with a source mac address of router 1 and a destination mac address of host a that will get sent onto the wire where it'll arrive on the switch and again the switch has nothing new to learn so it'll simply refresh that entry in its mac address table then the switch will look at the destination mac address to determine that this frame should be sent out port 4. the switch will put that onto the wire where it'll arrive on host a host a will then strip the layer 2 header host a will then strip the layer 3 header and finally host a will process the response from host c and that my friends is every single step that is necessary to get a packet from host a to host b and back and host a to host c and back and that is how these three tables were used to facilitate that entire process the last idea i want to leave you with has to do with a very common interview questions for networking engineering type rules that interview question looks something like this tell me everything that happens when you type www.
google.
Copyright © 2024. Made with ♥ in London by YTScribe.com