 So we've just looked at switching Before we actually move on to routing one one way that people have compared circuit switching to packet switching Especially datagram packet switching Think about driving on a road When you drive on the road it takes some time to get somewhere and the intersections are like the switches We turn left we turn right or we go straight ahead and there may be some delay there Circuit switching is like the case when maybe there's a VIP needing to travel from A to B and what happens is the police Block off the the road the intersections and allow that VIP Maybe the Prime Minister to drive from A to B all the way through the highway or through the road without without stopping at the intersections That's like circuit switching. We set up a connection from source to destination Once the connection is set up We can send the data all the way through to the endpoint without any disruptions at the intermediate switches packet switching is like Our we drive on the road When we arrive at an intersection, we have to decide which way to go and the problem That may arise is that whenever and also arrives at that same intersection There may be a large queue there People waiting at the intersection to be to go on to one of the output roads So with packet switching we just drive at our own speeds in our own directions. There's no setup in advance but the problem is that We may have a large delay at the intersection or in our packet switching network a large delay in the switches a queuing delay But the benefit of packet switching compared to circuit switching is that in circuit switching When the police reserve the road for the VIP But they're not traveling on it yet. No one else can use that road and it's very inefficient The road's being unused when people would like to use it. So that's a comparison with road networks and communication networks that How do we choose which roads to go via to reach our destination? How do we choose the path in advance? When I want to drive from here the campus into Somewhere in Bangkok. I want to go to Paragon and go shopping tonight. I need to choose a path to take Which intersections will I go to and where will I turn at those intersections? So that's what routing is about choosing the path from source to destination And in fact it comes before and our data normally so in this back to our original example of a simple network We have some stations. I want to send data from a to f. I know at computer a I want to reach f Where will I send the data in our network? Any suggestions? Where am I going to send the data? Well, there's no choice at the start I From computer a perspective I can only send a for switch for so there's no choice there Switch for gets the data. Where can it send the data? Well, it's got three different options. Which one would you choose if you switch for? Who would you send to next? Who would you choose you'll switch for where you're going to send the data to get to f? Seven why did you seven? Because it looks closer or it looks like a shortest way to get to f Okay, so we need some way to make a decision So there we made a decision that okay to reach f I think some of you is thinking well There are multiple paths the first thing to observe in our network. Usually we have multiple paths to choose from So we need to choose one. We normally just want one So therefore we need to choose them somehow we could randomly choose That'd be very simple just just randomly pick one of those to send via But for performance reasons often we'd like to choose the best path and I think some of you eyes that Maybe the best path from a to f is the shortest path Shortest in what? shortest in Short in terms of what? meters Not necessarily Maybe in this case the shortest in terms of the number of links the fewest number of links Okay, that is we could think Assuming this is not to scale Maybe the shortest path from a to f in the number of links one of them is four four seven six We actually go via three switches Another one is four five six the same length in terms of the number of links or switches a longer path is four one Two three five six Okay, so we could say choose the path with the least number of links in it That's an easy and a very common approach that's used in in routing If we wanted to be more accurate Maybe we would like to consider other factors like the distance Maybe maybe the distance not relevant and some other characteristics of the links and the devices so Routing is a very important design issue in in networks and the question is which path or Route so we use the same by the path or route to mean the same thing Which path should be taken from source to destination? That's our challenge and the answer the best path Well, that's not a complete answer because we need to define What do we mean by best? Is it the path with the least number of links? or is it a smallest total delay or Is it the path that is the cheapest? Often in a network. We need to pay to send data through a link Choose the cheapest So we need to define what do we mean by best and once we know that how do we choose it? What algorithms can we use to choose the path? So that's what we look at in this topic In the examples like the one I just presented we only have 10 or 15 devices and and not many possible paths in real networks. There may be hundreds of thousands of devices and Many many possible paths So in fact in choosing a path Even if we use a computer to choose the path sometimes it's not easy to do it in a short amount of time So it's much more complex than we see in the examples Routing is necessary for both circuit and packet switch networks In circuit switch we need to choose the path or the that to set up the circuit in Packet switching we need to choose a path through our packets to take to get to the destination. There may be some different issues Packet switching and especially datagram is is a key part of the internet. So we focus on packet switching from now on So today we'll just introduce the concept of routing. So what we want is some Some technique or an algorithm that says given this source Given this destination tell me the best path That's what we need a routing algorithm that will find me the best path from source to destination Such an algorithm has a number of requirements some are obvious some are a little bit more complex the first one is maybe obvious if I have a routing algorithm and That algorithm takes as an input source and destination. It must return a correct path What do I mean? Source is a destination is F. I use a routing algorithm my software it takes as input a and F It returns the path four five two eight and six So the path four five two eight and six is the answer from my best path from a to F What's wrong with four five two eight and six as a path? It's not an actual path in this network So the point is that the algorithm the software that calculates path must choose an actual path from source to destination and Note that the way that we're defining the path or talking about it is by the the nodes or the switches that we pass through The path from a to F can be four seven and six Four six seven is a different path The order matters. So algorithm must to return a correct path. That's maybe obvious We would like a way that When we Calculate the route or the path the routing algorithm is easy to calculate It doesn't take much CPU to calculate It's easy to implement so that when someone has to write the code for that algorithm that they won't create bugs and It's cheap. That is again not not much CPU. So something easy is desirable as with most systems we develop The next thing we'd like an algorithm, which is robust and what that means is if it chooses a path and Then we find that there's some error in the network the algorithm may be able to adapt and choose a different path My algorithm tells me to get to F Your path is four seven and six But we discover that node seven is not working So what we'd like is an algorithm that will adapt and maybe choose an alternate path for us maybe four five six and Now I'll start sending my data across that different path. So when there are errors in the network like node seven fails Then we'd like an algorithm to be able to cope with that. That's all we're robustness means and Usually that means finding alternate paths So not just using this path forever, but find another one when there's a one that arises or even maybe we notice that node seven is Maybe let's choose a different case the algorithm initially Initially to choose as path four five and six as a best path Maybe seven's not here seven is not Not a good example here. Let's say we want to go from Where are two distinct paths? We want to go from B to D All right, B to D the algorithm chooses one two three to D easy But we noticed that switch to as we're using that path and sending the data we noticed that switch to is busy It's slowing down node C is sending a lot of data through it We can think it's congested So the performance is not so good when we're going by switch to So what we'd like an algorithm to do is to say okay one two three was no good Maybe you should start using one four five three as an alternate path to route around the problems where if there's an error at node seven find a different path or if No two is working But he's slower than we expected then maybe find a different path now the problem with This switching between paths is that sometimes what may arise is that okay? We're sending our data one two and three Then our algorithm tells us change node two is busy It's got a lot of data going through it change to one four five three start sending a data one four five three But then the algorithm realizes node five is busy. So it says go back to one two or three. That's better again But then two gets busy again because we're sending data through it So it goes one four five three and we keep swapping between those two paths because the algorithm Tries to choose the best one but it may become in state unstable in that we Constantly switch between paths That can be a bad outcome Even though they are actually the best path changing path too often can be bad for some data transfer one thing that happens is that if we think of the the delay maybe the delay across the first path is Recently short three links three switches and the second path is quite long Some applications they can tolerate a long delay But if the delay changes a lot Then the applications do not work so well So sometimes we'd like to have constant performance Even if it's not perfect performance Keep it stable So a routing algorithm should be stable in that it should try and find the best path that can use for a long period of time The requirement of stability and that conflicts with robustness sometimes choose the optimal path choose the best one That's another requirement. We need to define what we mean by best Be fair and this is a hard one to explain by our example We think a routing algorithm may find paths for all stations in the network Find the path from A to F find the path from B to D and the path from C to E Fairness is about try to make sure that those three paths give similar performance for each of those pairs of stations communicating Don't choose a path which is great for a It's great for B But terrible for C Try to choose paths such that each user gets about the same performance That's the idea of fairness be fair amongst the users in some networks We have such a requirement that try to treat all users in the same manner And there are some situations that arise that maybe an routing algorithm would not provide fairness Last one while we're here Coming back to this issue. We want to know the best path. We're using one two and three to get to D We realized two is busy and slowing down How do we know that at source B that switch to is slowing down? Often we'd need to exchange some messages Maybe from switch to send some feedback back to be saying I'm busy right now. Maybe you should use a different path So to support routing We need to exchange some information between the devices And that creates overhead so the last requirement is Try to be efficient in choosing the best algorithm Make sure that you minimize the amount of processing done on on the devices and Minimize the amount of overhead that we we create to learn about what's happening in the network and In the subsequent discussion will we will see examples of efficiency or especially overhead what can create the overhead and The ways that we can try to minimize that so we'll keep these in mind as we go through routing approaches But today we'll just introduce the terminology To set up the different approaches we'll go through and The terminology though those terms will define through this example network So now I'm not going to draw stations and switches. We'll just be general and talk about nodes Whether it's a switch or or something else It doesn't matter routing applies in general to a network and we can think of a network as a graph We have a set of nodes of vertices or edges connecting them So in this example, we have six nodes six computing devices that want to communicate and The lines between those nodes Tell us something about the links between those nodes So the first thing we have a link. So there is a link from node one to node four and In routing will often Will often consider the links differently in each direction So let's say we have a cable from node one to node four and It's a full duplex cable We are the fuel full duplex link and that we can send in both directions Will often Consider that well, sometimes we'll consider the case that the directions that we send in there may maybe get different performance and That may have an impact on routing and that's what we're showing here that we have a link from node one to node four and We'll also think we have a link from node four to node one. We could have a simplex cable That is a link from node one to node four, but no link back to node one That's not very common nowadays, but it's possible that we can send in one direction, but not back So we'll draw two arrows to indicate the each direction So we have links between nodes A path is defined as a set of links from source to destination or the set of nodes that we traverse a path from node one to node six is Node one node two node three node six so we could write the path down as node one and two and three and six or We could just say it's the link from node one to no two The link from node two to node three and the link from node three to node six. It's the same The set of nodes we go through or the set of links we go through that's a path a Path can consist of a single link. There's a path from node five to node six It is direct from node five to node six. That's still a path There's also other paths. So there may be multiple paths to to traverse a single link reduce the term of a hop we take one hop So we can say For the path from node one to node six Via two and three There are three hops We hop from node one to node two node two to node three and node three to node six. So that's a path with three hops and Often when we think about shortest path we think about the least number of hops One with the least number of links. So hop just means a link is traversed Just some terminology What's the least hop path from node one to node six? The least hop path No one to node six. What's the least hop path? Write it down What's our answer? That is what's the path from node one to node six? There are multiple paths. Which path has the least number of hops? Where is the least number of links in the path? Node one to node three is one hop node three to node six is a second hop You cannot get lower than that in this particular example. So we say quite simply node one node three node six and some cases will use the hop count as An indicator of the the best path. It's a very simple way to say okay The best path from no one to node six is the one with the least number of hops It's very easy to measure What other terminology do we have? the And we can talk about neighbors Okay, so the neighbors of node five nodes four three and six the neighbors of the nodes which we have Correct links to Node two has three neighbors node one node four node three and we can talk about neighbors of neighbors and so on the neighbors are Usually known in advance If you think node fives a computer Switching a network and it's got three cables plugged into it and at the other end of end point of each of those cables Are nodes four three and six when someone can sets up node five and they plug in the cables They know who's at the other end point of the cable Okay, we'd normally know our neighbors when we set up our device So we'd normally assume that node five knows that the other end point of this link is node four of This link is three and this link is six But when we set up node five it may not know that there's a node two a node one in the network Maybe on the other side of the country. So we'll have to deal with that. We'll look at ways for how to learn that We'll assume that we usually know our neighbors in advance a Topology or the topology is just the arrangement of nodes and Links, this is one topology If I remove nodes fix I have a different topology if I cut out the link from four to five That's a different topology and the last thing is these numbers the cost What we'll do in routing is that to find the best path from source to Destination we'll use what we call least cost routing We'll assign a cost to every link like these numbers on these arrows here We'll assign some cost. It doesn't mean financial cost not necessarily some general cost and Then we'll use an algorithm to find the path which gives us the least cost Where the cost of the path is the sum of the cost of the links on that path? So what these numbers are an example of the costs assigned to using each link and We'll talk about different ways, but the cost may be related to The delay of the link The performance in terms of throughput or data rate the financial costs the security of the link The the number of hops and other factors. So there are different ways to measure cost But once we have a way We allocate a number to the link indicating the cost higher the cost the worse That link is in our path Given that we've assigned cost to our network. What's the least cost path? From node one to node six find the least cost path from node one to node six The path from swan to six which gives us the least the smallest cost where the cost of a path is The sum of the costs of the links on those path on that path least cost path You need to check several You may find it you found it Found it where point Four five and six what's the cost of four five six? The cost of the path from one four five six is four units so our link hop path From the previous one that the number of hops was one three six But that has a cost of one to three is five units and Three to six is five units the cost from one to six is ten via three There are other paths from one to six with a lower cost and if you through One to four to five to six has a cost of one plus one plus two of four units So the total path cost is four one four five six is the answer there and just so we remember the cost the total path cost was four in that case if I give you a larger network with maybe 40 nodes many links How are you going to find the least cost path? So I give you the costs How will you find the least cost path in a network from any source destination pair? It's hard to look okay, even this small one. It's hard to some cases find what we want is you need to check many cases What algorithm can you use to do it quickly? Find the least cost path in a network What's the algorithm is named after some person That's with a D Dijkstra algorithm is one of them Okay, I think you've studied in in some other course the Dijkstra algorithm is at least as an hour at least cost path From one node actually finds from one node normally other nodes Okay, so there are algorithms who do it for us. We were not study that we'll assume that we Have some algorithm that that would do a Bellman Ford is another algorithm that will find it in a different way So there are algorithms finding the least cost path Coming back to the costs know that the costs Between a pair of nodes in each direction may be different like this example from node one to node four The cost is one to go backwards from four to one the cost is higher It's that's possible sometimes have the same sometimes that different Why would it be different? Consider Many factors, but a simple one you may know of is if you've got internet at home You may have ADSL internet or you may have used ADSL internet anyone you have an ADSL router at home and What download speed do you get? How many megabits per second When you go to your ISP usually pay per month and it depends upon the download speed how much you pay for example I've got one which is 10 megabits per second download speed, but the upload speed is not the same It's one megabit per second So in that one link from my node to the ISP node Coming from ISP to me is fast 10 megabits per second going up is slow So the same link has different performance. So if the costs associated to the data rate or That performance that's why we may have different costs because on one link between the same pair of nodes We may have different performance in each direction So that's why we may have different ones so We've introduced the terminology what we do in routing in networks is Once we know the network topology We know the nodes and links and we know the costs of those links So we're going to sign those numbers Then we simply use a least-cost routing algorithm like diextra or others Is used to find from any node to any other node the least cost route the least cost path And that's the path we use But the challenges that we're left with Which criteria do we use to assign a cost is cost financial cost delay? Throughput something else. We look at them When do we choose a path? Do we choose one today and use it for the next Year, or do we use it today choose it today and then choose five minutes later recalculate maybe things change Who chooses the path? Is it the source node? the intermediate nodes or maybe we have some special server that calculates for everyone and When we to learn about the topology the link costs and the current usage links We need to know that to calculate the least cost path Where do we get that information from and how often do we update that information especially as the cost may change? So that's what we'll look at in the rest of this topic of the techniques for answering some of those questions We'll stop there and we'll continue on that in the next lecture tomorrow