hello welcome to the second part of our lesson on network devices this is the first lesson from the first module of my new course on networking fundamentals the purpose of this module is to teach you how data flows through the internet in part one of this lesson we discussed the concepts of a host an ip address and a network if you haven't watched that video go ahead and pause this video right now and watch the first video there'll be a link in the description in this video we're simply going to continue right where we left off now the main idea we want to teach in this video are these last two devices switches and routers but we can't really understand those until we understand where we've come from so we have to start there in the last video we unpacked the idea of a network we identified that a network is created anytime you connect two computers to each other using a wire one thing to understand about sending data across a wire is that it decays as it travels greater and greater distances if the two computers you're connecting are in the same room then you don't really have to worry about it the decay will still occur but the signal will still get through and therefore connectivity between these hosts is still attained if however these hosts span greater distances maybe you're connecting two computers on opposite sides of a building or even in two different buildings then you might have a problem if the signal decays before it gets the other side then these two hosts cannot share data in those cases what you need is a repeater a repeater is a device whose sole purpose is to regenerate signals anything that comes in on one end simply gets regenerated out the other side this allows you to connect devices together which span greater distances so far we've been talking about networking from the perspective of connecting one host directly to another host well if you add a third host you now have to connect that host to all the other hosts which you've already established and if you add a fourth host you now have to connect this fourth host to all the hosts that already exist and again if you add a fifth host you now have to connect this fifth host to every host that has already been connected as you can see connecting host directly to each other simply doesn't scale instead we created devices which we could put at the center of every network and connect all the hosts to those devices and these devices would then handle funneling communication between these different hosts the benefit to these types of devices is that if a sixth host gets spun up it's very easy to simply connect it once to that device and now it has connectivity to every host that has already existed that's what all of these are and the first of these types of device that we're going to discuss is known as a hub a hub is nothing more than a multi-port repeater earlier we discussed repeaters and we said all they do is regenerate signals hubs do the same thing except they do it across multiple ports for example if these two hosts over here need to communicate one of them sends a packet to the other it'll hit the hub and the hub will simply duplicate that packet and send it out all remaining ports that allow what this guy sends to arrive over here this fixes the scale problem hub is the first device that allows us to connect multiple devices in the center and now all of them have connectivity to each other but as you can probably see the problem with the hub is that everybody receives everybody else's data these two hosts over here which are uninvolved in the communication between these two hosts are receiving a copy of everything they send which brings us to bridges here we have two sets of hosts all interconnected using a hub and a bridge is meant to sit in between hub-connected hosts bridges by definition only have two ports one port facing one set of hub-connected devices and another port facing the other set of hub connected devices bridges will also then learn which hosts are on which side of the bridge this would allow the bridge to contain communication to only the side that is necessary for example if these hosts again need to speak to each other when they send data to each other through that hub the hub is of course going to simply regenerate that signal at all ports and notice that the bridge can be getting a copy of that packet but the bridge knows that the other green host is on this side of the bridge and therefore the bridge isn't going to bring that packet to the other side the bridge is the first type of device that helps contain packets only to their relative networks on the other side if these hosts need to speak to each other they can also send packets to each other through their hub and once again the bridge will not let those packets bleed into the other side because it knows the yellow devices exist on the right hub and of course if this device needs to send something to this device the bridge is going to know that that traffic is going to have to cross the bridge and the bridge will allow that packet to traverse to the other side the main takeaway is understanding that bridges can learn which hosts are connected on either side of the two ports of the bridge now this finally brings us to switches switches are sort of like a combination of hubs and bridges they are like hubs in the sense that many devices can connect to the switch and they are like bridges in the sense that they can learn which hosts are connected to each port the main difference is that they're doing it on a per port basis which means if these two hosts want to speak to each other the switch will know that the only ports that need to receive this traffic are the two that are connected to those green hosts and will keep that communication contained to just those ports moreover if these two hosts want to speak to each other the switch will again make sure that that communication only flows between the relative ports so this is how a switch is like a combination of a hub and a bridge the formal definition of a switch that we want to use is that a switch is a device which facilitates communication within a network earlier we defined a network as a logical grouping of hosts which require similar connectivity which means all of these devices over here all belong to the same network moreover networks all share the same ip address space which means this network owns all the ip addresses which start with 192. 168. 1.
anything and this host's identity is the ip address 192. 168. 1 dot and this host would be 192.
168. 1. 66 and this set of devices could very easily represent all the different hosts on your home wi-fi network maybe this device is your printer and this device is your laptop and this device is your mobile phone and so on or maybe this network and these devices represent all the pcs that might exist within a particular classroom of the school network or maybe even further all these devices represent hosts that exist in the sales team of the london office of the acme corporation one way or another since all these devices are connected with a switch they all belong to the same network now let's go back to that example of the school network we said that the school likely has many different classrooms and each of those classrooms belong to their own network which means this would be a more accurate representation of the school network we would have classroom two owning that ipspace and classroom three owning that ipspace now the reason you might want to separate these two sets of devices into their own network is because they might have different connectivity requirements for example maybe these computers over here all belong to the biology classroom and all they need is simple internet connectivity but maybe these computers over here belong to the computer science classroom and they not only need internet connectivity but also access to various cloud resources to do their studies well since these computers have different connectivity requirements than these computers it's a good idea to separate those out into separate networks now in both cases we can still use switches to facilitate all the communication within the networks meaning this switch can handle all the communication between these three hosts and this switch can handle all the communication between these three hosts but what happens if this host down here wants to speak to this host on a different network well if a switch can only facilitate communication within a network we would need another type of device to handle the communication between networks and that device would be a router a router is a device whose primary purpose is to facilitate communication between networks at the very least you're going to need that router to connect you with the ultimate network of networks known as the internet so let's unpack this further routers provide traffic control points between networks let's say we wanted to limit the traffic that could go from this pc to this pc well since these two pcs aren't separate networks all that traffic has to flow through the router creating a great place to add security policies or traffic filtering or even redirecting that traffic elsewhere entirely since routers sit on the boundary between networks they provide a logical location to apply security policies this type of security filtering isn't traditionally available on switches these days there are modern switches that can do such filtering but it is generally accepted that the devices sitting on the same network don't typically need filtering for traffic traveling within the network if you had devices that needed different types of connectivity you'd want to place them in different networks the network boundary is what is meant to be the logical separation of devices the way routers work is that they learn which networks that they are attached to meaning this router is going to learn that on this interface it's connected to the 172 16.
20 network and on this interface it's connected to the 172 1630 network and out here is the direction to go to the internet the knowledge of each of these different networks is known as a route and all these routes are stored in what the router calls a routing table a routing table is therefore all the networks that a router knows about and the router is going to use this routing table in order to funnel traffic out the appropriate interface now when we say a router learns which networks they are attached to what we mean is that a router has an ip address in every network that they're attached to for example when this router is attached to this network it is given an ip address in that network this interface's identity is the ip address 172. 16. 20.
1 and this interface's identity is the ip address 172 16. 30. 254 this ip address is going to serve as what's known as a gateway a gateway is a host's way out of their local network for example this host over here has the ip address 172 16.
20. 33 but if that host wants to speak to something on a different network it knows it's going to have to go through a router and the ip address for that router is stored as that host's default gateway notice this host has a default gateway of 172. 16.
20.