 So, our challenge, given a network, find the best path from source to destination from one node to another in the network. And we define the terminology, we have links, we have paths made up of a set of links. Links are assigned costs. So the numbers in this example indicate some cost of using the link, where we want to use the path which has the least cost, where the path cost is the sum of the link costs on that path. So, we had an example, we had two paths from node one to node six, where if we want to go from node one to node six, we said if we care about the number of hops, a hop is to traverse one link, to hop across one link. The number of hops to node one to node six, the least hop path, or the least cost path, if we consider cost as the number of hops, is one, three, six. There are two hops on that path. The other hops take three or more part. The other paths take three or more hops. But if we consider the numbers on the links to be the cost that we care about, then the least cost path from n one to n six is one, four, five, six. So, we have a cost path cost of four units, whereas the other path had a cost of ten units. So, choose the path with the lowest cost. Easy. How do we do that when we have a large network? Dykstra algorithm, Bellman forward and other algorithms can calculate that for us. We don't sit there and look at it and try and find the path. There are algorithms that will do that reasonably efficiently. In this course, we can do it on small networks, but in practice, a computer would do it for us. So, given that we have a way to calculate the least cost path, then the challenges are, how do we know about the network topology? Let's say you are node one. You're the computer for node one. You want to calculate the least cost path to node six. To do that, you need to know this topology. You need to know that you have links to node two and node four, and the costs are one and two. And you need to know that node four has links to five and six and so on. So, you need to have a picture of that network topology to calculate the least cost path. Learning that information is what we'll look at. What are the approaches for learning about that information? And one of the problems with that is that once you learn that the topology is as it is, then over time that may change, especially the costs of the links may change over time. So, if the cost changes, I'm currently using the path one, four, five, six to get to six because it's the least cost path. But all of a sudden, the link from node four to node five has some problems. Maybe the performance goes down. So, the cost of that link goes up to maybe ten. So, now the path I'm using, one, four, five, six has a path cost of 13. It's no longer the optimal path. So, as the conditions change in the network, we will need to recalculate the least cost paths. And that's the challenge with routing. Finding the information about the network and then keeping that information up to date. So, let's look at that. Some of the things that we need to be able to do, the questions are here and some of the possible answers are here. So, let's talk about some of them. First about the cost listed here is the performance criteria. The number that I put on that line on those links, what does it represent? Well, it's up to the network operator or the network designer to choose what do they care about in terms of the cost. And there are different metrics or criteria. Some can be more accurate in terms of indicating if it's the best path. Some are simple. The simpler one is the number of hops. A simple way to calculate or to consider the cost is to say choose the path with the fewest number of hops. That often approximates the best path if we think about performance. Generally the more hops we have, maybe the more delay we'll have to get from source to destination and maybe the more chance we'll have lower throughput. So a simple way to measure cost is the hops. But sometimes that's not accurate to indicate what is the best path to get my data from A to B. So there may be other factors that we take into account. A couple listed here. Financial costs. If you think of a network connecting across the world and connecting different telecom companies or internet service providers across the world, then how it generally works in the internet is that one company maybe owns their network in their country or in their city and then they have a contract with another company to send their data through another country. For example, in Thailand, an ISP like TOT or CAT owns the network inside the country. But when the customers of that ISP want to send data to the US, then that data needs to go through other people's networks. So TOT or CAT need to have a commercial agreement with other companies to send data via their networks. So sending data via other people's networks incurs some cost, some financial cost here. So generally, if we wanted to deliver our data via other people's networks, we would like to choose the path which has the lowest financial cost. We don't pay as much. So financial cost is one way to consider the least or the best path. Other times we care about performance. I want to get data from A to B. I want to get there as fast as possible so delay is another metric. Choose the path with the smallest delay from A to B. Or I've got a lot of data to transfer. So it's not about getting one packet from A to B. It's about I've got a stream of data to transfer, so I care about throughput. Choose the path that gives me the highest throughput from A to B. So that are some examples of how we can determine the general cost of a link. And it's up to the operator or the user to choose those. There are others as well. Maybe in large networks choose a path where my data will not go through a country that I don't like. I don't like because maybe there are laws in my country saying I cannot send my confidential information through another country. So we may have routing based upon other policies, security policies, legal policies that say data should not go through this location. So there are different criteria there. Let's look at delay and throughput as a simple example. Let's consider a very simple network where we have five nodes, node one. We have two paths to get the destination node four. One path takes it via two and three. And another path takes us via node five. And we focus on one direction from getting data from one to four, just to keep it short and simple. These are our two possible paths to get data from one to four. So consider we're at node one and we know this network topology. We want to choose one of two paths to get data to node four. Let's say we know something about the network links. I know that the throughput of the links, let's say this is five megabits per second. So the throughput or the data rate, I'll measure in megabits per second. I will not write it. So five megabits per second for this link. For this link, it's three. This link, let's set it to eight. And these two links are two and two. So we know those characteristics of the network. And also we know the delay. Let's assume we know the time it takes to get the, say a packet across each of those links. The delay, let's say we measure in milliseconds. So we know that this link has a delay of six milliseconds. This one's six, 100. This one's 10 and 12 here. So let's say I know, I'm node one. I know the network topology. I know that there are four other nodes and the links between them. And I know the current performance characteristics of those links. That is the data rate or throughput, the speed at which I can send data, and the delay to send, say, one packet across those links, which the delay includes, of course, takes into account the data rate, but also the length of the link, maybe propagation delay and other processing delays. So I want to choose the best path to node four. Well, it depends upon what I define as the criteria for best. If I say best is equivalent to lowest delay, then what I do is I assign costs to those links. So the numbers I've written are not the cost yet. They're just the performance characteristics. I assign a number to each link, which we can then use to calculate the least cost path. With delay, it's easy. If I know the delay, the path delay is the summation of the link delays, and the best path is the one with the lowest delay. So in fact, we can say delay is proportional to cost in this case. So what I could say, if the delay of link one to five is 10 milliseconds, then let's say the cost of using that link is 10. Not the financial cost, but some general cost independent of the metric. So the cost can be equivalent to delay in this case. So the general cost in this case, we can say is the same as the delay. So the cost of link one to five would be 10. Five to four would be 12. That's easy. Now, the same numbers. And then what's the best path? 154. The total path cost, if I use 154, is 22 units. If I go one, two, three, four, it's 112 units. Okay? So if I consider delay, I choose the path 154. If I used a different metric, so we'll just record that, that would give us the path. The best path is 154 in that case. If I used number of hops, then it would also be 154. Because number of hops may be another metric. If the best path was something different is the number of hops, we defined a different metric, lowest number of hops, then what's the cost that we assigned to each link? If we want a different metric and say choose the path which is the lowest number of hops from source to destination, we need to assign a number to each link to indicate the general cost. What would it be for each link? What would I assign the link 1 to 5? What's the cost of this link? 1. It's 1 hop. So in fact, every link would have the cost of 1 in that case. That's maybe the simplest of cases. So the cost from 1 to 5 is 1. From 5 to 4 is 1. It's 1 hop. So again, we could calculate the least cost path. We could use the same algorithm and we'd find it's 154. So this is just illustrating we use different costs depending upon the criteria we care about. Now let's consider throughput. Let's say we care about a path. I've got a lot of data to send. Continuously, I want to send data. So I care about what's the highest throughput I can achieve across that path. I would say the best is the highest throughput or data rate. What do we assign as a cost on each link? If we care about choosing the path with the highest throughput, maybe look at the network and see which path is only 2 to choose from is the best in your perspective. So now I say I'll define best as the highest throughput and given that I need to assign some cost to each link, the cost should be related to the throughput and the cost should be such that if we use least cost routing, find the path with least cost, it will give us the best path. So what cost do we assign to our links now? First, looking at the blue numbers, which are the throughput measures, which path do you think is best? The top one or the bottom one? Hands up for the top one. Hands up for the bottom one. We get some for the most for the top, some for the bottom. Why do you think the top one is the best? Looking at the blue numbers, which are the throughput, we get a throughput from 1 to 2 of 5 megabits per second from 2 to 3 of 3 and 3 to 4 of 8, whereas on the bottom path, 2 and 2. Well, throughput's a bit harder than delay to consider. Across a path, the throughput of that path will be limited by the slowest throughput across that path. What we call the bottleneck link. That is, the path from 1, 5, 4, we can send it 2 megabits per second continuously to 5 and that can send it 2 onto 4 so we can get 2 all the way from 1 to 4. That's easy. Going from 1, 2, 3, 4, we can send a 5 to 2, but from 2 to 3 we can only send it 3 megabits per second. So if we send a 5 through to 2 and 3 to do 3, then somewhere that remaining 2 megabits per second is going to be lost. It's not going to get through. That is, if we send 5 into 2 and 3 out, the amount that we're going to deliver to the end is limited by 3. We cannot do more than that. And even if we send 3 megabits per second into node 3, and that can send 8 out, on average getting data from node 2 to node 4 is going to be limited at 3 megabits per second. So in fact, across a path, the path throughput is limited by the bottleneck link. The bottleneck link is the slowest link. In this case, we say this is the bottleneck link in the top path. So we can say that the path throughput would be 3 in the top path and it would be 2 in the bottom path. Which one's better? Top or bottom? The top one's better. Higher throughput is better. So be careful. Delay and throughput, we want low delay, but we want high throughput. So now, what cost do we assign to each link? We need to assign some numbers to the link such that our least cost routing will choose, in this case, it should choose the top path. Well, the first approach we can think is think of the inverse. That is, if we want, if we have a high throughput, the cost should be low. So if the the throughput is 5, then the cost should be and the second link, the throughput is 2. For the throughput of 5, the cost should be lower than a throughput of 2. So we can think we need to do some inverse. 1 divided by 5 may be the cost. And 1 divided by 2 the cost on this link. And then, again, the cost routing always simply finds the path where the sum of the costs is the least. So here we have a bit of a challenge. What do we assign as the cost of those links? Just taking the inverse is usually not sufficient. The general approach to use is to consider of all your links in the network, what's the maximum, and then take that maximum and divide it by the actual throughput. Or take some potential maximum and divide it by the actual. I'll show you an example of that. Let's say potentially the throughput can go up to 100 megabits per second, just to make a nice number. So what we could say, if we think the throughput goes up to 100, then this link we would set the cost to be 100 divided by 5. 20. This link would be 100 divided by 3. 33 approximately. This link, 100 divided by 8. Where this 100 we would choose as a parameter and say, right, that's our upper limit and we'll see how it works. That's about 12. This would be 100 divided by 2. 50. And 100 divided by 2 as well. So we'd assign these costs to the links. 20, 33, 12, 50 and 50. Now let's just do a sanity check. The higher throughput should give us a lower cost. Yes, 5 gives us 20. 2 gives us 50. So we've got the inverse there. That's working. And now the reason for taking this maximum when we add them up what do we get? 20 plus 33 plus 12 is what, 65. The path cost is 65 units. The bottom path, 50 plus 50 gives us 100 units. Least cost path is the top one. 65 is less than 100. Therefore we'd choose that path. So that's usually the way that it's done in practice if we have throughput or data rate. First we need the inverse to determine the cost. It should be the inverse of actual throughput or data rate. And to make the numbers such that when we add them up we'll get the best path. That doesn't work all the ways but in most cases we can select some number such that when we add them up the one with the lowest sum will indicate the one with the lowest throughput. And the common is to choose some upper limit in a network say 100 megabits per second or it can be higher or a different value depending on the network. It doesn't always work because there may be cases where the bottleneck is in the wrong path, is in the path that we select. The lowest throughput on the path doesn't correspond to the lowest sum. But in practice in most cases it will is a way to convert throughput into a generic cost where we can still use least cost routing. 100 was in this example was a value I chose and the idea where it comes from is think in our network what's the highest throughput that we can get on any link? Well in this particular example we used 8 what would we have had? The numbers may not have been easy would have been 8 divided by 5 1.3 or whatever 8 divided by 3 2.0 8 divided by 8 1 8 divided by 2 is 4 8 divided by 2 is 4 this path would have been 8 4 plus 4 this would have been the 1 it would have been the least it would have worked if we use 8 as well so it should be at least the maximum of the maximum of all the link data rates or throughputs I chose 100 because it makes nice numbers when I divide by rather than having decimals we can get close to integers it's a little bit easier to work with so that comes from the maximum you can find a case where it doesn't work you may be able to find a scenario where using the approach with particular link rates the least cost path chosen will be the one with which is not giving the highest throughput so it doesn't always work but most cases it will so converting the metric to cost is not easy with delay it was easy proportionally related with hops it was easy with throughput it was a little bit harder what did we do we said some maximum value divided by the actual value the maximum throughput of all the links divided by the actual throughput the actual needs to be down the bottom so that it's the inverse and we use the maximum to give numbers such that we'll get the least cost path most cases if we want to deal with other performance metrics then we need to consider other ways to convert them to a cost, to a number such that we can still use least cost routing questions on the costs or performance criteria for selecting the best path of course for this to work node 1 needed to know about the costs needed to know about the performance metric it needed to know that the link from 2 to 3 had a throughput of 3 megabits per second and a delay of 6 milliseconds if it didn't know that this approach wouldn't work let's look at the other problems and we'll arrive at how do we learn that information that's about performance criteria there are different ones that we can choose from and it would be defined for a particular network which one to use when do you choose a route when do you make the decision to use this particular route and there are again different approaches different ones with datagram packet switching for every packet you choose a route we make the decision to use a particular route that is that one of the nodes has a packet to send and it looks and chooses which route to send it on it doesn't necessarily recalculate the best path but it chooses a route for that packet the next packet it chooses again it may get a different path and we saw that when we looked at datagram packet switching versus virtual circuit packet switching with virtual circuit packet switching we first set up a connection sometimes called a session so when I set up that connection I choose the path to use and for all of the packets during that session during that data transfer so there the decision time is done when we set up the session and it applies to all the packets with datagram packet switching then normally we make a decision for each packet separately so there are the two common approaches there the result is with datagram packet switching packets may take different paths through the network with virtual circuit packet switching packets belonging to that one virtual circuit or session will take the same path who makes the decision and who calculates the best paths three basic approaches each node does it themselves each node calculates the path and makes a decision I have a packet look at the destination of that packet and make a decision where to send that so that's a distributed approach each node makes the decision and the calculation a centralized approach we have some special node in the network maybe some special server that calculates the paths and decides for all the other nodes and the third approach is that the source node the one that's creating the data makes the decision and that's called source routing in practice in the internet or large networks the distributed approach is most commonly used the nodes themselves will calculate what they think are the best paths to reach some destination and when they have a packet they will use that best path the problem with the distributed approach is that some nodes may have different viewpoints of the network node 1 may think the best path to node 6 is via this direction node 5 may think it's via a different direction because they maybe have different information about the network so in a distributed system they will be able to move coordinating those nodes so we'll see an example of that as we go through the next two so the next two are how does a node know the current network topology and how do we keep that information up to date so let's look at several cases of how to do that and we'll use an example to do that let's consider another network let's say we are node 1 in our network and I want to send data to some other nodes and in this case I know that there's another node in the network called node 7 I want to send a node 7 I know there is a node 7 in the network here's node 7 so I have data to send a node 7 and I know there are some paths to node 7 hopefully there are we are node 1 where do I send a node 7 where do I send it where does node 1 send the packet how does it calculate the best path to node 7 what is the best path to node 7 what is it no idea we don't know yet because why don't we know we don't know about the other nodes in the network or any of the links so let's say I am node 1 and I just booted the computer I just started the device and when it boots up that's the knowledge that node 1 has about the network it knows nothing about the entire network so if I want to send to node 7 and I know nothing about the network can I do that can I send to node 7 without knowing anything about the network yes how send to everyone so I create a packet I say the destination address is 7 send to everyone alright well everyone when my device boots up someone plugs in the cables and when they plug in the cables then I know that if there is 3 cables plugged in what I would do is I'd send a copy of that one packet on all 3 links all 3 cables someone will receive it I don't care who gets it and then I'll tell them when you get this packet send to all of your neighbors and then they will send to all of their neighbors and eventually it will get to node 7 if there is a path to node 7 so that's an approach which is very simple even if we know nothing about the network we can still get data to node 7 and it turns out a packet would take the best path through the network to get to node 7 that is the next technique we'll look at not yet this is called flooding we'll come back to that technique of flooding a better approach we want to take just one path let's be a little bit smarter so the first thing we can do is when I boot up so we can make routing decisions with no knowledge of the network knowing nothing about the network but let's boot up and let's say when I boot my computer and the links start their cables plugged in then I can learn without my neighbors I can learn who's at the other endpoint of the links so when my computer starts up it connects to some other device at the other end of the link and finds its address so let's say we have some neighbors and in this case we have two neighbors node and we learn the addresses node 2 and node 5 so that's commonly assumed that a node can easily learn about its neighbors so it knows I'm connected to node 5 I'm not connected to 7 I've learned that I still want to get my data to 7 what's the best path to take to get to 7 let's say we don't want to take this approach of sending to everyone because that's really a waste which path do I take to get to 7 do I send a 2 or 5 a game we don't really know which one to send to we could choose randomly node 2 tomorrow let's try node 5 and hope our data gets there across the best path but most times or many times it will not so that's not so good so we need to know something about the potential paths so after we've booted up we learn about 2 and 5 and the other thing that we can often learn is what is the cost of each path of each link let's say the cost we know maybe the costs of measuring delay and again it's quite easy for a node to know that the cost of its current link is some value it doesn't take much to learn that information and it doesn't take much to keep up to date about that information that is this cost changes something goes wrong or the delay the delay goes up for some reason so the cost goes from 2 to 3 again node 1 will know that almost immediately so we know about our local or our neighbors and the links to those neighbors so now which path do I choose I want to send to node 7 where are you going to choose you choose 5, Y5 so node 5 has a lower cost among that link so if this is all we know we could choose to send to node 5 and remember node 5 would also know about its neighbors we as node 1 don't know its neighbors not yet at least but node 5 knows its neighbors and it could do the same thing I choose node 5 because of my 2 neighbors it has the lowest cost node 5 gets the packet and then choose from its neighbors the one with the lowest cost and then they choose the lowest cost and hopefully the data gets to 7 but it may not be the lowest cost path that's the problem so what else can we do I want to be more certain that the path I take is the lowest cost path what can I do ask, ask who ask 2 and 3 ask 2 and 5 ask my neighbors who are their neighbors and what are the costs so this involves some overhead so what I do a routing protocol what it will do is send a message from node 1 to 5 saying who are your neighbors please tell me your neighbors and node 5 would send back a message saying my neighbors are these nodes and these are the cost of the links so this is some overhead of collecting this information so let's say we do that and we do learn the neighbors node 2 has 2 neighbors node 4 so we've sent a message to node 2 node 2 sends back a message saying my neighbors are 6 and 4 and they also tell me the cost of those links the cost from 2 to 6 is 8 and the cost from 2 to 4 is 2 and I do the same thing for node 5 my other neighbor send a message and he sends back a message saying my neighbor is 3 and the cost of the link from 5 to 3 and node 5 tells us node 1 is 5 so by exchanging messages with other nodes we can learn more about the network topology and that may help us finding the best path from node 1 to node 7 now node 1 needs to choose which path before someone chose 5 someone said 5 any other alternatives now maybe going via node 4 looks like a potential good path it has a cost of 5 units so the decision you made before is maybe wrong or maybe you're lucky we'll see but you see the more information we learn the more chance we have of choosing the best path now again the link cost may change over time so in a large network the cost may change so if the link cost from 2 to 4 changes it increases up to 10 then how does node 1 know it changes so I know it's 2 now because I sent a message to 2 and they sent back my link cost to 4 is 2 so now I look like I'm going to use that path but the cost changes from 2 up to 10 that's the best path now so for node 1 to get an accurate record of the current network not only does it have to discover but it has to continuously get updates I have to continually send a message to my neighbours saying tell me your neighbours and the cost of the links to those neighbours do it again and again and again so there's more overhead here if the network changes a lot it will continually get updates to get an accurate record we still don't have the best path or not necessarily the best path to 7 so the next step is not only do I ask my neighbours but I ask my neighbours about their neighbours and I learnt this in the same time all the other nodes are doing that node 5 asks its neighbours 1 and 3 about their neighbours and when node 5 asks 3 about its neighbours node 3 sends back a response to 5 and the next time I node 1 asks node 5 node 5 not just tells me about its direct neighbours but about its neighbours' neighbours so each node keeps up to date of what they know about the network for example when node 5 asks node 3 node 3 sends back a response saying my neighbours are 4, 6 and 7 they are the neighbours of 3 so when 5 sent a message to 3 3 sent back a response saying my neighbours are 4, 6 and 7 and the costs of those links are 1, 4 and 7 so 5 knows this the next time node 1 sends a message to node 5 5 tells node 1 about its neighbours but also the other information it knows 5 knows that the neighbours of 3 are 4, 6 and 7 so 5 tells 1 that so now 1 knows the neighbours of 3 are 4, 6 and 7 similar the other nodes node 4 has neighbours so when we ask node 2 node 2 tells us about 4's neighbours and 6's neighbours and these are the links in our network and the costs so when 2 sends a response back to 1 it says my neighbours are 4 and 6 and they have told me in the past that their neighbours are the ones connected via these links so now this is the view of the entire network from node 1's perspective and in this example that is the entire network there are no more links we would keep going if the network was connected to node 1 importantly for node 1 to discover about the network topology and the costs of the links it needs to ask other nodes needs to send packets special routing packets to other nodes saying tell me about your links and because the network topology may change over time links may disappear new links may come up costs may change we just do it once and hope that that gives us the best information and that's the challenge of routing try to do that by minimizing the overhead we don't want to send too many packets to do this but we want to get an up-to-date view of the network once node 1 knows this information it simply uses Dijkstra's algorithm or whatever to calculate the path to node 7 and we find which is it anyone can see the path to node 7 the least cost path can anyone get a cost less than what 12 anyone get a cost from node 7 less than 12 153 someone said at the start send via 5 that's not so good because even though it's 2 to 5 another 5 that's 7 but then 7 here maybe we could go here it doesn't help much 1 to 2 is 3 to 4 is 5 to 3 is 6 to 6 is 10 to 7 is 12 so here the least cost path actually one of the longer paths so the more information we know the greater the chance we would choose the best path but the more information we know the more overhead in collecting that that's the trade-off here and some of those issues are summarised in these points so let's just recap so the 2 issues are where do we get the information from about the network topology and how often do we update that information and some of the alternatives are listed here well we said where do we get the information from at the very start let's say we know nothing about the network can we do routing we know we have none no information no routing but it may not be very good we said there's an approach called flooding which we'll return to later just send to everyone local means use the information on your node when a device boots up it knows something about itself so it can use local information with very little overhead adjacent nodes is really just a neighbor nodes so we saw if we talk to our neighbors and we know the links to the neighbors we can make a decision on routing based upon their information or we could extend that and say the neighbors neighbors the neighbors neighbors neighbors and so on eventually we could ask all the nodes in the network and if we know about all the nodes then we know everything about the network so the more information we collect the more accurate we are in choosing the best path the other aspect is we need to continuously or we would like to update that information sometimes we can get a continuous update node 1 always knows about the cost to node 5 because it's actually directly connected to that link so it knows that so we got a continuous update if this changes to 3 we know immediately but if this cost changes from 5 to 6 the only way we know is by asking our neighbor or our neighbor telling us so we can have continuous updates or we can do it periodically every one minute I send a message to my neighbors please tell me about the latest cost of your links do it on a periodic basis or maybe when there's a major change in the network instead of waiting on a periodic basis when node 5 realizes the link to 3 goes up to a different value maybe it changes to 10 here a major increase in the cost then node 5 tells its neighbors the link which I passed told you was 5 has now gone up to 10 you may want to change the paths so a major change or node 3 disappears a major change in the topology if node 3 disappears node 5 should tell node 1 3 is no longer there update your view of the network so there are different ways or different places to collect information from and different ways to update that information and now the challenges with routing in general get up to date information but minimize the overhead of doing so any questions so far we've covered the basics of routing learn the information about the network then apply some algorithm to calculate the least cost routes not so hard the next thing we'll look at is how do we store this information that is node 1 finds the least cost paths and it will try to find not just to node 7 but generally we'd like to find the least cost path to all potential nodes so when I have data to send I don't then go and find the path when I have data to send if I know the path already I'll just send the data let's return to our original example that you have in your notes and we'll look at the case of how can we store the information so now what we'd like to do is to we'll separate the process of finding the routes from the process of sending data sending data we need to know the route to send a via calculating the routes is a separate process what's common in networks today and the internet is that the process of finding the route called routing is done independently in the background the process of sending the data along the route called forwarding is done whenever we have data to send so let's focus on the process of routing and how do we store the information of the routes so let's in this example network first how many routes are there in the entire network how many possible routes do we need least cost routes are there in this network how many least cost routes are there let's say I have a server that needs to store all of the routes all the possible routes in the network the paths how many are there that I need to store you can try and calculate them all or they may be an easier way than every other node there are five other nodes so there's five node two needs a least cost route or path to every other node there's another five paths note that the path node one to node two may be a different path than from node two to node one because our links are asymmetric we have different cost of the links if they were the same cost the same path in both directions so node one should have five least cost paths node two needs another five least cost paths and each node needs five least cost paths so in this network there are 30 paths in total so there are two main approaches for calculating them or for storing them one is that we have a central server that calculates this maybe computer seven looks at the network learns the topology and then calculates and then tells every node about those paths more commonly today is that the nodes do that independently node one goes away and calculates its path to the other five node two does it and each node does that and we'll consider that case so let's record some of them for node one calculate all the least cost paths from node one to every destination so the source node is node one I want you to find the paths to all the other potential destinations two three four five and six let's record that information the path the least cost path we're talking about here we'll talk about also the cost of that path let's record that what's the least cost path from node one to node two well from node one direct to node two the cost is two can anyone see a path less than two no there's no path less than two to node two so we say node one to node two the path is one and two and the cost is two to node three least cost path to node three not so hard look through some of them you'll quickly find the path and then do it for the other nodes from node three to node at node one to node three one two three has a cost of five that's not good what about one four five three has a cost of three so be careful there one four five three has a cost of three units node one to node four least cost path and here you can of course you can see it on the picture but one shortcut if the least cost path from node one to node three goes via four then it means the least cost path to node four from node one must be this segment of the path that is from node one to node four the least cost path is one direct to four if there was a lower cost path from one to four then that means there would be a lower cost path from one to three for example and it's not in the network if there was a path one eight four which had a lower cost than one direct to four if there was that means there would be a path from one to three one eight four five three with a lower cost than three but since we already know this is the least cost path that it must be that the least cost path from one to four is one direct to four and that's an important thing that we can take advantage of the path cost if we look at the network it's three in that case and similar here we know that to go to three we go via five that means that there is a least cost path one four five and you can check the cost and one four five six we've seen before the cost there was three is it or four four just record the costs here as well the path costs so what node one does is it learns the network topology it calculates the five least cost path to each destination and stores this information now when I have a data packet to send it's very simple I have a data packet to send if the destination is node three I can look up okay the path to node three goes via node four and five send the packet to node four if the destination is node five then also send to node four so the way that we use this information is now that when we have data to send just do a look up to see who to send it to next and by this concept that we said that if a least cost path from one to three goes via four then it implies that there's a least cost path from one to four similar if there's a least cost path from one to three that goes via four there is a least cost path from four to three which is four five three if one four five three is a least cost path then it means the segments segments in that path are also least cost paths. 453 must be a least cost path. From node 4's perspective, when it calculates the least cost paths, it will say from 4 to 3, it will find the path 453. You can check that. But the point is, because of that, node 1 doesn't care, in fact, about the entire path. Once it calculates the least cost path, it only needs to know the next node in the path. What node 1 will do, it knows to reach 3, we need to send to the next node 4. It will send the packet to node 4. Node 4 will have its least cost path, and to reach node 3 from node 4, the least cost path will be 453, and node 4 will know to send it node 5. Node 5 will have its least cost path, and will send it to 3. The end result, once we calculate the least cost paths, we only need to store the next node in the path. So we don't need to store the entire path. So from node 1 to node 2, the next node is node 2, here it's node 4. So even though we can calculate the path, there's no need to store that. And that makes it simpler for the nodes when we have long or large networks, and there's no need to update anything about the other paths. It makes it simpler for the nodes to recalculate the best paths. So the key information that node 1 stores, for each destination, what is the next node in the least cost path to reach that destination? And every node does that. We optionally also store the cost, and that will be used later. And that information is what we call a routing table. It's a table that we store information about the routes or least cost paths in. We call it a routing table. And to finish, you may have a look at the routing table. Here's what we've arrived at. Every node in a distributed approach stores for each potential destination, node 1, node 2, node 3, what is the next node in the least cost path, and usually optionally the cost of that path. We don't store the path, we just store the next node because of this concept of that the segments in a least cost path are also least cost paths. And the routing table for node 1, here it's listed as a routing directory, but we usually call a routing table, is this table. To reach destination 2, 3, 4, 5 and 6, the corresponding next nodes are 2, 4, 4, 4, 4. That is this column and the next node column. That's our routing table. So we'll spend some time arriving at routing tables. We can see how to create a routing table, and then they become very important in the Internet because we use routing tables to know where to send our data in the Internet. So we'll stop there, we'll look next lecture at some extensions of the routing tables, some other examples, and then look at return to flooding and see that basic approach send to everyone to do routing and compare the different routing strategies.