Computer Networking Fundamentals
Transcript
If you have heard terms like OSI model, TCP IP model, IP addresses, subnets, routers, switches, modems, etc. and it doesn't make any sense to you, then by the end of this video, it will make sense to you. I promised it. But before we get into that, I want to mention a few things to you. And those things are like first we are going to understand things from the first principles. Yeah, like going all in. I won't be like throwing jargons at you and expecting
you to know those things. And the second thing is to have some patience. Yeah. So have some patience. Like by the end of this video I'll interconnect different things like at one point you might think why is he even teaching this thing because that's a prerequisite for understanding other things. So we'll connect all of them together and then everything will make sense. And another thing is know what you know. Should I write this? Okay, I'll just dictate it. Know what
you know and what you don't. Though knowing what you don't know is a major problem in itself. Like I'll mention to you if I'll throw some jargon at you then I won't tell you that you should know this. either I'll explain it from the first principles or if it's an abstraction thing like these things are kind of topics from other domains then I'll let you know that this is an abstraction and I'll guide you in the right direction what you should look for. So now we are going to talk
about how computers communicate with each other aka computer networking. But before we start, we are going to always ask this question. Why? Why do we even care about this thing? I mean, what's the purpose? So, you know, humans have always wanted to communicate at a very high speed and that should be reliable and efficient. So, suppose there's a human being here and there's another human being here and they are probably like thousands of kilometer away. let's say 10,000 kilometer and this guy needs to convey an information that's really important to this guy here. So how could he do that? Well, he can hire some other guy whose job is to deliver messages. So what he would do is give this man a small piece of information he can carry and then just deliver it here. I mean this sounds crazy. You can travel the whole world just to just to deliver this information here. But there are several problems here. One thing that could
happen is like he's going to travel 10,000 kilometers. So there could be a war going on here between two civilizations and this guy could get killed. So this guy won't get this piece of information and won't even know that someone someone was going to deliver this message to him. Another thing could be someone could threaten this guy to tamper with this piece of information. So yeah, I mean this is not reliable. This is not efficient. We need to figure out a better way. And then telegraph lines were introduced. So an electrical line was laid down between two points. And then you can just use more code to deliver some information. Now I want to guide you to a point a book you should read and the book is called the hidden language of computer hardware and software and you'll get to understand how telegraph lines were introduced how this form of communication came into existence and finally into the computers right so this is important but
this is not a prerequisite so I'm just giving you a brief overview of the history of communication not in very detail though but you know that Humans always wanted to communicate at a very high speed and in a reliable way. So then computers were built at some point in time of history. We built some computers and then the problem was that we have some files stored here and some other files stored here and we want them to share. Well, one thing could be you can get a pen drive, a floppy disk, a hard drive, store some information from here to that drive and then use it here to get that information. But mind that this computer should support the reading and writing of data on that kind of disk. So there should be some kind of hardware in that and some kind of software that can do this process. So yeah, we just wanted to do this but then another thing could be
who would deliver this hardest at a very large distance. I don't know I I can't. So then we can communicate these two with a wire like telegraph lines were done and we are going to talk about that how we can connect two computers together with a cable some kind of cable. Let's call it an Ethernet cable. Yeah, we are going to explain what it is like how we do it and then how we can change the voltage level to communicate between them. But yeah, before we did before we do that,
let's understand some prerequisite for these things. How can we store any kind of information using numbers? Suppose I have some text here. Now, how can I convey it to you? Well, I can say hey. Or another thing could be like you are standing at a very far distance and I do something this 2 4 1. Now these are just some numbers I trans I deliver to you using some sign. But how could you make sense of this? Well I can do one thing. I can say A stands for 1, B stands for 2,
C stands for 3 and Z stand for 26. So when I say 3 2 1 I won't speak about this. So science to you then you would make sense that yeah this guy means C A. So any form of text for example here and a dot well I can give a dot to 27 any form of text can be represented using numbers. I can just write down some numbers here. 7 21 22 6 and this would mean some information, right? Well, text can be
represented using any form of information. And why are why are we like even caring about representing them in the format of numbers? Because computer works on binary data and that is a number system. Well, now I can represent any text as a set of numbers and then I can convey that information to you. But what about an image? Suppose I have an image then how can I represent this as a set of numbers? Well, for that you have to understand a few things. Uh yeah. So whatever the object you have then when I say the color is blue, it's not the property of this object. Okay. Do I have to change this? No. So it's not the property of this object. It's some perceptual experience created in your brain when the lights come and hit your eyes. Okay. So for example, you know light have
different wavelength and for that for that jargon you have to understand what a light is, what an electromagnetic radiation is. Probably go to the rabbit hole of atoms and try to understand these things. But that's not the scope of this video. If you want to understand about this thing then just go and study about this because we are not going to pretend that we know these things at least for now. So yeah because I could like give you the usual definition of a wave of an electromagnetic radiation of a color or everything but I won't do any justice to my philosophy of understanding things. and I don't want to do that. So feel free to just go and search on the Google or have some chat with chat GPT and try to understand things from the first principles. I'll come back to it sometime later. But for now understand that when light hits your eyes there is some perceptual
experience created in your brain. And another thing is there are like a light has a wavelength right? You understand this? So there are like some tensors in your eyes. Uh S and L phones. I think that's what they call this. I don't remember the exact names and who care about the names. I'm sorry for the crackers. But these are sensors for wavelengths of light and these detect the intensities of light closer to the wavelength of red, green and blue colors. So that's why
any color can be perceived by these kind of cone cells in your eyes can be stimulated note the word stimulated by three colors RGB red green blue you take three LEDs red green and blue and fire some light from them at different intensities so when the light is fired from these LEDs at different intensities then it's going to hit your eyes and these sensors are going to detect these lights because their task task is to detect the intensities of these three different colors
because of their wavelength. So if there were like another kind of cell here, con cell here, then we would use another kind of color to stimulate that color. But why do we even care about this thing? Because we can have now like three LEDs here. What is a what is an image? It's a grid of it's a grid of pixels, right? Not grid. It's a grid of pixels. So there is like red and for each pixel there are like three LEDs here. Think of it red, green and blue. Like now I can fire these different pixels at different intensities. And now these are going to hit my eyes and some perceptual experience is going to be created. And that was the reason that we had RGB here and not RGY or some other color because these three cone cells uh detect or sense these kind of wavelength that matches to red,
green and blue. So I hope that makes sense. So for example now I can represent this whole image as a set of numbers. How? For the first pixel I can say 71 211. So what this represent is like I'm telling you the intensity of red green and blue colors out of 255. Okay. If I say 255 255 255 it is saying that red green and blue LED lights are firing the light at their highest in intensity. So
why out of 255 and not 100? Because your computer uses eight bits to store these numbers and it could be any higher number if your computer uses more bits to store these colors and those would be more accurate I guess. Yeah. So now and then you can like represent second pixel as another set of numbers 21 22 23 and so on and you can just take every pixel out of it and represent them using numbers and you're done. You can represent now any image using a set of numbers and then you
have a video is nothing but images playing at a very high speed like a set of images and now they are just playing at a very high speed. So image is nothing but these grids of pixels plus time stamp like at art time which frame needs to be appearing on the screen. So you can like now store any kind of information using just numbers. Now we were using uh decimal number but we can also use binary numbers right? Uh for example hi how can I say it in binary? Well I'm not going to
say hi but I can say a b. So for A I can say zero. For B I can say one. For C I can say what? 0 1 0 1 uh 0 sorry 1 1 D 4 D. Yeah. So these are the first four numbers and then I can go ahead and write more binary numbers again. 0 1 0 0 1 1 0 0 0 0 0 1 1. So these are the next numbers. And if you are curious about why I followed this format like 0 1 0 1 0 1 0 0 1 1 0 0 and so on then you got to
understand about how number system works. This is the foundation of this thing. And for that I would recommend you one another book and the book is called understanding numbers for elementary school or something. I don't remember the exact name but I'm going to write it down here or check the description part and it's by the yeah it's a very good book and it talks about like the really fundamentals of mathematics. Have a look at it. So now any kind of information can be represented using numbers. This is what we have till now. Now you have to understand this another concept that the set of bits suppose for example 1 0 1 0 1 can be represented using any physical property that exist in two distinct states. For example, I can have a set of boxes here and I can fill in fill in
some water in some of them. For example, here is water and here is water. So I can say because this box ex exists in like two states. Either there is water inside it or there is no water. So I can say if there is a water I can say one otherwise 0 1 0. So any physical property that can exist in two states can be represented as binary data. Then since your computers uses transistors and electricity. So what we can do is we can define this thing like this. If we have a voltage of + 5
volt or greater than that then we can say it's a one or if it's less than we can say zero. So for example we can take a wire uh and then measure the potential difference of it with respect to the ground. Now using a voltmeter. Now this is some another jargon of electricity and you need to understand what voltage is but for now consider it a form of abstraction that it's a property of some material which you can measure using some device. So if that device shows like 6.2 then we can say it's a one. If that device shows shows like 0.2 then it's a zero. Like greater than 5 volt greater than or equal to it's a one. less than or equal to sorry less than 5 volt then it's a zero. So I think you understand this now that we can use voltage levels to represent binary data right for
example uh in your RAM we use capacitors and if capacitor holds some charge then it's a one and if capacitor doesn't hold any charge it's a zero. So there are like there is like a grid of capacitors in your memory. This is one capacitor. This is another capacitor. This is another capacitor. This is another. So if there's a charge here, suppose here there is a charge and here is a charge and here is a charge. So what binary information does this convey? It conveys 0 1 0 1 0 1. This is the binary data stored in your random access memory. We use capacitors there in some kind of random access memory. Then for hard disk I think like where you store information and you turn off the power and still you have information persisted there. So we use magnetic direction like for example your magnetic field might be in the north direction so I can say it as one but if it's in
the south direction I can say it as zero. So it's just a physical property that can exist in two different states and one of that state we can call one and another state we can call zero like it's just a way of using those numbers as physical attributes of something. So now we know that any bit can be stored as voltage levels. Now I'm sitting in my room with two computers and some information on one of them and I need to share that information on this device. So what's
the solution? I talked about one of those could be like using some form of low disk or anything and just getting it here and sharing. But another one could be I can connect them using a wire. It could be a copper cable or something. Then you know the voltage level thing. If it's a plus 5 volt, I can say it's a one. If it's a zero volt, I can say zero. Make sense? Yeah. So, what I'm going to do is every second suppose first take the binary data you need to transmit. Suppose
I want to transmit this. Okay. Yeah. So, first one and just convert it to the voltage levels first. It's like + 5 vol 0 0 + 5 volt. It's also volt. Okay, I'm just not writing this. Okay, I wrote it. Then 0 5 5. So this is the information we need to convey. So what we are going to do is on every second we are going to change the voltage of this wire. We can say we can set + 5 volt for the first second. Then as the second ends we can set its voltage to plus 0 volt. Then for the next
second also it's going to remain the same. For the next second it's going to be + 5 volt. Then again it's going to be 0 volt 5 volt 5 volt 5 volt. And this computer is going to read it's going to have some hardware that can make sense of the voltage here like it can read the voltage level here. It's this computer is going to have that hardware and this computer is also going to have that hardware that can like set the voltage level of this wire. Okay. So this computer is going to read no this computer is going to read the voltage level on this wire every second one second pass. Okay it's a 5 volt then it will convert those data using some hardware. Okay it's a one and store store it somewhere in the memory. We have hardware for these things. Okay. So yeah, then for the next second it's going to look and it's going to see 0 volt, 0 volt. So this is crazy, right?
We used a wire, we connected it between these two computers and just changed the voltage levels and now we have transmitted our data. So this is the start of our communication between two computers. Nice. This is crazy. Now suppose we have many computers. C1 I'm just going to use as a point for a computer. Now C2, C3, C4 and C5. These are the five computers I have. So what are the ways I
can share information between them? Well, one of the way could be I can connect this computer to this one. Then I can connect this to this, this to this, this to this. Then again this to this, this to this, this to this. Like every computer is going to be connected to every other computer. This is already connected to both of these. Then this and this about this. Yeah. Yeah. So every computer is connected to every other computer. If this needs to share information with this,
it's going to go over this copper cable. If it's going to share information with this, it's going to go over this copper cable. Like we are going to flip the voltage level every second over here. And this computer is going to read information from there. But suppose there are like 100 computers. So I have this computer. So this computer needs to be connected to 99 other computers. So one port is going to use this. Another port is going to be connected to another computer. We are going to use another port to connect to another computer. You think your computer is going to have like 99 ports. What if there are like thousand computers? It's going to have 999 ports input output ports. I haven't seen any. So this is not the right way. Like between two computers it's okay. We can do it. But between 100 computers, thousand computers, this is not the right way. We need to figure out a better way. And that's where the switch comes in. What is a switch? Well,
forget the term. We are not going to talk about the jargon here. We are going to understand things from the first principles and why we need to understand it. So the problem is that we have to com we have to connect every computer to other computers, right? Every computer is connected to another computer. Every computer is connected to every other computer. Yeah, sorry. We need to solve this problem. What if what if we have a single device to which every other computer
connects? Okay, every other computer is connected to this single device and this device is going to take those voltage levels and decide where to send it. Oh, nice. So, this means that a computer is not going to be connected to three other computers, but you're going to break this link. It's going to be just connected to a device here. And this computer is also we going to connect it to this device. This also this this also this. If this computer needs to communicate with this
computer, it's going to ask this device and let's call this device a switch. That's the name we gave it. So this computer is going to ask this switch, oh, hey, deliver this data to computer A. Yeah, this makes sense. But how are we going to do this? Because while sending information, what we send is like okay plus 5 volt, plus 0 volt, plus 0 volt. How is the switch going to make sense of this information? How is the switch going to know that I need to send this information to A or to B or to see? How is it going to do this? Well, another one of the simple approach could be this switch can like + 5 + 0. This switch can set the voltage level of every wire over here to the same voltage. So, every computer is going to receive the same information. It's also going to receive 1 0 0 1 0 1 1 1. It's also receive the same data. It's also going to receive the same data.
So every time you send it to A, it will also be received on B and C. Every time you send it to B, it will also be received on A and C. You don't want this. There is something called security, privacy. So we need to solve this. And let's solve this. Now to solve this problem, you have to think from the first principles. And the principle could be like suppose I sent some data here and I just want it to be sent to C. How can I do this? Well, you have to think that there should be a way to identify the computers uniquely. That's only the way you can send them uniquely. Like if you just want it to be sent to C, then you also have to be able to identify it uniquely. So for that you know that you should know this that every computer has a some kind of electronic circuit or something a card electronic card. This is called NIC card. Every computer is going to have it. This
kind of hardware is embedded into every kind of computer even your laptop. And this NIC card has a MAC address like some kind of unique address like your home address. You have a unique home address. So there is some number you can think of it as a number that's hardcoded in this NIC card of every computer and every computer is going to have a unique MAC address or a unique number associated with it. Think of MAC number as a MAC address is a unique number associated with every computer. It's be it's going to be hardcoded into the hardware. So yeah. So what we can do now is so what we can do now is we were sending voltage levels across this to transmit binary data and suppose I was sending high will be converted to binary data using some form of encoding have a look at UTF8 encoding that's similar to the way we talked about mapping A21 B22 some kind of similar kind of thing. Okay, so have a look at it. And high could be converted into
some binary data. Okay, but this is not enough. If I send this binary data like hi to switch, it's going to be like okay, where should I send this? But what I can do is this is our data. Okay, think of it as our data. What I can do is I can wrap this data with some other meta data. I can be like, okay, here goes the source MAC address and here goes the destination MAC address. Or I can just add it here at the front. Destination MAC address.
So suppose the MAC address of this is two. The MAC address of this is one. The make address of this is four and this is three. Now this is not so simple. Make addresses are not so simple. They have a fixed length. Have a look at it. But what I can do is instead of sending this data 1 0 0 1 0 1 I can add the destination and source MAC here. What's the destination MAC? Uh destination MAC is suppose I'm sending from A to C. So it's going to be two and source make is going to be four.
Convert it to binary it's going to be 1 zero and it's going to be 1 0 0 0 1 2. Yeah. So when this binary data it's going to be one 1 0 0. Well let's like this the number of bits used here is different than this. And if the make address is a bigger one then the bits are going to be different. So let's just append zeros here to make it a fixed length. Four bits maybe. Yeah. So the data is going to be 0 0 0 1 0 0 1 0 0 1 0 0 0 1 0 1. Now this A is going to change the voltage level
every second on this wire. It's going to be like 0 volt 0 volt 5 volt 0 volt 0 volt 5 volt 0 volt 0 volt 5 volt and so on. Now this switch is going to receive this data. Yeah. Now this switch is going to extract the first four bits, the next four bits and the rest of the data. Now we know that the first four bits is a destination MAC address. How we know this? Because we set the roots. We are the ones who set the rules and we are the ones who designed this hardware component. So we are going to write some logic in some hardware component of the switch that's going to take the first four bits of this message it receives and based on this it's going to check the MAC address of each device and it will know that the MAC address of C is 00 1 0. So it's going to just forward it here. Yeah,
that's it. We are going to send some metadata to switch so that it can forward it to the right point. But how is it going to know the MAC address of C B? So the first time it receives this message, it's going to be like, okay, I need to send 00 1 0. I don't know who the damn who this guy is. 0 0 1 0 make address who this guy is. It's not going to know. So it's going to forward this message asking for who is 0 0 1 0. maybe it will send the data along with it and then it's going
to receive it. B is going to say no I don't have this MAC address. Uh C is going to say oh yeah I have this MAC address. So it's going to send the data back again to it with this thing 0 1 0 0 0 1 0 because destination MAC address was this for this but because this C is sending the data so the source is going to be 0 0 1 0 right source and destination make it rays are going to flip now switch will see that okay this port of mine let's say these ports have a number A, B,
C, D. It's going to notice that okay, port C has 0 0 1 0. So what it's going to do is it's create it's going to create a table for itself and it's going to store this information. So next time this message comes maybe this time I send different data. So it's going to know okay 00 1 0 it's going to check this table here and oh see port C I'm going to send some data on this port and yeah it's done. So this is how it's called I think MAC address table for a switch. Yeah kind of.
So now we can send information between different devices at a very quick speed in a very reliable way. And for now we just had destination source MAC and data. But in practicality like when you see in the practical world there are going to be other headers and because this thing is very complex we are understanding it a very foundational level. So these are enough but this is going to be a very complex thing there is also going to be some other metadata included here.
So which is going to extract that to get some information about the data it received. So yeah and we give it a name frame. That's just a name you should care about. We just call it a frame. Nothing much. You might notice that we are always understanding things from the Y perspective. Like why we introduced the switch here? Because we had to connect cables between every computer so that they can communicate. We did not want that. So we solved that problem. But there might be
another problem. Have a look at it. Now let's talk about another scenario. Suppose you are sitting somewhere here with a computer A connected to computers B and C. Here is some other network, some other set of people sitting maybe somewhere in USA. Yeah, these might be in Japan and again India and these again might be in India. So now what we can do if A wants to communicate to F like what's the procedure we need to follow? Well, one of the simple approach we can follow is connect
every switch to each other. Yeah, this will work. I have connected all the switches together. So now what's going to happen is suppose A wants to send some data to F and the MAC address of F is 0 1 1 0 and MAC address of A is 0 0 0 1. Is it fine? Yeah. And again have a look at the format of MAC address. The format of MAC address is defined and the length. So it's easy to extract it and maintain some consistency. Yeah. So now we are going to send some data. It's
going to be this four and 48. This data I need to send from A to F. Now what we are going to do is we are going to first wrap it around with some destination and source MAC address because switch needs to know where to forward the data. So we'll take this data and wrap it with source and destination MAC. What's the destination MAC? 0 1 1 0 and source MAC is 0 01. Now these set of bits I need to send to S1. So S1 is going to get this. I'll change the voltage level every second. Well, that's not practical though. Like every second if you are changing this voltage, then how many seconds it's going to take? 16 seconds. 16 seconds just to transmit this data. Well, that's not how it happens. It's very quick like milliseconds, nanoseconds. I guess I did not look it up. So,
I just came up with milliseconds or nanoseconds. But it's very very quick. Just remember that. But for ease of understanding, we are just believing that uh we are just going to look at every second. So every second switch one is going to look at this wire and see okay I've got 0 volt I've got 5 volt next second I've got again 5 volt for the next second so it's going to take these details
and find out that the destination MAC address is 0 1 1 0 well it will see that neither B ne or C has this destination MAC address so like what what happens when S1 gets a MAC address it doesn't No, it forwards the message to all of its ports like except the one that sent it. Switch one knows that a sent me the data. How switch one knows this? Well, that's how we designed it. It can know it has a hardware chip inside it written with some software. So, it can know we created it
as an engineer. So, it's going to get some data and it's going to see its MAC table. It's going to have a make address table with address here and port here. So it's going to see that okay 0 1 1 0 is not known to me like where it exists. So it's going to forward data here. Okay B is going to say oh no this doesn't belong to me. C is going to say oh no this doesn't belong to me. Then it also needs to forward to this port. Now data is going to go to S2. STO will receive
the destination port 010 1 0 and it's going to see its MAC address table if you can see and again it might not know where 0 1 1 0 reside so it's going to again forward the data to F D and E and D are not going to respond but F being the receiver of this like the original person or original computer who needs to know this it's going to reply back oh yeah this is my MAC address I'm replying with some data. So f can like reply with any data. It it depends on f what code you have
written to reply. So yeah and it depends on you. So it's going to send back and it's going to store the MAC address and the port number of F and then it's going to forward to the source. S1 is going to receive this message because it came from this port. So it has to forward it to that port to the source port. So it's going to receive it here and then the S1 will forward it to A. So that's how it happens. What happened? Like what will happen if J if A needs to communicate to J then it's going to go here broadcast here then broadcast to S3 broadcast here broadcast here. Now suppose there are like millions of such networks and there might be billions of computers on this complete network. So suppose A wants to communicate to J and there are like millions of computers here. So what's
going to happen? Every computer in that million network is going to receive a broadcast that hey are you this MAC address? Hey are you this MAC address like every single computer we don't want that it's like waste of resources so we need to find a better way that okay I just hope here and I just came to know that okay I don't want to check every device something like that like what should be our thought process our thought process should be like I don't want to check every single device maybe whenever I just go to this network I should just know here that if a device is inside it or not I don't have to go through each of these device so then we find out a new way like this address is not going to work and also you sitting here should know the MAC address of J do you have
access to it do you have access to the MAC address of Google server located somewhere in US no you don't so we need a new format of addressing that's kind of hier hierarchical and you can use it in a better way to solve this problem. So yeah, people give this problem a thought and came up with a new type of address. So let's say this network we call it a network A. This network can be called network B and this network can be called C and other networks D E F G H and this
devices 1 2 3 like if we if we want to reference this computer uniquely and anyone can reference this computer uniquely then we can say A.1 and for that we can say B.4 for this we can say C.8 8 or even we can have like C.1. Yeah, it's up to us. It's our format of addresses. So yeah, so for example, now A.1 needs to communicate to C.8. This makes sense, right? This is just a new form of addressing we introduced and you will understand why we are addressing like why we are
naming these computers this way. Let's see. Well, let's connect them together these switches. So, the data is going to go from S1 to S_UB_2. And yeah, there's another issue here. Now, switches work on MAC addresses. This is a new format of address. Let's call this IP address. Does this work? You have any issue? I don't because it's just a new name I gave it and you can search for the reason why why we gave it as internet protocol address. It's just a protocol a set of rules. So
what we'll do is we'll just take our data. This is our data we are sending and here it used to be source MAC address destination MAC address. But we are going to include two more fields here. destination MAC address. This is our source MAC address. Then we can add here like destination IP and source IP. Is that okay? Yeah, it's okay. Like we had some bits then we did some computation on it and added more extra bits to the left of it so that these switches can extract those
bit and decide where it should go. But you know we had already designed our switch hardware and it just extract the first eight bits because we assume that destination and source make address are of four bits. So what's what it's going to do is it take all the bytes all the bits together and it's going to extract first four bits and going to know that okay I need to forward it to S2 where wherever it needs to. So we need a new kind of hardware device and that's called
a router. I mean we can call it a router. Why router? Because it's going to help in routing. So I'm going to first connect this switch to a new device uh new device so that it can help us in a way. What way? You are going to know this soon. Yeah, this is a R2. This is R1 and this is R3. So switch is going to get this value. Yeah, let's not talk about that first. Let's talk about this new device. So what this new device is going to do? This is going to help us in better routing
of the networking data. I was just going to say something but I just framed my words you know as I fumbled. Anyways, so some data is going to go from C1 and the destination IP is going to be C.8. So whenever the data reach here, can you easily tell that B this is a network B and we are going to go to C.8. So we don't have to check every device here. Like of course B network is going to have B dot something and we are going to C do something. So we don't have to go through each
device and check their MAC address. We can just skip this and move ahead. Then we go to S3 and if there were some other switch with a D dot with network D, then we won't even compare it to that. We will just skip it and move ahead. And then we come to C. Now yeah, our destination is C.8 and our network is C. So it's definitely going to be inside this C7 C.8 and finally we reached here. So this is kind of logic we need to implement in our router hardware. So here is what going to what's going to happen. Look switch works on our MAC address and it needs to. So this is what we are going to send using some voltage levels connecting by wires or maybe fiber optics but we are going to talk about them later. For now let's understand this. Now one more thing you need to know is that when you are on your computer you know your IP address right how does it know its IP address
because router sends them a message yeah router send them some bits through which our computers come to know that oh this is our IP address that's nice so when C1 send wants to communicate to C8 that is A.1 wants to communicate to C.8 8 it knows that C.8 8 is not in its network. Like if it wants to communicate to A3, it definitely knows that A3 is in network, right? Because a network a
network. So yeah, it's going to be in this network itself. So what it's going to do is it's going to write its data. Uh it's going to write its source IP. It's going to write destination IP. Then it's going to write source MAC. source MAC is IP MAC address of C1 and destination MAC address is of C3. How is it going to know the destination MAC address of C3? Well, it's going to like Yeah, how how is it going to know the destination MAC address of C3? Well, it can like
broadcast the message. Well, there's no way. I think there's no way that you can know the MAC address of C3 just by sending it some data. You have to know it manually, right? Yeah. You have to know manually the MAC address of C3 and then it's you are going to put it here on your own. You have to maybe go to that computer, see its MAC address and put it here. So yeah, it's going to get this send it to the switch and switch
is going to forward it to C3 based on its MAC address route MAC address table. Yeah. But what if it's it needs to communicate to C.8? Well, our computer knows that C is not in our network. So, what it's going to do this time, it's going to put the data. It's going to put the source IP, destination IP, source MAC. But what about the destination MAC? Well, since it's not in our network, it's going to put the destination MAC of a router. Yeah, router has a MAC address.
Remember that? Because this is going to handle the part of communicating our data to other parts of the network. So, we put the destination MAC of a router. Yeah. Not a like C7 or C8 or something. So now the switch is going to get this. Switch is going to find the port it need to forward the data on and then it forwards the data here and router is going to get this message. Now what's router going to do? Router is going to take the data and find the source IP and destination IP. And since it's know that C.8 Eight is not in this network. It has to forward ahead. Now it might be possible that router might have two paths and router maintains a table called a routing table and it maintains something like this. For example, it might have that if I want to reach to C some C network then I have to go through three hoops and it's on my port number two. If I have
to go to maybe network B then I have to take two hoops. Two hops means one router, second router, first hoop, second hoop and it's on my port number one. So something like this it maintains a routing table. And how does it know that? Because this router sends a message to this that I can reach to network C without any hope like just it's directly connected to it. So it will say that okay I can reach to C network in one hook through port number one. So it has a table. It knows how
to go there. And how it knows? Because routers keep communicating with each other. They keep sending messages to each other. So yeah, they maintains a table. Now what's going to happen is router receives this and router see okay I need to go to C and it already knows that if I just pass the data to this port then it's one step away from S2. So it's going to receive the message here and then it just need to send to C network and it knows that C is directly connected to me. How it
knows? Because S3 is going to tell S2 that hey, hey C network is on me. Yeah, like there are some protocols you can look into that helps routers communicate. How how do they communicate? Well, they can they can also send some bytes, some voltage levels across these wires. Who's going to stop them? We can say like every 30 seconds we can program router such a way that every 30 seconds keep sending such byes and those byes are going to tell about like first four bytes might

Ask anything
We've read this whole study set, so questions about it get the best answers.