Hello, my name is Jeff Messier. I'm a professor in electrical and computer engineering in the Schulich School of Engineering, and this is module 19 in my computer networks lecture series, where I talk about how to create a routing table on a Linux computer. Now, so in the previous modules, we've talked about the general concept of a... a routing table. We've talked about IP addresses, how they work, how they have a hierarchy, where we have a network ID with a variable number of bits, followed by a host ID.
And we did do a simple example where we had a diagram and we showed how routing is performed just based on the network ID of the IP addresses. However, I want to get a little bit more specific. In part because part of this, you know, when I'm teaching this class for credit, one of the projects is to actually configure some Linux machines or virtual machines within a simulator to route packets across a simple multi-hop network.
But also I do think that it's important to just kind of tie all of these concepts together with a specific example. And so something I should say is that, you know, in this module, we are going to create Linux machine routing tables by hand. Normally this isn't done.
Most big routers on the internet self-populate their routing tables using something called routing algorithms that I'm going to talk about later on in this lecture series. But we're going to start by creating these routing tables by hand, partly because it's a good learning exercise, but also partly because it is useful. if you are administering just a small network to be able to just kind of quickly put together a routing table. Now, a Linux IP routing table must contain a few pieces of information.
So we have to know our own IP address. Our own IP address. We need to know the addresses of the machines directly connected to us.
which would basically be the machines that shared our same network ID and Then we must also have a default Next-hop router address. So our table must contain kind of a default Action that we always do if we receive a packet and we don't recognize the address so if we you know, if a packet comes to us and It has some IP address that we've never ever seen before, we just have a default direction where we send all of the packets that we that we don't use. And as we're going to see when we work through this example, it makes sort of constructing our routing tables a lot a lot simpler.
Tables then also have a number of additional entries depending on kind of our network design and we're going to do an example. in a second that will show you how we create those entries. And in our actual Linux routing tables we're going to have basically four columns if you like.
The first one is the destination column and this is the column that contains the IP address that's compared with the packet address. So when our computer receives a packet we take the packet we look at the network ID on that packet and then we check the routing table to see what we're supposed to do with that packet. So the network IDs that we're sort of checking in our routing table are contained in the destination column.
Next hop, the next hop field is the address where the packet should be sent if we get a match. So this is, you know, we take our packet Address, we sort of look through our routing table. If we get a match in the destination field, the next hop column tells us where we should send that packet.
And you'll see how this works when we get into our example. We have a series of flags. And these are kind of operating system type flags.
The H flag indicates whether this is the host's IP address. And the G flag indicates whether the address corresponds to a network gateway. There are a few other flags as well, but H and G are the ones that we're going to see the most.
And then finally, the final field is the network interface that we use to send the packet out on. So the link that we actually use to send the packet. And we've already sort of introduced this concept in our previous examples. We look for the packet's address in the routing table.
Once we find a match, then we're told what network interface we need to use to send that packet. And so what I want to do now is I want to sort of expand the screen a little bit, and I want to go through a detailed example where we have a map of a network, and we create the routing table for each of the machines in that network kind of step by step. And then if you're taking this course for credit, this is a really important example because you're then going to perform this exact same exercise on creating an actual network within our virtual machine simulation. One thing though that I should note is, and this is just by way of a bit of notation on our diagram, so up until now when we've drawn Ethernet LANs, we've always, you know, put a switch in the middle, right?
So we have a switch. And then we have, you know, computer number one connected to the switch, computer number two connected, and then computer number three connected. So another notation that we can use to represent a LAN is to not draw the switch, but instead draw kind of a thick line or bar, and then have each computer connected to this bar.
It's just another way to draw a LAN and when you see this kind of notation you should understand that this bar is basically meant to represent an ethernet switch that is connecting all of these computers together. But sometimes we just use this bar notation just because it's a little bit easier to draw and that's the notation I'm going to be using on the diagram in the next slide. Okay so here's the the network diagram that we're going to be designing.
routing tables for and just a little bit of just a few notes about this diagram first of all where did this diagram come from well i generated it arbitrarily just to be an interesting example but you know if you were working administering a network for an enterprise organization this network would really be kind of determined by the physical realities of where you were operating. So as I mentioned, each one of these bars represents a LAN. So this computer R2, H21, H30, these are actually all connected to an Ethernet switch, but we just use this bar notation because it's a little bit simpler. And typically we would have a LAN associated with a physical area of a building, like a floor or a lab, a computer lab or a design lab in a company or something like that.
And so this map would just represent kind of how we chose to connect the networks based on, again, our physical... physically where the computers were. We have a Variety of different computers.
The computers that start with H. H basically stands for host. And these computers you can think of just as regular old workstations.
You know, maybe this is a software development company and these are developer computers. The computers that start with R are router computers. This computer S. we can think of as a server and then finally this computer g we can think as as kind of the overall gateway to the internet so if you like you know The internet exists out here.
And in this example, we're going to be specifying, our routing table is going to be specifying physical Ethernet interfaces. And we're going to use the Linux notation ETH0. ETH1, ETH2 to represent the different Ethernet interfaces. These host computers basically have one connection to their LANs and by default convention the first Ethernet connection is always ETH0, at least it will be for our examples.
And so these computers with a single LAN connection have only a single Ethernet interface. However, you'll notice that some computers have two connections, right? So R2 has two connections to two different LANs, and this means this computer has two different Ethernet interfaces. So I forget which is which in the example you'll...
see in a second, but maybe this connection corresponds to ETH0 and maybe this connection corresponds to ETH1. This computer has three connections, so it would actually have three Ethernet interfaces, ETH0, 1, and 2, and so on. These subnets, so each...
Subnet has a network ID that I represent using CIDR notation. So this particular subnet has a network ID And the first 25 bits are used for the network ID. And what else do we have here? I'm making a bit of a mess.
There are a few cases where I do specify the IP addresses of particular machines. So having this IP address here means that host H30 has IP address 150.100.15. 11. If a computer has two Ethernet connections, each Ethernet connection has its own IP address. So R2 has, you know, this Ethernet connection corresponds to IP address 150.100.12.2. This Ethernet connection corresponds to IP address 150.100.15.1.
So if a computer is connected to different subnets with different network IDs, those two connections have distinct IP addresses. R1 would have each of its three Ethernet interfaces would again be assigned its own IP address. So this connection has address 150.100.12.129. This one has IP address 150.100.12.1. This connection And you'll see this kind of progress as we go through the example.
But I think that that is that sort of set. the stage and now let's get into creating the actual table. Once you've physically connected all your computers together on different subnets, once you've assigned each subnet their network IDs, you then have to assign each computer a specific IP address. Now, generally speaking, the IP address that you give to the routers or the gateways on the network have the low IP addresses or the first IP addresses. So, for example, in this middle subnet, the net mask is And so the very first ad...
address, IP address on this subnet, the very first host ID is one, right? So the whole entire IP address with network ID and host ID combined is 150.100.12. Oops, this isn't working. 12.1.
And that's the IP address that we give to router one. Same thing down here. Router 2 on this subnet is given the IP address 150.100.15.1, which is the first or lowest IP address on this particular subnet.
Router 1 up here is given 150.100.12.129, which is actually the first IP address on this. particular subnet because the network ID is 150.100.12.128, right? So you've got seven zero bits following this 128 if you express this in binary.
And so if you have the number one as your host ID, that number one gets added to the 128 and then you get the number 129. So if that's If that's a little bit confusing or strange, it's useful to using your calculator or a web tool to translate these IP addresses into binary form also. see how that works. See that 128 has seven zero bits at the end of it available for the host ID and see that.129 uses those seven seven bits and then adds one or places the number one in those seven bits for the router one address.
And then after you've assigned that, the other IP addresses are basically under the control of the designer and you can sort of arbitrarily choose them. So on this subnet, the gateway has IP address the server I've chosen address 0.2 and router one is is 0.3, right? So there's nothing magical about these IP addresses. You can assign them basically however you want.
Okay, now with that kind of preamble out of the way, let's design our routing tables. And a good way to kind of make friends with routing tables is to create an imaginary packet and trace the flow of that imaginary packet through our network. And so what I'm gonna do is, I've got three imaginary packets down here at the bottom. I'm going to use my first one. This particular packet is addressed to machine H30.
Okay, so let's imagine that this packet is generated over the internet and it's coming in from the internet. Here it comes and the first machine it connects to is this gateway machine G. So this gateway machine G is connected to the internet. Now in this diagram I I don't show that connection, but we would have, you know, another connection coming out here and oops, this connection would be to the internet. Okay, so the packet arrives from the internet and then it arrives at machine G.
And so how do we design the routing tables? Because the routing tables are all blank right now. How do we design the routing tables that will take this packet? through the network to host 30. What you do is just what I did just now with the packet.
In your diagram, literally trace a line along the packet. that you want the packet to flow. That's basically the first step, right?
So I'm gonna draw a line. We're starting out at host machine G, and I want the packet to go through router one, go down here through router two, along this network and arrive at host 30. Now, you should do this for your assignment, tracing through the diagram that I've given you in the assignment. You should also do this for your project.
For your project, definitely do the project IP routing tables on paper first before you start trying to program in the routing tables on the computers. Because you'll get sort of caught up in the syntax and typing all this stuff in and bringing the machines up and down and the simulator is kind of slow. And it's really easy.
really easy to lose sight of what these routing tables are supposed to be doing. Okay, so we can now see the path. We've drawn this blue line from G to host 30. The next thing to remember is that routing tables only ever give the next hop for the packet. A routing table will never ever contain the complete path that the routing table or that the packet needs to follow. So what that means is our job is simpler for the routing table entry for machine G.
All we need to do is tell machine G how to get this packet to router one. That's all G, whoops. I moved the internet, I didn't move the packet. Moving the packet. All we need to do is tell G how to get this packet to router 1. That's all G has to worry about.
After that, the packet is router 1's problem. And so this packet is destined for the lower subnet, which has a net mask of 150.100. or sorry, a network ID of And over here in the G routing table, that's the entry, okay? And so let's now sort of talk about the routing table to try and explain what all these fields are because I think that there's some confusion about...
what each of these fields mean. So let's start with the easier ones first. Okay, so let's start with interface. Interface describes the ethernet card that is connected to our subnet.
And so down here, I'm gonna take eth0, and I'm gonna call the connection from g to the subnet eth0. Move it there maybe. And so, That means any transmission that goes out over this subnet has to go over ETH0.
So any packet that you want to flow from G to router 1 or the server or any other computer connected to the subnet has to have ETH0 in its routing table entry. The next thing are the flags. So the flag U just means the interface is up.
All of these entries will always have the flag U because they're all up or they're all active. The next flag G is referred to or refers to gateway and gateway basically just means that this particular hop in the routing table is not the final destination of the packet. It's a gateway to another part of the network or the rest of the of the packets journey, right?
The gateway field, and the reason why I use destination, gateway, and genmask is because this is the language used by the IP routing table software in Linux. They're not, these words aren't the most descriptive if you're learning this stuff for the first time. Gateway, you can basically think of as the next hop, right?
So if you're learning this stuff and you're not really very confident about... What's going on in your routing table? Cross out the word gateway and replace it with next hop I'm not gonna do that In this particular one though, because no no, I'm totally gonna do that.
Watch this Next hop I'll make the font bigger I'll make the background white. Whoops, I didn't want to do that. Oh no. There we go. Next hop.
Right, so... Next hop. Next hop, next hop, next hop. And I did, in fact, show you something I wasn't going to show you just yet. So I'm going to cover that back up again.
Okay, so... The genmask, which is the netmask, and the destination work together. So when a packet arrives at a machine, the first thing is it wants to figure out if the network ID in the packet matches any of the entries in the routing table. If you want to figure out if the IP address of a packet matches an entry in the routing table, you need to have two pieces of information.
You need to know what the network ID is, and you need to know how many bits are in the network ID. And so the format used by the Linux routing tables is to give the NetMax... in this Basically, when you convert this into binary, you'll see that this means the first 24 bits of the net mask are set to one, which means the first 24 bits of our IP address correspond to the network ID.
Here, this is the net mask. both in decimal and in binary form. So corresponds to a byte that's equal to all ones, that's the first 255, all ones, that's the second 255, all ones, that's the third 255, and then zero is just eight zero bits. So this is what the net mask looks like in binary form. Don't worry about this other stuff yet, we'll talk about it.
in due time. So what a machine will do is to test whether or not this particular entry in the routing table matches our packet. What we do is we take the IP address of the packet, we do a bitwise and with the the net mask or the gen mask and then we see if it matches the host or sorry the network id in the destination field right and so let's do that so the ip address of our packet is 150.100.15.11 so um 150.100.15.11 when you express it in binary form is just equal to this so what's going to happen when this packet arrives at g g is going to take this binary ip address and do a bitwise AND with the netmask The number that comes out of that AND is going to be the network ID for this particular netmask.
And so let's do that. So let's take our IP address, we'll just move it down here, let's take our netmask, move it down here, and if we do a bitwise AND with this thing, we're going to zero out obviously this part of the IP address, but everything else is going to pass through. And so the result is going to be equal to that. Or in other words, if we wanted to express this in binary, it's going to be equal to Okay, so this is the number that we get from our bitwise and, and it turns out that it does match the destination field in our routing table. What that means is that the machine G knows that we've got a match, and so it should take this packet and forward it along.
to the next hop address, which is that corresponds to router one. So it's gonna move along to router one and that's it. That's G's job, it's completely done, okay? So now this packet, even though it's kind of hard to, no, we'll just put it right there. So now the packet resides at router one, okay?
So, Now our job is to make an entry in Router1's routing table to forward the packet along the next hop on its journey, which is from Router1 to Router2. That's all Router1 has to do. It just has to get it on its next hop along its journey. And so the entry for that in Router1's routing table...
Is this entry right here? So now at this point, we have to identify which network interfaces are which for router one. So I'm going to call this network interface ETH0.
I'm going to call this top one ETH1. And I'm going to call this bottom one ETH2. So obviously, if the packet wants to flow from router one to router two, it's got to go over ETH2, which is why we see ETH2 here. The interface is up. It's a gateway.
This is not the final destination for the packet. And so here we have the same netmask that we did down here for G. And we have the same network ID.
And so exactly the same thing happens when the packet arrives at router 1. The first thing router1 is going to do is it's going to bitwise and the IP address of that packet with this particular netmask. It's going to get a match. It's going to be and the computer is going to say great. Now we need to go on to our next hop. The next hop is the IP address of router2 and so we move down to router2.
And that's it. That's all Router 1 has to do. It doesn't have to do anything else.
Now it's Router 2's job to deliver the packet. So Router 2, as it turns out, is connected to the same subnet or the same LAN that Host 30 is connected to. And that means that when R2 decides to deliver...
the packet to host 30 it's a local transmission a direct local transmission over a subnet that both r2 and host 30 are connected to and r2 has an entry for local transmission in its routing table and it's this one here so again same netmask same network id We are matching the address of this packet all the way through. The interface is ETH1. So we've decided to call this interface ETH1 on R2, this interface ETH0. Look at the flags.
The interface is up. It's not a gateway, however. This is the final destination for the packet. This is a local direct transmission directly to a machine now. We're not...
sending this to a router or gateway anymore. And look at the next hop address. The next hop address is That's just shorthand for saying this is a direct transmission to a machine on the subnet that I am connected to. And so the packet then travels directly to host 30, and we're done.
So now, boom. Now let's do another example where host 30 wants to send a packet with this address out to, let's say this is the web server address for the University of Calgary. So this machine H30 wants to send a packet to the web server at the University of Calgary.
Maybe it wants to access the website and download a web page or something like that. So first of all, there was a question asked on the discussion groups. How do the machines know what addresses to use? So how did the machine on the Internet know to use address 150.100.15.11?
And how does host 30 know how to or know the address 136.159.12.14? This is where the DNS... system comes in that we talked about this week in class.
So DNS basically maps www.ucalgary.ca to an IP address, right? So basically what happened was someone on host 30 typed in www.ucalgary.ca into the web browser. That address was sent over the network to a DNS server that converted www.ucalgary.ca into this ip address sent the ip address back to host 30 and told host 30 okay this is the address to use to connect to the university of calgary web server and so host 30 creates a packet puts in um 136.159.12.14 and then sends it out towards the the internet. So again what you want to do is you want to trace a path through the network from your source to your desired destination. In this case the path is going to be the same it's going to follow this blue line back up to the gateway and the gateway is going to send it out over the internet.
And so we're going to follow this path to We're going to follow this path through, you know, step by step again, and we're going to see the routing table entries that correspond to each step along the way. Remember, routing table entries only indicate the next hop along the path, right? So we're going to use exactly the same technique that we used before.
Okay, so let's look at the routing table for host 30, and let's uncover both of the entries. host 30. So the first entry you'll notice looks exactly like the entry that we have and we uncovered in the R2 table. This first entry is the local transmission entry. So in all routing tables you are always going to have an entry for local transmission. If a computer can send a packet directly to another machine connected to the same subnet, that it's connected to, then it's absolutely going to do that.
And so this is what this first entry in the routing table does. So for example, let's say host 21 had the IP address 150.100.15.20. If host 30 created a packet with IP address 150.100.15.20, and let me just make it clear here.
and the IP address of host machine 21 is 150.100.15.20, then what's gonna happen is host machine 30 is going to generate this packet. And the first thing it does is actually it checks its own routing table. And so it looks at its first entry and says, great, I've got a net mask that's 24 bits long.
I'm going to do a bitwise and with my packet. And if it matches this network ID, then I'm going to send it local direct transmission. That's what means.
And if it did a bitwise and with this particular packet, it would get a net mask of It may. matches, and so the packet goes directly to host machine 21 using this first entry in the H30 routing table. Now, let's go back to our original example where we have 136.159.12.14. So H30 is going to do a bitwise, and with this netmask, it's going to see if the network ID then matches Let's see. Let's see what that looks like.
So let's go back to our working screen here. So packet number three has an IP address of 136.159.12.14. In binary form, it looks like this.
And so what host machine 30 is going to do first, when it checks this top routing table, it's going to do a bitwise and with this netmask, which corresponds to this. The result of this bitwise and. is going to have all zeros in the final byte. And this is going to be equal to then Okay, so that's the network ID that we would get when we do this bitwise and.
So it's going to take this number, compare it to this number over here. doesn't match so obviously this packet is not destined for the subnet that h30 is connected to what do we do then then we go to the default entry okay so the default entry is always a gateway right because it's typically not the final destination for the packet so we've got the flags u and g here the destination IP address of all zeros and the gen mask of all zeros basically tells the routing table to match this matches any IP address that has failed to match any of the other entries in the in the routing table and that's important to remember so the this default entry is the last resort for the computer It uses this when it has no other possible solution. It will always try all of the other entries in the routing table first. So as we just discussed, it's going to try and match this entry first with the 136 packet. Didn't get a match.
And so now it has to resort to its default. And its default is basically to send all packets on an XTOP of 150.100.15.1. And so what happens then is this packet... goes up to router 2. Okay so now router 2, let's kind of unmask the rest of what we see on router 2. Router 2 has two sort of local transmission entries, and this is always something you have in routing tables.
You have one local transmission entry for every subnet that you're connected to, right? So Ethernet0 is connected to the subnet with... the 25-bit network ID, right?
So that's the net mask is 255.255.255.128. If we look at that net mask in binary form, that means we have 25 bits that are equal to 1 and only 7 bits that are equal to 0. And this is the network ID. All right, so what happens is when... This packet, the 136 packet, arrives to R2.
It's going to try its local transmission entries in the routing table first. Okay? So the first one it's going to try is this one, which would basically reflect the packet back onto the subnet it came from, but it tries it anyway. And so we take the 136 IP address, we do a bitwise and with the 24-bit netmask. That's basically exactly what we did down here.
We get the number 136.159.12. R2 checks to see if it matches its destination field. It does not. And so this routing table entry did not work. Let's try this one.
Let's try the top one. 255.255.128 So in this case, we take our 25-bit netmask We do a bitwise AND with our 136 packet. The answer is the same, right?
We have this extra one bit, but that matches up with a zero bit in our IP address. And so it turns out that the network ID answer is the same for the 25-bit netmask. It obviously doesn't match either, and so R2 has to resort to its default network entry as a last resort.
Its default network entry is to send all packets it doesn't know what to do with to R1. R1 has an IP address of 150.100.12.1 on this subnet, and so the packet travels up to R1. Okay, so now to uncover all of the routing table entries in R1, we see that we have three local transmission entries. one for each of the subnets that R1 is connected to. Okay, and so R1 is going to try and match the 136 packet with every single one of these local transmission entries before it resorts to using its default entry.
which is the, whoops, this bottom one. So it's going to do a bitwise and with this netmask, see if the network ID matches this number, which it won't because it's a 136 IP address. It'll do a bitwise and with this netmask, see if it matches this network ID, which it won't. So it's going to do a bitwise and with this netmask to see if it matches this network ID, which it doesn't.
Um... Then it's going to do, it's going to check this entry too. It's going to do a bitwise end with this net mask to see if it matches this entry.
And it doesn't. And so once R1 has exhausted all the other entries in its routing table, it resorts to its... this last entry, which is its default, which is to send the packet to which is the gateway. Okay. The gateway then, let's assume for a second that these top three entries, um, well, actually, let's see if we can get the packet to uncover this top entry and uncover this bottom entry okay so let's assume for a second that the second and third entry in this in this g table don't exist they don't actually come into it it's not going to match the 136 either so the So the G, the gateway computer, is going to try all the entries in its routing table first.
So it's going to do a bitwise and with this netmask, see with the IP address. in the packet, see if it matches this network ID, which it won't. Then it's going to bitwise and the IP address in the packet with this netmask, see if it matches this one, and it doesn't.
And then finally it uses its default entry as well. I don't have an IP address here because this is this internet thing that I've drawn, so I didn't bother putting the IP address of the gateway out here on the internet. for the G computer.
But this bottom entry is what would be used. And so the packet then travels out over the internet. A few more things now to clean up.
I'm just going to move my packet down here. What about this server? Well, actually, no. Before we do the server, let's uncover the second entry in the routing table.
Whoops, for G. This entry corresponds to a packet that comes in on G, goes through R1, and then wants to come up to a computer on this subnet. So again, whoa, weird. Okay, anyway, it tried to...
Yeah, let's do that instead. So the packet travels from G up to R1 and it wants to reach one of these computers. Okay, remember, routing tables only ever tell... the next hop along the path. So if a computer wants to reach this subnet and this subnet is identified by 150.100.12.128 network ID, then all G has to do is send it to R1.
This is the netmask for the top subnet. It's 25 bits. This is the network ID for that top subnet. This is the next hop for that packet to reach the top subnet when it's leaving G.
There was a question on the discussion board about how do we know to create these entries in these routing tables? Basically by drawing these little lines on your diagram, right? This computer wants to reach one of these computers. Or... You know, draw another line where, let's say, this computer wants to talk with one of these computers, or draw another line where this computer wants to talk with one of the computers down here.
Every time you draw a line, you should be able to trace through your routing tables, and there should be a next hop described in each one of the routing tables along the path that you've drawn on your diagram. If there isn't, then you need to add one. Okay, and so let's say a packet arrives at G, wants to travel through R1 to, let's say, host machine 20, then that would correspond to this last entry to uncover in the routing table for G.
So any packet that arrives at G that wants to travel to this middle subnet, That middle subnet has a 25-bit netmask. It has a network ID of The next hop as far as G is concerned is router 1, and so router 1's IP address is in there. This is all being transmitted over ETH0, and these are all gateways because they are not the final destination for that.
for the packet. And so finally we have this server computer, this mysterious S computer. So S wants to be able to communicate with not only the internet but any other computer on this sub network. So let's say it's the server, it's maybe a file server or something like that. So it needs to be able to communicate with host machine 11. It also needs to be able to communicate with, you know, host machine 30. I don't know why it keeps making my lines straight like that.
And so packets from S have to be able to reach any of these computers and the same with the other way around. The routing table for S in the notes is complicated. The routing table for S in this example is simple. S has the same routing table as basically any other host. It has an entry for local transmission.
It's the bottom entry in this case. Sorry, I didn't get the order really right on this. So this is the entry for local transmission. Any computer on the subnet that S is connected to will be transmitted to directly with this entry. Any other packet is sent to the gateway computer G.
Does this allow S to communicate with host machine? 30 for example. So host machine 30 has the IP address 150.100.15.11. Oops.
And so let's say server S generates a packet with this particular address. It's going to try the local transmission entry first. It's going to do a bitwise and between this 24-bit netmask and the IP address in the packet. The result is going to be the network ID.
It's going to see if it matches It doesn't because it's going to be equal to 150.100. and so S has to resort to its default entry so it sends it to the gateway. Yikes! So we've sent it in the opposite direction it was supposed to go.
What happens now? Well, the gateway is going to try every single one of its routing table entries using its default entries of the last resort. So it's going to do a bitwise and...
with this 24-bit netmask and the IP address in the packet. It'll get a network ID, and it'll see if it matches this network ID. It won't because it's.15, and so it can't use local transmission.
It'll then do bitwise AND with this netmask to see if the result matches 150.100.12.128. It won't. It's going to be 150.100.15.
Same thing here, it'll do a bitwise and, it's not gonna get a match over here, it's gonna do a bitwise and here, and yeah, it gets a match, right? And it's gonna send the packet to router one. And now we're back to... whoops, I did that, moved my internet again. Now we're back to following the same path we did before.
Router1 is then going to send it to Router2. Router2 is then going to transmit it directly to Host30. And so hopefully this has filled in some gaps for you guys. This is a very slow, methodical example. Hopefully that helps.
But it's not the only one I could have done. with this diagram. I mean, I could have done any machine communicating with any other machine at all.
And basically, each example, however, would have been the same. I would have drawn a line from one computer and then said, OK, let's build the routing tables. The routing tables only have to take care of the next hop.
Let's just put a next hop entry in the routing table, move to the next machine, put a next hop entry in that table, keep moving until you hit. a point where you can do a local direct transmission and then your your route is done