Transcript for:
Understanding OSI and TCP/IP Models

so the OSI model stands for the open systems in interconnected model um we'll go over this briefly it's it's very similar to the TCP I model uh which is mainly what we'll be using uh uh in this class uh they're both very similar and they are both what we call conceptual models of how the internet was originally designed to work um essentially The OSI itself turned into the TCP IP model for the most part okay um okay so right so both of these models were built around the notion of layering and so the OSI model has seven layers and the uh TCP IP model has five layers in fact um the five layers that the tcpip model has um are inside of the seven layers that the OSI model has okay so two of these layers uh essentially were not really were were not really used on an independent level and then they essentially melded into what we call the application layer today okay uh so the the layers themselves are the uh so the physical eray on the bottom the data link layer one one above that the network layer the uh transport layer the presentation uh the session layer presentation layer and application layer is on the top see I can move this slightly application layer so this is the OSI model and then the essentially the um the tcpip model essentially just groups these into the application layer there weren't there weren't that many protocols that were um just presentation or just session so they were uh as the internet evolved uh we just combine these three okay so the the goal of of layering is to provide abstraction so higher layer protocols like the um application layer okay they essentially can function under the assumption that all the other layers are doing their own uh specialized job so each layer has a specified job um for instance the data link layer okay so in fact we'll so data link layer is in charge of delivering messages across a single device so for instance if you have a computer that's directly connected to another computer that would be a single hop okay or a computer connected to a router that would be a single hop and so the dacl facilitates delivery across a single hop uh facilitates delivery across a single hop yeah so this uh the again the the key difference between OSI and tcpip is this uh OSI has these three layers separated and tcpip has uh have has them combined the the application presentation and session everything else for the most part um is uh unchanged at least with the tcpip model version that we're talking about the the five layer version okay um so if you need to deliver um so the actual internet itself requires many of these single hops that is your computer has to go to your home router your home router has to go to your ISP your ISP probably has a hundred different routers connecting different other isps um and all of these need to be string together and essentially that is what the network there provides it provides what we call intend delivery so it provides end to end delivery okay U by stringing together um many single hops okay so essentially the network layer it operates under the assumption that the data link link layer works and the higher layer protocols also continue with that assumption the transport layer for instance the the transport layer Mak sure that um once you get to the correct computer okay once you get to the correct machine that you try to communicate with that that computer might be running a hundred different programs so ensures that it gets to the the correct application sh's delivery to the correct program okay but that that that's basically that assumes that it gets to the it gets to the correct machine of course okay but the network layer is what provides the service to getting to to the correct machine and to get to the correct machine you have to jump through many different links that's what the data link lare provides it provides you the ability to hop through a single link um successfully so we have this layering okay so this is what we talk about when we talk about layering each layer facilitates a very specific job and then once that job is complete the layer above it um no longer cares uh no longer needs to worry about it essentially that task has been distracted away so how how we're going to go through this class is we're going to work our way from the physical lay up to the application layer spending um one or two sessions on each one for for you guys since you have double sessions um we'll be spending one day on on each topic essentially uh okay right so higher layer protocols can just assume that the lower layer protocols work and another benefit of layering is that you can you can hot swap out different um you can hot swap out different protocols and everything else stays the same meaning for instance if I'm writing application layer code so some um networking application um I don't really care whether or not the person is using Wireless or whether they're using a copper cable twisted pair or they're using a optical light cable they're using something like fiber that itself is handled by the data link layer and the physical layer okay so those encoding and decoding information and so if I'm just building some web app or something it's completely hidden from me that is even if I wanted to give it specific behavior um that's only available to people with copper cables or something I can't because on that specific layer uh I don't have that functionality okay so specifically the the layers themselves allow you to separate um separate tasks make so each layer itself has a very specific task we'll go into these tasks uh as we we as we talk about each layer and independently we we'll learn your task let's see okay so in this class we'll be looking at a lot of um protocols so for instance we'll be looking at the ethernet protocol we'll look at um the 802.11 which is the Wi-Fi protocol uh we'll look at the Internet Protocol we'll look at the TCP uh protocol we'll look at the UDP protocol we'll look at the HTTP protocol uh what else will we look at uh we'll look at the ARP protocol so we have all these protocols and um when we're talking about conceptual models usually we want to place these protocols in specific buckets uh typically that that's closest related to them so for instance Eastern and 802.11 uh this is typically used for cables So Physical cables and this is typically used for wireless these are two ways to sort of code data and so these typically rest in the data link layer protocol okay um the Internet Protocol is used to facilitate endtoend delivery so even this one has ipb4 and IPv6 variants so this one is on the network there um TCP and UDP are on the transport and HTTP and many others so the the the most protocols typically reside on the application layer that's that's where the most interesting components and generally the reason for this is because the lower layer protocols themselves um we want to have a unified standard we don't want to have some people using um let's say we had two competing standards for the network layer um protocol it it complicates things so uh generally we want to minimize the number of competing standards there are uh so there needs to be a real reason for other um lower layer protocols to exist um now this rigid bucketing system where we place certain protocols into specific layers is not always ideal there are certain protocols like arp uh we'll talk more about ARP when we get to the network layer but ARP itself its job is to convert an IP address okay which is on the network layer to a MAC address and vice versa which is on the day link glare so there are some protocols out there like ARP that could technically fit in in either one they they they sort of bridge this Gap so it wouldn't be ideal to put them in the network there it's probably closer to put them somewhere in between uh and there are a lot of protocols like that that that that might fit somewhere in between these two protocols um so what's okay so in this class it's not important to know where a protocol fits um because again this rigid system was just a way to think about the internet um and it's it's really not important to know oh does this fit here or does this fit here rather it's more important to understand how layering works and essentially if I'm on the TCP UDP layer I don't have to worry about whether that connection is using a wired connection or a wireless connection okay um right so don't worri too much about what specific layer a protocol falls into um it's more important to understand that the layering uh allows us to essentially blackbox uh things that we previous learned so essentially we we'll go from physical to data link layer to network layer and as we go up the stack essentially what you what you can do is you can take everything that you learned previously blackbox it and then just assume it works okay uh so let's talk about what are communication protocols okay so Communications protocols for our [Music] purposes protocols uh essentially if we want to uh send data across long distances um the sender and the receiver must first agree upon a set of rules um that dictate the exchange of data uh these rules determine all aspects of data communication okay so there essentially a set of rules U for data communication uh in fact uh strict rules uh that allow two or more entities set of strict rules that allow two or more entities um uh to transmit or receive information Okay so the there are Key Properties um that Communications protocols um determine so they determine the syntax okay so that is how you structure your message how messages are structured semantics which is the meaning okay so the underlying meaning underlying meaning of the message the synchronization this deals with all timing aspects timing and uh rate of transmission and finally we have optionally this one's not required always uh error recovery methods okay so this involves both detecting and possibly correcting error States and of course this this one is optional because you can always just say that there is no error recovery and that technically is a type of error recovery in which you just refuse used to correct it okay so Communications protocols actually predate uh so they they predate computers um the earliest communication protocol that traveled long distances some people can argue that like speaking is a Communications protocol um but if we're talking about actual longdistance um data transmission okay uh the first one was in 776 BC uh this year might be slightly off uh we had uh homing pigeons and so these were used in the first Olympics uh so the Olympics actually didn't take place in the the modern city of Athens they took place in a city called Olympia and so that was very far away from Athens okay um but uh Essen and essentially even like the fastest runner couldn't get from Olympia to aens uh in a day um so what they did was they had these pigeons that um that they would tie a message to and um the the bird would fly back to the uh to the city of Athens to deliver the message okay so the interesting thing about the Homing pigeons is they have a very interesting property and that let's say that uh this was Athens and this was Olympia okay uh so the interesting property of the Homing pigeons is that they can only fly home okay so meaning that their home was in some building in Athens and so they knew how to always get home um so what would happen would they they would uh take the bird to Olympia tie the message to uh the bird when the the games were finished and the bird would fly back to its home in Athens but it if let's say there there was some reply that needed to be sent back to Olympia this was not possible so this is what we call a unidirectional property okay and so it can this message can only go in one way um so we we have some modern day application unidirectional um uh transmission protocols um for instance uh your monitor well I think like the monitors nowadays are much more sophisticated but if we just take like a very old monitor then that is a unidirectional protocol in that your essentially sending bits out which are then displayed on the monitor screen but for the most part the monitor itself doesn't communicate back to your computer okay so we we still do have these unidirectional um protocols even nowadays um but what we'll see is that we'll look at some of the other sort of ancient protocols and we'll um see that they also have some interesting properties that um modern day um protocols also uh contain okay so that they they share with modern day protocols uh the next one that we'll look at is the hydraulic semaphore okay so the Greek hydraulic semaphore was used in uh 400 BC and so this one is important to us because this is the first case where we have a clear distinction between a uh so we have a clear distinction between a transmission medium and a Communications protocol okay and the previous one with the homing pigeon it's much less obvious but in this example it's it's uh there's a clear distinction um so how this worked was essentially there was two hilltops and then on top of each Hilltop there was a uh man station um okay and then on and inside that station okay uh contained one on each Hilltop contained one of these devices okay and these devices over here with these large cylindrical containers um that had this uh so these large cylindrical containers had this uh line of messages uh in the middle of it okay and what would happen is that this tank of uh this this tank over here would be filled with water okay uh let me get back to that okay so this so each of the tanks would be filled with water and um there were specifically predefined messages on each one of these so for instance there might be something that said something like one of these messages was um attack at midnight or something and then another one of these messages might be something like uh Retreat or something okay so so these tanks were filled with water and there was a um so maybe I can draw it slightly better so there's a small spout at the bottom of each tank to release the water okay and so what would happen is that um when uh so there would be a person at each station and essentially when one side wanted to send a message they would first raise a torch okay um and then once the other party sees that a torch has been raised they will get to the hydraulic cior and they will also raise their torch okay so when both parties see that the torch is raised they open the spouts and the water starts to flow out okay so once both parties see that the T has been lit they they release the spout and the water will start to flow out until it gets to the level where the message that they want to send gets reached so if it if they wanted to send attack at midnight they would um essentially stop the flow of of water once it reaches that specific level okay so they would turn off the spout and then they would extinguish their fire okay once the other person sees that the fire has been extinguished they will do the same so they will extinguish their fire and they'll close the spouts which will stop them at water from flowing so in that fashion they as long as these two sort of uh tanks had the same messages and were designed to be as identical as possible the the flow of water itself would be about the same which would mean that the message that's delivered so the water level would be about the same and then they would be able to get the correct message okay so right so this was how they sort of sent messages very long distances um in 400 BC um okay so the transmission medium okay so the transmission medium in this case is just the the torch the light from the torch okay so that is the transmission medium but just having the light from the torch is not enough for the protocol the protocol includes all the other Contraptions so includes the the physical hydraulic semaphore and it also includes the rules that both the the people um so both the people working at the station they both understand the rules that is all right in order to use this we have to lift the torch and then you have to lift your torch also and then we have to both open the spouts roughly right after we see both torches are lit and then we when the message is finished we have to extinguish the torch and um close the spouts so all those specific rules dictate the protocol okay so the the rules dictate the protocol okay uh so let's move to learn more about protocols okay so computer protocols Proto calls so computer Protocols are rigidly defined uh there needs to be no ambiguity so no ambiguity is allowed no ambiguity is allowed okay uh so for instance uh consider the following sentences uh my favorite color is blue and blue is my favorite color Okay so in this case we as people know that this is essentially the same sentence but this would not be good as a computer protocol okay because essentially there uh the rules themselves uh need to be strictly defined okay so uh the so typically if there are these documents on the web uh let me see if I can pull one up uh so there's these documents on the web called rfc's and all major protocols for instance HTTP RFC have one or more um rfc's associated with them okay so the RC stands for a request for comments and essentially this is a a document that defines all aspects of the communication so the the the syntax semantics the uh timing and uh synchronization and error recovery all of that is defined inside of this RFC um now you don't need to specifically know like in detail about a specific protocols RFC unless un you're building so for unless you're building tools related to that protocol for instance for htttp maybe you're building a web browser or something if you're building a web browser then you need to then then you need to support the HTTP protocol in order to support the HTTP protocol there is a very strict set of rules there's hundreds and hundreds of these rules that deal with all specific cases uh of the protocol and how you must um follow those rules and the reason why you must follow those rules is because all the other uh web servers um all the other web servers and web browsers on the web are following those rules so that brings us back to sort of this example over here um so you you can imagine like you can imagine that uh the protocol okay forces you to phrase your messages like this and if you phrase it any other way for instance like this then it will be rejected or it won't understand your message okay so essentially Protocols are very rigidly defined um and there are very there are a very strict set of rules and essentially any protoc that we we cover in this class will have an Associated RFC that dictates those rules uh all right so for instance even one of the early topics um like ethernet will have specific uh rsc's associated with them okay uh uh so this one's actually IP using Eastern uh let's see that one's less important I think i' Skip the optical Telegraph I think it's actually a bit interesting so Optical Telegraph is looks like this this so this one was a more modern um well compared to the the 400 BC I think this one was 1600 1700s so the optical Telegraph um is interesting because it was one of the first examples where we have um where we have a string of um sort of towers that that facilitate facilitated very that facilitated long distance communication and so the optical Telegraph worked um in a fashion essentially it had these long arms on on top on top of a tower and uh there were levers that a person working inside could uh pull to essentially make the arms move and so what they would do is they would uh each each Tower would be uh chained together so there would be these long chains of towers that span from um so I think uh they went from Russia to India um and essentially how it would work it would be if a operator saw that another tower started moving its arms uh it would look at the position that the arms would finally lock in place into and then it would mimic um that that that position for its own Tower and then there would be another Tower down the line that would be looking at it that would mimic that position and that effect cascaded down okay until the message was delivered uh so messages were encoded um using different arm positions um now the interesting thing about this is that so Not only was this um able to sort of send messages very long distances this has a very interesting property in that essentially at the the messages themselves were only um they were only encoded and decoded at the at the end of major cities and the the encoding and decoding book was uh was sort of top secret it was held by um people by high ranking officials okay so the interesting thing about that is that if you were were an operator in the middle okay if you were an operator in the middle you had no idea what that message actually was because all you were doing all your job was was to copy that arm position but you had no idea the meaning of that arm position so so this was really helpful because if let's say your your Tower which was probably staff with just one or two people got attacked then you actually didn't have any information that you can give give away so this was interesting because it was one of the arguably one of the uh one of the systems that we could say was the earth support of what we call end to-end encryption in that your message is encrypted between the start and the end of delivery and that's even if there was someone who attacked the middle of your connection they wouldn't be able to to get anything useful because they didn't have those decoding books uh let's see Electric telegraphs electric telegraphs are slightly less interesting we'll talk about that when we get to physical air I guess uh so we cover most of these yeah okay so let's jump to the physical layer actually and we can start talking about specific types of transmission mediums okay so we already covered like that one transmission medium which was the light from the torch but uh more modern applications of transmission mediums um are what we're going to be covering next so this is topic topic three which is the physical [Music] error okay so the physical layer deals with the bit by- bit delivery of data um and how that data itself is encoded on a transmission medium uh so it's concerned with the actual Hardware devices and the transmission mediums um whether they be copper Optical um or light uh wa copper Optical or or radio waves and how data is encoded on them okay is there we go okay so the first one that we'll talk about are cables which are pointed pointto Point um connections and the limitation for being a point-to-point connection is that without any additional Hardware they can only connect two devices okay uh so in modern applications there are two types of cables we have copper cables in fact let me so there are two types of uh let's just do it so there's copper cables and we have optical cables uh which are also called fiber okay so we'll talk about copper first so copper cables uh so copper cables use what we call voltage modulation to encode data um so they carry electricity on them um to be short and essentially they have ways to encode data uh it's called line coding and so there's many different systems for line coding but the the simplest one essentially that uh that that all we need to know is that if there's no electricity that's a zero and if if there is electricity that's a that's a one okay so you might see something like this okay um to encode data so there there's this one is generally not used because it's uh there are much better ways to encode data um but this is the easiest one to understand and that that's really all we need to know that if there's electricity on on the line um that's that means some data is being sent okay um and there exists a network interface card network interface card also called a nick uh that sits between your connection and your computer and so this actually the network interface card is not unique to copper cables but it's used to translate so used to translate signals signals into uh into usable bits into bits which can then be arranged uh let's into bits which can then be arranged into frames that are usable by the Dal Clare then be organized into data link lare frames all right so right so every type of medium will have its Associated uh network interface card so and each of those would be unique so for instance if you want let's say that you had a desktop computer and you wanted to add uh the ability to use Wi-Fi to that desktop computer I think if you buy like a pre-built computer nowadays it doesn't come with Wi-Fi um but you can you can buy a specialized network interface card um to add Wi-Fi capabilities to your desktop computer okay and essentially you're adding a network interface card or if you wanted support for um Optical for fiber cables you there are there's probably a network interface cable that is able to uh translate the light signals from the fiber cables into um into bits that it understands let's see okay so copper cables uh they have some challenges they have some technical challenges inside of them in that um if you have a copper cable okay um and data is flowing through it uh because this data itself is uh encoded as electricity it emits a um magnet a magnetic field so it emits a magnetic field um around that cable and if there are other cables okay if other cables that are nearby that magnetic field could cause interference okay it might affect the signal of the other cable okay so it might have some influence on on the other cable and so this has a special name this is called cross talk where a single cable May influence uh May corrupt some of the other bits on a different cable and uh this is something that we want to avoid and there are many techniques [Music] to yeah so each each cable has its own magnetic field and it might interfere with other cables okay so we want to minimize this cross talk okay and essentially one way to minimize it is uh a direct relationship to the the uh to the cable itself in that's when you're using a copper cable essentially you're sending a electrical signal and that electrical signal needs a loop okay so it needs some type of of of loop back to the other side okay so you might have some connected device over here and so this Loop the signal on the second cable the loop cable um is going to be is going to have a opposites um so it's going to have a a a opposite magnetic field to the first cable okay because it's flowing in the other direction but it's essentially the same data now the as these cables get closer and closer the magnetic field that they exert cancel each other out because they have essentially the inverse um essentially they're emitting the inverse signal to each other okay so you can get these two cables close enough then that signal should be very tiny okay now there there might be other cables over here okay there might be other cables that can still cause cross talk but essentially we want to keep these two pairs of cables that have they're essentially sending the same data because we need we need to have this sort of closed loop when we're when we're sending electricity we want them as close as possible to each other such that the magnetic field that's emitted from them cancel each other out okay so theoretically on a theoretical level um if they were on top of each other okay if these two cables were on top of each other that signal would be completely canceled out okay but we know that's not possible because um on the uh sort of physical plane um two two objects cannot um possess the same space okay so they can't be on the same space um but there is an interesting property about magnetic fields in that the magnetic fields themselves are not something that we can touch okay and so we can use that to our advantage in that the actual cables that we use for copper they look more like this they look like strands of DNA okay and there always this is called a twisted pair okay and so in this twisted pair the data flows in the reverse Direction okay but it's so they have the these inverse signal and so the magnetic field okay that is uh emitted from each of these uh it has essentially the average the average signal itself would be somewhere in the middle of this okay so essentially we don't have the same exact physical the the cables don't share the exact same physical space but if you take the aages of their magnetic field the the averages is actually on top of each other and so this sort of why copper cables are twisted um it's to have each of the magnetic fields that it emits cancel each other out so if you ever sort of buy some copper cables or something you'll see that it can typically contains tons of these sort of Twisted pairs inside of them and and the reason why they're Twisted is because they emit this magnetic signal and if you if you uh that magnetic sign signal can cause interference and to minimize interference we twist them so that the magnetic signal itself cancels itself out okay uh so let's go to fiber next okay so next is fiber fiber cables and so fiber cables use light modulation uh usually there's this uh sending device um that will send light out um and then there's typically a receiver that will detect the light and uh fiber itself is transmitted using glass tubes so there's a glass tube okay and so essentially uh the the one bit is sent as a pulse of light oops pulse of light and the zero bit is no light okay so it's essentially just flickering a light down a class down a glass tube that gets picked up by some receiver um so that's the sort of simplest way to describe it to like a young child but there are a lot of nuances okay um so first the theoretical maximum speed of optical optical cables is bound by the speed of light okay so you would imagine that we build to sort of send data infinitely fast because we can just send it at the speed of light um but there are many problems that prevent us from getting to this theoretical limit uh so the is called um where is it so the first problem is called attenuation loss or also called smearing so attenuation loss 10 okay so again we have our transmitter we have our cable and we have our receiver okay so in a perfect world uh I'm sending beams of lights and um when I don't want um the data being sent uh there will be sort of a gap in the transmission okay so we'll just make it look like this as a line so if the message itself goes perfectly straight perfectly parallel to the tubes then uh the message is is sent and received perfectly but the reality is that it's not going to travel completely parallel to the the the tube so what might happen is that when we're initially transmitting it goes it angles a bit okay now it's not going to escape the the tube because it's it's made of complete glass and it's going to essent but it's going to bounce okay and it's going to bounce and ricochet shave back and forth and eventually it'll hit the receiver okay but we can see that during this time okay it's it bounced a few times and the question is what arrives first a perfectly um straight path or one where we're bouncing a bunch of times beforehand so obviously the the perfectly straight path would have a shorter distance okay and uh the the one that bounces back and forth would be slower so you have some signals that are faster than others okay because it's it it um and because of that you get a on the receiving end you get this smearing effect um and essentially to compensate this to compensate for this you have two components first you have to use the slowest transmission so use the slowest transmission slowest uh so if it bounces like five times or so to get to results to get to the the next amplifier that's the one that you're going to be using not the one that that goes in a straight line okay and the second component is you're going to need many amplifiers along the way okay so what is an amplifier it's it's just another system of this so would catch the catch the message and then Reit it to the next pipe which would then catch the message and admit it to the next pipe so the idea itself is the smearing problem goes away if the cable is very small because it doesn't have time to bounce that many times um but if it's a very long cable then spearing becomes a bigger issue so you you essentially have amplifiers along the way to uh limit how much uh smearing that you get now the other issue with Optical and the kind of bigger issue to why we don't use Optical inside of our house um or like for everything why don't we use because Optical is much faster it's like um it can be thousands of times faster than than than cables one second all right sorry about that um okay so the the other problem with uh optical cables and why we don't use them for let's say our gaming mouses and other things that uh where speed is very important is Optical doesn't send power so it doesn't send power okay versus um copper cables copper cables have you know they encode information using electricity so um so we can't really use this to uh Power our mouses and stuff now we there do exist like composite cables that might have like Optical and uh power cables okay so they combined the two and those work pretty well uh so the internet backbone is predominantly made of fiber uh because of the increased bandwith requirements uh companies like Google Fiber and ver and FiOS are entering the consumer space but even then typically they stop as soon as they get to um they they they stop as soon as they reach your house they don't actually uh it's very difficult to actually wire your entire home with anything besides copper cables okay so next let's talk about uh Channel types Okay so Channel types okay um so before we go into Wireless we're going to identify the three types of um three types of transmission uh methods H yeah okay um so the first one is the Simplex communication and so this is uh also called unidirectional okay so we saw this with the Homing pigeons uh so this is oneway delivery data so we can think about this like uh TV TVs and monitors um SEC feeds okay so you have a home security system or something that is only one way you can't send a message to your cameras uh any type of sound system is typically one way um and uh baby monitors are also one way okay so anything that's a oneway uh where data flows in a single Direction it's a Simplex communication um and so the opposite of that would be a duplex communication okay so this is bidirectional okay so data can flow in either Direction but for this we're going to need to break it down into two more um categories subcategories so the first subcategory is going to be half duplex okay and half duplex means only one party can send at a time so you you can both send data but only one party can send at a time so you can think about like a walkie-talkie so I don't I don't know if you guys still know what a walkie-talkie is but uh when I was a child uh we had these devices where you hold a button and then you can talk to the other person um um but they couldn't talk back unless they were holding the button all right uh so only one one person can can send a message at a time with a walkie-talkie uh and that was the limitations of the technology back then uh so the other one is going to be full duplex or fully duplex which means that um both party can send at the same time both parties can send at the same time okay so cables typically operate in fully duplex okay so let me put that okay okay so cables typically operate in fully duplex um there are some exceptions of course if you're if you have like a um if you have one of the above devices like a baby monitor or a sound system that are designed for only um oneway oneway communication then those cables themselves will operate in um will operate in Simplex mode but that's mainly because the the other end doesn't have any way to transmit that's not really the cable's fault I'm pretty sure the a lot if if we're just using like standard cables or something um then it's probably cheaper to just use a a fully duplex cable than to design a Simplex cable okay um but we'll see that even though cables operate in Full full duplex mode there are ways to degrade a connection to half duplex okay okay and how that is done is because we may have so so the next um thing is going to be the Hub so this is a historical uh device okay so the limitation for for all cables is that cables are point-to-point connections so the question is what if you have three computers okay if you have three computers well I could Comm connect a and b with a computer and A and C with a computer and BNC with a computer but if I add another computer over here then you can see that that's we're essentially exponentially growing the number of cables that we need every time we add a device to our Network so not the best solution uh instead there was this old device called the Hub in which you would connect all your computers to the hub and the Hub itself is a physical layer device so this is a physical layer device and it is it is dumb that is it does not have no CPU so it has no CPU inside of it so what did the Hub provide so the goal of the Hub was to act as a virtual cable and so essentially how it worked was if a signal was received on the Hub it would duplicate that signal to everyone else except for the receiving component so it would duplicate that signal so duplicate okay duplicates any receive signal on all ports all physical ports except for the one that arrived on okay so if a sends a signal that signal is duplicated to both B and C okay and if B sent a a signal to the hub that message is delivered both to A and C yeah so so the Hub itself does not care about what well it's it's it doesn't have a CPU so it's it's not able to look at the data okay so it's not a so unable to it it we what we'll see later on is the invention of the switch which is a much better Hub but the Hub itself is dumb so it has no ability to look at the data and decide oh this message is for b or this message is for C it just do it just any signal that it receives it duplicates that signal and uh send it out uh so cable Splitters that probably sense yeah those are probably Hardware devices that just duplicate the signal into uh into two or more uh outputs so uh I think a hub would be slightly more advanced than that in that uh um it's able to so it it doesn't so the component with the Hub is it doesn't have a direction whereas a cable splitter usually has a direction there's like something very clearly labeled inputs and something very clearly labeled outputs that is not the case with the Hub each of the cables that are attached to the hub is uh pointto point and and duplex okay so there so similar but probably not exactly the same as a cable splitter okay so what's the problem with this well the problem with the Hub is it creates what we call a collision domain okay so this creates a collision domain so collision domain and so cision domain essentially uh is uh when a network connection is down is is downgraded to have duplex connection uh is downgraded to have duplex because of corruption okay so let's see the problem okay so let's say that a is sending a message [Music] um so a is sending message goes to the hub The Hub duplicates the message to all other parties okay to B and C and so this is fine okay no problem so far then C decides to send a message uh let me change the color here so C decides to change send a message message and this is where the problem occurs okay so we already mentioned that cables themselves are fully duplex so full fully duplex but what does fully duplex mean fully duplex means that you can send and receive at the same time so this is okay and this is okay too fully duplex okay because I can send and receive at the same time it does not however let you send two signals at the same time so it's not able to support two signals at the same time so these two signals what's going to happen is they are going to mix together and then it gets corrupted okay so collision domain occurs when when you're using a hub okay uh and essentially it it it happens what happens is the connection itself is degraded to being half duplex so even though each of these cables themselves are fully duplexed The Hub when you introduce the Hub the entire connection gets degraded to half duplex meaning that only one party whether it be a b or c can transmit at a time if anyone else starts transmitting that uh that signal itself will become corrupted and unusable okay so we cannot combine multiple signals okay so this was a major problem um and so the first thing that we tried to do was we tried to solve it using algorithms um so the first algorithm that arrived to fix it was called carrier sense multiple AIS and the goal of carrier sense multiple AIS is to uh sort of live with um live with this collision domain but to make sure that um make sure that corruption um that corruption didn't occur okay that the messages were Inc corrupted okay and so carrier sense multiple access is pretty straightforward most of the algorithms in this class are going to be uh very simple and typically the first thing that you would think about um there might be one or two algorithms when we get to um the later half of the course that more complex but especially for the networking Theory they are not that difficult um let's see so the first step is to verify that there is no is no signal being received okay so if you're using a copper cable for your connection all you got to do is just detect to see if there's any electricity flowing in from the from uh from where you're about to send out okay so if there's no signal being received that means nobody's using the connection okay so that means the connection is free uh step two send okay again very simple uh is this similar to what dialup was um not really um dialup was just very slow cable it was still bidirectional okay okay so verify that so there were some problems with this original algorithm so problems uh so this works if everyone so this works if everyone follows this protocol okay so everyone follows this protocol then this works but the problem was that there were growing pains and uh well actually let's not call it growing paints let's call it uh they were difficulties with adoption so slow adoption um slow adoption because it did not play well with existing protocols so it didn't work well with devices that didn't have that specific csma update yet uh so let let let me show you what happened and so let's say that c is not using CSM a okay okay so C is not using csma let's say that it's transmitting okay uh the other two are using csma and let's say that a a wants to send a wants to send but because it's using csma it will wait okay so it waits okay So eventually C is going to finish okay and then a is going to see that hey this n uh there's no more data being sent so I can start to use the network and so it's going to start transmitting okay so 10% 20% 40% and then all of a sudden C starts transmitting again and so this gets corrupted because C is not following the rules is not following the csma rules um and um because a is transmitting uh and C is transmitting then this gets corrupted okay so the transmission fails okay so there was an addition an amendment made to say csma so csma so the first sort of upgrade was CD okay so Collision detection which says at any point if you res if you detect data stop transmitting okay and that fixed the slow adoption problem because what it did was essentially it gave priority to the new device to the to the person not following the rules okay so let's look at this again okay so a is transmitting uh let's use [Music] blue so a is transmitting to be let's say it goes from 10% to 40% again and then C starts transmitting okay as soon as a detects that c is transmitting it's going to stop transmitting entirely okay so it's going to stop transmitting entirely and it's gonna allow C to finish transmit it's going to give C priority because it's not upgraded to csma yet now what's the difference between this and previous previously okay so uh so previously a was still transmitting when C started transmitting because it it didn't have the stop transmitting if if you detect any data at any point in time and C itself all it sees that is none of its data is being received by the receiver so I guess I'll just send it again it'll just keep on sending it until all the data is received and so instead of essentially a sending its data it's getting corrupted and C sending its data it's getting just retransmits every time a will stop sending let C finish when C finishes it'll detect that on the wire there'll be no more data and then a can restart to finish its transfer okay so that's csmac CD so the Collision detection just checks to see if there's any new data if there's new data being received that means somebody is not following the csma rules and I'm going to give them priority okay I'm going to give them priority and then when they finish transferring then inside the next window I'm going to start sending again uh so in fact the person who has an update gets the benefits but the the alternative is that nobody is nobody is able to transfer which is much worse okay uh let's see uh finally there was a upgrade called csma ca for collision avoidance and and this upgrade okay so this upgrade itself um prevented live blocks uh prevented live loock it's mainly used for for wireless so essentially we we The Hub itself eventually gets replaced with our a new hardware device called The Switch that solves this problem entirely but the algorithms uh were repurposed so the algorithms that we used in the 1970s um with the with the hubs were repurposed when we got um Wi-Fi because Wi-Fi itself operates in half dlex okay so this prevented the issue of livelock where um essentially the issue with live blocked worked like this you have two people sending okay um so let's say that a was sending to to to C okay um but of course B also gets it and then B starts sending um actually let's so before the connection gets to to B let's say that b starts sending because it hasn't received the message from a yet okay and then it receives the message from a uh but it's too late it already send its own message out okay and so in this case since everyone is operating using csma both A and B will stop their Transmissions okay so both A and B will stop the transmissions and then they'll wait until there's no more signal being sent and then they'll restart okay uh this should be blue what you can see is that essentially if they start sending at roughly the same time then essentially they'll get each other's messages and then csma says that csma with Collision detection says that if you receive any data from somewhere else immediately stop sending so so they'll both essentially start sending see that someone else is sending uh stop sending because of collision detection and then um uh start sending again okay when when there's no more connection uh so essentially you can sort of think about like two people trying to get out of each other's way but uh so you can imagine like two people trying to get out of like two people are blocking each other and they both take a left step at the same time and then they take a right step at the same time and they they still are blocking each other um right so that is the issue of livelock and so the solution to this essentially there's a randomized timer so randomized timer that's okay if you hit a a scenario where someone one is sending data then you're going to sleep for some random amount of time before you start uh sending again and so this fixes the issue um there's still a chance that you you pick the the same random number over and over again uh so you might still have a few steps of live lock um but it's not the case where you'll get it every time um uh because you were trying to send it as fast as possible okay that uh it might happen once or twice but it's not going to happen but as the time period extends the chance of it occurring more and are infinitism small