 So, we've talked about some of the issues of routing of, okay, that we have a network, we need to find a path or a route through that network. And that routing protocols, we looked at some of the trade-offs. For example, going back, we discussed some of these issues of the metrics or the performance criteria, how to choose the best path, who chooses and when. And some of the trade-offs of the more information that you have about the network. And the more often that information is updated, the more chance you choose the best path. And we looked at some cases where we can have no information versus having information about the entire network. And we can update on a continuous or periodic basis or only when major changes happen. And that trade-offs we need to make when we select a routing protocol. How much information to collect and how often to update. Let's look at routing tables. And to do so, we'll use this example. This is a slightly different one that we displayed last week as an example network. But you may want to write it down if you haven't done it from last week. And in this network, the link costs written next to the links are the same in both directions. So to send from five to three, the cost is five. And to send from three to five, the cost is also five. It doesn't have to be, but in this case, the link costs are the same in both directions. Find the least cost paths from node one to every other node. Okay, just write quickly the notes of from node one to node two. What's the least cost path? What is the path and what is the cost? And then do it from node one to node three, node one. And I think you'll get them in a minute or two. Node one to every other node, least cost paths. Node one to node two, what is it? What is the path first? You're correct, and the cost is one, two. That's easy, isn't it? So from node one to reach node two, the path is one, two. And the cost is three. One, three, from one to three, it's not as obvious, of course, in this case, because three is not our direct neighbor. Two was the direct neighbor of one. And it was easier to see that this way is three. This way is two plus five. We will never get less than seven if we go by this direction. But three, one, two, four, three, has a cost of six. I think that's the least cost path. Let's just write down, and you can have a look for the other remaining nodes, the destinations. We'll list those least cost paths. So the source is node one. Destination, let's say, I'll write it as a table. Node one to node two, the path is one to two. And the cost I'll just write in brackets here is three. So from node one to reach destination two, the path is one to two. The cost is three. And we'll do it for the rest. Node one to three is one, two, four, three, cost of six. Node four, where do we go? One, two, four, three, one, two, four, we're there already. One, two, four. And that's an easy one. Remember last week we tried to explain this point that if we have a path which is the least cost path, one, two, four, three, then the subpaths are also least cost paths. So if we know one, two, four, three, then it must be true that a path from one to four is one, two, four. That's also a least cost path. If it wasn't, then this one would not be a least cost path. But we can see it easy in the network in this case. One, two, four has a cost of, what is it, five? And the remaining ones. One to five, we go direct. Six and seven. One to node six. Two, four, three, six is the least cost path. And to seven. Least cost path. Right, to get from node one to node seven, it will be one, two, four, three, six, seven. Is that right? Someone can find a lower cost path. Of course, we would have an algorithm, a computer, to calculate this forest, especially with larger networks. But I think you can see it quite easily in this case. So let's make node a last two. And can someone tell me the costs? 10 and 12 are calculated before. So these are from node one. If node one has data to send to any other node in the network, we can find the least cost paths. Any questions about how to do that? OK, that's the easy part. Now, every other node does the same thing. So we could do it from, say, node four to every other node. And node seven to every other node. Find the least cost path for every node. Think of every source node to every possible destination. Once we can calculate them, then that's our routing information, and we use that to send data. So if node one wants to send data to node seven, it uses this path. It says, OK, I have a data packet to send to destination seven. My path tells me to send to node two and send to node two. And then node two will receive a packet. Source is node one. Destination node seven. It would use its information as well. For node two to reach node seven, it would look at the path and forward that packet to the next node. So routing, we often think about, is the process of finding this information, finding the paths. And the other process of sending data across those paths we often call forwarding. Node one has a packet to send to seven. It sends it to two. Node two forwards it to node four. Node four forwards it to node three to six, and then to seven. So we distinguish those two tasks of routing, finding the path, and forwarding, sending the data along the path. Just for another example, I'll quickly do it. Maybe you can look. Node four, I'll write it down in a moment. Node four to node one, least cost path. Node four to node one, four to one. Four to two will be four to two. That's the easy one. Four to three, that one's obvious, four direct to three. Four to five, least cost path, four, three, five. As a cost of six, if we go the other way, we get a cost of seven. So four, three, five, four to six, four, three, six. A cost of five, four to seven, four, three, six, seven. So we can do it easy for node four. I'll just write them down and we'll look at them in a moment. And we can do it for all the other nodes as well, but we won't. These are just the costs of those paths. So we do it actually for all the nodes in the network. And it's the role of normally a routing protocol would do that for us. It could be done manually. For example, you go and build this network across Bangkok. You deploy these seven nodes across the city with the links between them. You know the costs. You could easily calculate the least cost paths when you build the network and program it into those nodes to use those paths. So a manual approach would be to select or to calculate the least cost paths at the start and then program or tell those nodes whenever you have a packet, use this particular path. Now that approach would not be so convenient if things change. We said last week, as the links change, as the nodes change, new links arrive, links fail, nodes fail, or the costs change, then the paths may change. So really what a routing protocol does is on a regular basis, distributes information between the nodes so that they can update their least cost paths. As the conditions change, they update and find the new least cost path and do that on a regular basis. Now, assuming we can calculate the least cost path, what a node does, actually, before I explain, just one further example of the subpaths. Node one to seven, the path one, two, four, three, six, seven. Node four to seven, four, three, six, seven. You see it's a subpath of this one, which is what we'd expect. If we know that least cost path is one, two, four, three, six, seven, then it must be true that from four to seven, a least cost path is four, three, six, seven. So that holds in this case, as it always will. So let's just say every node can calculate its least cost path. They store them on the nodes. So the node is just a computer. It stores this path information. When we have a packet to send, we look at the destination address. If the destination is node five, node four has a packet to send to destination five, then it looks here, okay, to reach five, I send to the next node three, and would send that packet to node three. Node three will get the packet and do the same thing and send it eventually to node five. An important point, which really simplifies this storage of this information, is that from each node's perspective, once we know the least cost path, we only need to store the next node in the path. Node four only needs to know, to reach destination one, the next node is two. Once it's calculated the least cost paths, the thing that we store in these nodes is just the next node in that path. If node four wants to reach node seven, then the next node in the path is three. And similar, node three would have an entry. If node three wants to reach node seven, the next node in the path will be which node? Node three has an entry that says to reach node seven, the next node is six. Because we know that the path, the least cost path from three to seven must be three, six, seven. So each node only needs to store the next node. We don't have to store the entire path. And that's very useful in large networks. I mean, A have long paths and many entries and we need to update on a regular basis. Storing just the next node makes things much simpler. So I'll just write down a table that stores that information in summary form and then we'll give it a name. From node one's perspective, we keep track of two things, the destination and the next node. Destinations two, three, four, five, six and seven. And if you look at the least cost paths, to reach destination two, the next node is two. To reach three, the next node is also two. To reach four, it's two. To five, the next node is five. To reach six, two and seven is also two. So the blue information is the actual least cost paths. But once we calculate them, once the node knows them, it only stores this information. Think of it as a table that contains two columns. Destination, that's this, who we want to reach and the next node in the least cost path to reach that destination. We can store other information, we could optionally store the cost of the path. We do in practice sometimes, but at minimum we need the destination of the next node and this is called a routing table. And it's common in the internet, a routing table stores this information. And very important in the operation of the internet. And for node four you'll see similar, we can have a routing table. This is for node four in our example. Next nodes are two, two, three, three, three, three. And because each node calculates least cost paths, we can store just the next node because we know that that next node will have the least cost path to the destination. So even though four stores the path, to reach seven, I send a three. I don't care how three gets it to seven as long as they use the least cost path. So what node four does is sends the data to three and then three takes on the role. Okay, I have data to seven. I need to send to the next node which would be six from node three's perspective. Six will receive the packet, so each destination will know to send a node seven. So it greatly simplifies the storage and the maintenance of this routing information. And a routing table contains the destination and the next node in the path to reach that destination. Any questions on routing tables so far? If you try the quiz, you'll see there's one question that asks similar to what we just did. Here's a network find the routing table for a particular node. It's quite easy to find. You find the least cost paths and the next node in those paths. Back to our lecture notes. This was our other example network in the lecture notes where we had six nodes. If you find all the least cost paths there and then find the routing tables, this is what you end up with. So if you find the least cost paths, so this is for a different example but the answers are given for you already and I will not calculate them all you can check but from node one to two, three, four, five and six, if you check the least cost path from one to two, the next node will be node two. From one to three, the next node is four. One to four, the next node is four, one to five, four and one to six, four. So that's the routing table for node one to reach any other node in that other example network. And similar it's completed for the other nodes. From node six to reach any of the other five nodes, it will always send to node five. It just turns out in this example, node five is always the node along the least cost path. So this table of destination next node can be stored on each node separately or if you jump back one slide, we could combine it and have a special server store all that information. So in a centralized form. And this is the exact same data but just represented in one combined table. From node one to reach two, three, four, five and six, the next nodes are two, four, four, four, four. This column is the same as the first table for node one. Two, four, four, four, four. Just check that the second columns in all of those six tables create the six columns in this one combined table. Just a different way to store it. This approach is used if we have a central server that keeps track of the routes and tells everyone which routes to take. Whereas the one table per node is used when we have a distributed approach where each node does their routing separately. This approach is much more common in larger networks, e.g. the internet uses this approach. And that's what we usually focus on in examples. Any questions on routing tables before we talk about fixed and adaptive routing? Everyone can create a routing table now. Easy, one of the simpler concepts but one of the most important concepts in the internet operation. Of course, it turns out in the internet and we'll cover that in our last topic this semester that both your computer and nodes in the network have their own routing table. So my laptop has a routing table. And to view the routing table, I'll just type route. And it takes a couple of seconds to find the routing table. It's a bit strange, why does it not come up so well? You see now, okay? So this is the routing table of my computer and it's very, very simple in that there are only two rows in the table. There are what, seven or eight columns here. Focus on the first two. Destination and gateway. Destination is who I want to reach. The gateway is the next node. It's just a different name that's been historically used in the internet. So really, the other information is just supporting information. This says destination and this means next node. There are two rows and some of the information will recognize as an IP address. I think some of you will know that this is an IP address. So instead of using numbers or letters to identify nodes, like node one, node two, in the internet we use IP addresses. But we'll see that in the last topic. We'll see IP addresses and this routing table again. But just one example of a routing table. We can simplify routing tables. And this is an example where, actually, we'll come back to our case. Then it may make more sense. Look at the routing table for node one. Let's say in the internet when you have thousands of nodes, tens of thousands of nodes, then using this approach, you need one row for every destination. How could you simplify the routing table for node one? What's common about it? Is there some pattern or something repeating in the routing table? What is it? In many cases, the next node is two. Okay, it's either two or five. For one case, it's five. And for the rest, it's two. We could write that in some simpler form. I'll just move down. For node one, we could say that the destination, next node. If the destination is node five, send, just check. If the destination is node five, send to node five. That's one row. If the destination is anyone else, send to node two. And one way we can often write anyone else is a star, like a wild card, meaning any value. So this routing table is just a simplified version of the one we come up with. Just check. To reach node five, send to node five. To reach two, three, four, six or seven, we'd send to node two. So instead of writing all of those rows, just write it in two rows. Using some special character or special way to indicate, this means any other destination. And a simple way to think of routing tables is we can process them row by row. Node one has a packet. Destination is five. So the destination address of the packet is node five. We look, okay, does that match the destination in our table? Yes, it matches this first row. Therefore, let's send this packet to node five. If we have another packet and the destination is node six, then we look in the table. Does destination six match the first row destination? No. Move on to the second row. Does destination six match star? Where we think of star as meaning any value. Then yes, it is any value. Therefore, we send this packet to node two. That's the way we can interpret our simple routing tables. Read them row by row, where star is any value. That's the concept at least. Now, we only have two rows to capture all of the possible destinations. Much simpler to store and also keep up to date. Similar concepts are used in the internet, but it's not necessarily process row by row. There's some other pattern matching that's used. This route, so this second row, is often called the default route. That is to reach five, send to five. By default, everything else goes to node two. So often called a default route. And it's in fact, in my computer, the first row in that example. It says for the default, by default, send to node 10, 10, 98.1. So that's the default route in the first row. The second row is slightly different. It says if you want to reach destination 10, 10, 96.0, send to star. That actually means in this specific piece of software, it means don't send to any other node. Send to them directly. That will make sense after we cover the next topic on LANs. It's specific to how the internet works, that second row. For now, we're just dealing in the concept of, we have routing tables which identify the destination and next node. We can simplify routing tables by using some form of wild card to represent multiple values. Any questions on routing tables so far? Okay, let's see what we've missed in our slides. This just explains routing tables. I think it's been said already. Maybe the last few notes here. We now will separate the process of routing from forwarding. Routing is the process for creating the routing table. So there needs to be some way to find the link costs, find who my neighbors are, find out the least cost paths, and then store that information in a routing table. That is what we'll call routing. So a routing protocol will usually do that for us. We don't have to manually do it in large networks. The result is a routing table. Forwarding is the process of using that routing table when we have data to send to determine who to send it to. So routing is finding and creating the routing table. Forwarding is once I have a packet to send to node seven, is to look in the routing table to determine who to send it to next to reach node seven. And those processes can be kept separate. And it's what happens often in the internet is that a routing protocol does the first part and just continually updates the routing table. Just updates it as it finds new paths, it updates the routing table. But independently as we're sending data, I wanna download a file or transmit a file, then all my application does to send data is read the routing table. Read the current value, determine who to send it to next. And that makes the sending very simple to keep those processes separate. A routing table may include a path cost not necessarily and it may include other information. But from the simplest point of view, it's just destination next node. Back to our original example network. Again, you have a task, you graduate what after the end of next year and you work to set up your own company to build a network across Bangkok, for example. And you're gonna provide a service. So you design the network and you design maybe to have seven different nodes in different locations with links between them. And you know the characteristics of those links, the data rates, the delays, the cost of using them. So you assign some cost to those links. So you have this information. Then what you can do is what we call fixed routing is when you design and build the network, calculate the least cost paths, either manually or using some software, create the routing tables. We created two, you'd create the other five or however many nodes there are. And then in each node, you could store the routing table inside the node. So node one stores its routing table, node four its routing table and so on. Now when the data needs to be sent, they just read the routing table to send to the next node and reach the destination. In fixed routing, that process is done and then the routing tables don't change. Or at least don't change until there's a major change in the network design. So maybe for two months, you use those routing tables and then you need to upgrade your network, you add a node eight. So then maybe you need to recalculate the least cost routes, least cost paths and update the routing tables. So fixed routing, we think we create the routing tables and use them those same values for a long period of time. And that's the slide I think we've got here. Fixed routing is that we create a permanent route from each source to each destination pair and store it in routing tables. There are different ways to calculate the least cost paths. Dykstra and others. We can think the route is fixed at least for a long period of time. It doesn't change every second. It doesn't change every day. Maybe it would change if we make a large change to the network. We add a new node. Maybe after six months we upgrade, add a new node, we recalculate. But if the cost of each link changes while we're using the network, then with fixed routing, the routes will not change. That's the problem. That is, we've found the least cost paths and then while we're using the network, maybe the cost of the link from node one to two, it was previously three, maybe it changes to 10. That is, the cost goes up because the cost may reflect, for example, the delay. And because we're sending a lot of data across that link, the delay goes up, so the cost goes up. Now, I think you recognize, if the cost of this link goes up to 10, the least cost paths should be changed. From node one to node two to node three, four, and so on, should not go via node two, should go via node five, in this case. With fixed routing, we normally don't consider this. With fixed routing, doesn't matter what the costs of the links are after we start to use them, we just use them once to calculate the fixed routes and then continue to use those routes. So it's a static approach. Not very good because as the network changes, we start to use suboptimal paths. You can find which paths would be better. If that was now 10, I think the path from one to four should now be via node five, not node two. So fixed routing is very simple. We build the network, we assign the routes and then the routing process is finished until maybe a few months later when we upgrade the network. But it's not very flexible. We build the network, we assign the routes but when the network is being used, it may turn out that those routes that we assigned are no longer optimal. But with fixed routing, it doesn't matter. It keeps using those suboptimal paths. That's the problem. Which suggests that we should update on a more regular basis. And that's, if we jump forward, we'll come back to flooding later, adaptive routing. Instead of just assigning the routes at the network design and install stage, have some automatic way that the network learns about the current costs and adapts the routes. It changes and updates the least cost paths over time. And that's what's used in most networks today, including the internet. Because things change on a regular basis. The cost change, the links change. So we need some routing protocol to update the routes for us. And that's generally called adaptive routing. And it's used in most packet switching networks today. But still, it uses routing tables and that there's now some automatic way to gather the link costs, calculate the least cost routes, populate the routing tables with data. And then when we want to send data, we just use the routing tables. That's about all we want to say about fixed and adaptive routing. The main difference is, of course, adaptive routing can adapt to changes much faster. But it's more complex. And we need some protocol to automatically calculate the least cost paths and especially collect the links, the link status information. There are many such protocols. I'm not gonna go into any more detail of those protocols. You'll see them in a course next semester on computer networks and protocol architectures. You'll see protocols mentioned like these ones, acronyms down the bottom. OSPF, BGP, IGRP, and so on. These are some examples of routing protocols which have the task of finding information about the network topology, finding the link costs who has which neighbors, calculating the least cost paths and putting that information inside the routing tables. That's what these routing protocols do. They do it in different approaches. So there are many different ones. They have different advantages and disadvantages. Some use Dijkstra, some use Bellman forward. Some collect different amounts of information. Some use different metrics. So there are different trade-offs involved there. So there are many different routing protocols. We're not gonna go into any more details about these routing protocols. So understand the concept of routing tables, how they're used and some of the things we covered last week about that we need to collect the information to learn about the network topology. There's, I think, three slides of an example which we'll not cover. So routing is rather simple. If we can find the least cost paths, we just create a routing table and then use it. Any questions on routing? The problem with routing in large networks which change a lot is that it's quite difficult to collect the information about the most recent status of the links. Back to our example. When the link status or the link cost from node one to node two change from three to 10, there need to be some way for nodes three, seven, six and four who are not direct neighbors of node one and two or four and six are, for these other nodes, there needs to be some way for them to learn that this link cost has changed because they should update their routes because to reach, say from three to one, the path is no longer three, four, two, one, the path should be three, five, one. So the challenge with routing protocols is that or adaptive routing protocols is as some links change, how do other nodes know that? And the way that it works is that these nodes exchange packets, special packets telling each other. My link has changed from three to 10, it tells everyone that. And that's, incurs a large overhead. Everything okay? Any questions? Routing protocols? The concepts are rather simple. In practice, they're rather complex because how often to update that information and what information to collect is difficult. We want to collect as much information as possible so that we can calculate the least cost paths, but we want to exchange as few packets as possible to do that, that is incur a small overhead. So that's the trade off there. One last type of routing we'll cover today and then this topic. Flooding, so skip back to approach two. We'll do flooding, why doesn't it fit? It's now, this is the network which is a simplified version, you don't have to draw it. It is in fact, this network with our six nodes but we've removed the link costs which looks like this. So on this slide, we have the six nodes and those links between them. We're going to go through the steps of what flooding is and how it works, but instead of doing it, you can draw on these slides, I'm going to draw it again. So it looks a bit different but it's exactly the same network of those six nodes and those links between them. Let's consider how we can use flooding to get data from one node to another. Remember, routing was the process of finding the route in order to get data from one node to another. Let's say in an example, node one has a packet. There's my packet. Node one has a packet of data to send. Inside that packet, there's a header. So we can talk about there's a header and there's some data, header. Inside the header, there are different pieces of information. One of them, let's say, is the source address. It's coming from node one and the destination. Let's say, for example, we want to send some data to node six. So this is the data packet node one has to send. It contains some data, whatever it is. The header includes the source address. It's from node one, destination node two, node six. Where does it send? Where does, what does node one do now to send this data? If we used adaptive routing, for example, even fixed routing, what would it do? If we were using adaptive or fixed routing, doesn't matter, what would node one do now to send this data? It would look in its routing table and find, okay, to reach destination six, the next node is whatever the routing table says. Maybe it's two, okay? So it would look in the routing table to determine where to send this data packet. Let's say it was two, it would send it to two and two would do the same. How did the routing table get created? Well, there's some process that either manually or some automatic technique to create the routing table, like we just did. Let's try a different approach. And the approach of flooding is that we send everyone, instead of sending across a specific route through the network, send a copy of this packet to everyone. And we start by node one, if it wants to send to everyone, it has that data packet and it sends to its three neighbors. Node one has three neighbors, nodes two, three and four. So send a copy, the exact same copy of the data to those three neighbors. And it's maybe drawn better on your picture on the slide, but I'll try and just draw that, okay, this is the packet. I'll not draw it again. Thinking this packet, source one, destination six is sent to node four. It's also sent to node two and sent to node three. So this will go through how flooding works and see how it compares to the other approaches. So node one has three neighbors, so send to those three neighbors. What happens next? When each neighbor receives the packet, they will do the same. So think from say, this packet is sent from node one to node two, eventually that arrives at node two. The packet gets to node two across the link. Node two looks at the packet. Source is node one. Destination is node six. Node two is not the destination, so node two knows it needs to send a copy of this packet to its neighbors. Where does node two send to? Four and three, what about node one? There's no need to send back to the person who just sent it to you, because you know they already have a copy. They just sent it to you. The idea is to get a copy of this packet to the destination. If someone just sent you a copy, it implies that they are not the destination, otherwise they wouldn't have sent you a copy. So there's no need to send back to the node that just sent to you. So node two receives a copy and makes a copy and sends one each to node four and three. It's gonna send a copy again. Source is one, destination is six, out to its neighbors, except the one that it came from. But at the same time, the copy of the packet from one to four arrives at node four, and four does the same thing. Three and five and four does not send back to node one because node one just sent us the copy. We send to three, we're gonna send to five. What about node two? We should also send to node two. Well, why is a good question? Well, let's assume that this is happening at the same time. That is, two received the packet and at the same time, a different computer, node four received the packet. Four doesn't know that two received it. All four knows is that I've received a packet, source one, destination six. It knows who its neighbors are, so the rules are to keep things simple, send to all of your neighbors, except who just sent it to you. So I think at the same time instant, four sends a start sending a copy to two across this link and similar two is sending a copy of that exact same packet to four, but they don't know each other is sending a copy. I think you can recognize that it can be a waste, but to keep things simple, in this case, they both will send a copy to each other. Three would send to its neighbors. It would send to two, four, five, and six. So I think those three steps of two sending to its neighbors, four sending to its neighbors and three sending to its neighbors all happened at the same time. Now in real networks, it may not happen like that. Maybe the packet arrived at two before four got it and two sent to four before four got the one from one, but that's more complex. Think of it just in steps. One sends to its neighbors. Its neighbors send to their neighbors and so on. What happens next? All right, we'll see node five will receive what? Okay, let's look at node five then. Of course, there's other things to occur. Five is going to receive a copy from node four and from node three. When five receives a copy from node four, what does it do? Sends to its neighbors. So think of the one that's received from node four and we'll try different approaches. The first simple approach, five receives from node four, five sends to its neighbors. Three and six, but at the same time, five receives the packet from node three and then what does it do? It sends to its neighbors. Four and six, we think it sends two copies to six. Okay, so five received two copies of the packet. Therefore, follow the rules. When you receive a packet, send to your neighbors except who sent it to you. Any questions so far? You think at the same time, five receives from three, sends to four and six, yes? Also, five receives from four and sends to three and six. Is there a better way? Should five send two copies of that same packet to six? I mean, it did in this case. It would be better if it didn't. Okay, there's only need for one copy of the packet at six. The problem is, how does node five know that the packet that came from three is the same as the packet that came from four but just a copy? So, five receives a packet. Source is one, destination is six. Then it receives another packet. Source one, destination six. Two options. One, they are the same, it's a copy. But another option is that it's two different pieces of data. Maybe node one is sending many packets to node six. Five doesn't know whether the packet received from three is in fact a copy of the packet it received from four or if it's another piece of data. How could it distinguish? How could five know? We've seen the concept before. How could five know that these two packets that receives are the same? In the header, we could include what? A sequence number. So, if node one included also a sequence number here and we may try it in a moment, but if there was a sequence number here, let's say sequence number one, then because everyone sends an exact copy, five receives a packet, sequence number one, from one to six, five receives another packet. Sequence number one from node one to node six, five knows that that second one is exactly the same as the first one and we can ignore it. So if we include sequence numbers inside the header, it can be even better than this in that if we receive a packet which we've already received before, do not send to our neighbors again. But in the example you have in the handouts and the one we're going through here, there is no sequence number. Okay, it's very, very simple. In practice, we'll usually include a sequence number. Follow through, what else happens? Five received from three and four, what else? Three receives from two and four, I think. What happens when three receives from two? What does it do? So two send a packet to three. Three receives that. Who does three send that packet to? Now, it's a slightly different scenario in your handouts. It would send it or everyone except who it received from. So three received a copy from two. Three will not send back to two but will send to one, four, five and six. But again, that's very wasteful because there's no need to send back to one because we know that we receive from one. There's no need to send to four because I've already sent to four before. The only way to know that this is not a new piece of data is using sequence numbers. So it's really beneficial to include sequence numbers in here. We'll do that in a moment. Yes, we've got a few minutes to finish. I will not draw it just to save some time. Let's look at the lecture slides. Actually, we will draw it because those lecture slides are slightly different. Two receives two sends to three. Three would send a copy to one, four, five and six. I think I will not draw any further because it will get too confusing. Four sends to three. Three will send a copy to two, one, five and six and so on. Eventually we'll have so many packets we cannot draw them here and we keep going. So we need some way to stop this case of sending so many packets, especially when we've already sent them across the link. And there are two different approaches. One is a sequence number. A sequence number allows us to know that don't send this packet again if we've already sent it. The other way is what's called a hop limit. And a hop limit limits the number of times the packet will be sent across a hop. And that's what you see in the lecture slides. We go to that and then we'll come back to sequence numbers. So this is the same example, but in this case each packet includes in the header another value called the hop limit. Remember a hop is a traversal of a link. A hop limit is we want to limit this packet to traverse no more than the hop limit number of links. So in this example the hop limit is three. This is one we just worked through. And it's shown in the picture as the number inside the packet. That's the value of the current hop limit. One sends a packet to its neighbors. That's what we did, to two, three and four. What a node does when it receives a packet is it decrements the hop limit. When node one sends it, it sends it with a value three. When two, three and four send, they send it with a value of two. Again, they send to their neighbors except the one that they receive from. And then the next nodes receive it, they send with a value of one. In this case, our node five received from node three, so sent to four and six. Five also received from node four, so sent to three and six. And the value inside the header of that packet is a hop limit of one. And you can follow through what the other nodes do as well. What happens next? Let's say node five sends a packet to node four, the hop limit is one. When node four receives it, it decrements to zero, and that tells node four, don't send any further. When the hop limit gets down to zero, it means it's, do not send it any further, you can discard that packet. So receive the packet, decrement the hop limit, if at zero, don't send any more. So five sends this packet to node four, reduces it to zero, and now discards the packet, it will not send to its neighbors. So that stops the distribution of the packet in the network. If we didn't have a hop limit, we'd keep sending and sending forever. That's without a sequence number. A hop limit of three, in our example, means the packet, no packet will traverse more than three links. If you follow the packet, a packet went from one to four, that's one hop, from four to three, that's another hop, and from three to five, once it gets there, then that's it. Similar, another packet went from one to four, one hop, four to five, two hops, and then one copy will go five to six, three hops. It will not be sent on any further. The hop limit will be zero. Of course, the other reason it will not be sent on any further, because six is the destination. When six receives a copy of the packet, it will not send to anyone else, because it is the destination. Let's bring flooding back with a hop limit and also add in a sequence number just to finish off and see what happens with a sequence number. So on the lecture slide, it's an example with no sequence number but a hop limit. Let's go back and add in that information. So in the header, hop limit and also a sequence number. So the header just contains more information. Node one sends a copy to each of its neighbors. Note that the sequence number doesn't change when the node's forwarded. The hop limit changes. So the hop limit in the copy sent from one to its neighbors is three. When four sends to its neighbors, the hop limit is now two, but the sequence number is still one. So only the hop limit changes when we send to make a copy. Two will send a copy to three and four. We did this before. Three will send a copy to its neighbors except node one. And let's just make note, the hop limits in these are three, three, three, two and four will send to its neighbors. Hop limit is also two. What happens next? Start easy. What does node five do? Node five is going to receive two packets. How many packets is it going to send and to who? It receives two packets. What does it do then? Node five. Let's say it receives the packet from node four first. What does it do? It sends to six and needs to send to its neighbors. So if I receive from node four first, so there's a difference in when I receive them, then I can send a copy to node six. The hop limit would be one. And also send to node three. If I haven't yet received it from node three, I should send to node three. Then I receive a copy from node three. What do I do now? So I've received from four, send to six and back to three. Then I receive from node three. What do I do with that packet? I don't send it to four because I know that when I receive it from three, from the sequence number, it's still sequence number one. I know that this packet from three is the same as the one I receive from four. Therefore discard it. I've already done this packet. The aim is to get one copy of the packet to the destination. So if node five has already sent copies to its neighbors, it will never send a copy of that same packet to its neighbors again because that's a waste. So if the packet from four arrived first, then we'd send a copy with a hop limit of one to our neighbors. And then if the copy from three arrived, we would not send to six because we've just sent a copy to six. We'll not send back to three because they just sent us the packet and we'll not send to four because four has previously sent us a copy. So you'll only send one copy to your neighbors. And I think if you follow the other cases as well, four receives a copy from three. Four has already sent to its neighbors. And it's already received from one. So when four receives a copy from three, it will not send it again because the sequence number tells us I've already dealt with this data. No need to send it again. And it significantly cuts down on the number of transmissions. Node six receives the packet from node three and we're done. Node six has got the data. That was our intention. Get the data from node one to node six. And it works. Turns out that node six also receives a copy from node five but it can ignore that because of the sequence number tells us it's just the same as the previous one. There are no routing tables. There's no learning of the network. It's very, very simple. If we include a hop limit and sequence numbers, send to your neighbors but no need to send back to someone who you know already has a copy. So node one sends to its neighbors. Its neighbors send to their neighbors with the exception, don't send it back to who sent it to you previously and don't send repeats of the same data. The end result, in this case the destination receives the data. So this is an alternative to routing to send to everyone. Tomorrow we'll just summarize and compare. Well, what's the problem with flooding? And I think you'll see many copies of the packet sent in the network is the problem. We'll compare and summarize tomorrow and then move on to the next topic.