 We've introduced routing and we said there are a number of challenges with routing like What performance metrics or performance criteria do we use to select the best path? Do we use financial cost delay throughput or some other criteria? When is a path selected do we choose a path now for this packet and Then for the next packet choose another path We'll make a routing decision or do we choose one today and use it for the next 24 hours So the when do we choose the best path? Which nodes in the network are responsible for finding the information and setting the best path Maybe there's a distributed approach where all nodes take some role in it or a centralized approach where there's a special server that records the best paths and Importantly and we'll look at we've looked at is What information do we need to collect about the network to calculate the best paths? I need to know something about who else is in the network and I need to know something about the link costs So the more information I know The more chance there is I'll choose the actual best path So how do we get this information and? Because things change We're using the network today but over the next 24 hours things change in the network usage We should update that information That is we should get an update on a regular basis so that we can make sure we still are using the best path so we've mentioned some of those issues and some of the approaches Some of the solutions to those questions we went through a few in the previous lecture Looking at different cases what we're going to do today is to To return to how we store best paths by looking at the fixed routing strategy So in fact, we're going to go through three routing strategies general approaches for routing The first one and the third one are almost the same Okay, so we'll spend some time on the first one the third one is a small change to it The first one's called fixed routing the third one in the slides is called adaptive or dynamic routing They're pretty much the same. So we will just explain the difference the middle one strategy to which we'll present Flooding is completely different from the others. So we'll spend some more time on that So the routing strategy is the first is fixed routing. Let's say we we have the task of building a new network Maybe the network is to cover the entire country We we're setting up a new Network to connect different cities across Thailand So we put in the different switching nodes in the network in the links and as the designer and builder we know about the network We know the number of nodes and we assign some costs links So what we do then while we design and build that network is we calculate the least cost paths through that network From every source to every possible destination we calculate. What are the best paths and? we store those paths or Some part of them in what we'll see is routing tables and we briefly mentioned routing tables in the last lecture How do we calculate least cost? Paths where there are algorithms that will do that for us So given a network Such as this one. Let's say this is our network across the country. There are just six nodes If we build this network, then we can calculate the least cost path from node one to node two From node one to three one to four five and six and similar for the other sources from five to every other node And from four to every other node Well, if we have a larger network, we can use an algorithm to do it for us like diapers algorithm Bellman Ford There are some other algorithms for quickly calculating the least cost paths in in networks So we calculate them and last lecture we actually calc calculated for source node and one to all other five destinations and We come up with these paths From source and one to the five destinations We come up with a path and the total path cost What we do in fixed routing is once we've calculated the path We store not the entire path, but just the next node in the path That is even though the path from N1 to N3 is N1 and 4 and 5 and 3 From N1's perspective all we need to record is that the next node in the path is N4 the reason is because this concept that if N1 and 4 and 5 and 3 is a shortest path or a least cost path so is N4 and 5 and 3 So node 1 knows that the next node in the path is N4 similar and four calculates the least cost paths from it to everyone else and We did some of them last lecture and 4 calculates to get to N3 the least cost path is 453 So in fact N4 only needs to store that the next node is N5 So by storing the next node what we do is we send to that next node and that node has the least cost path to the destination and We eventually get the packet across the least cost path So we'll see that and we'll continue the example, but rather than Calculating the least cost path. So I'm sure you can look through there and find every least cost path in The lecture slides we have the answers on this slide Here are the next nodes in all of the least cost paths from each death each source node So there are six tables or called directories here. I'll call them routing tables The way to read them node 1 the node 1 directory at the top left From source node n1 To destination node 2 3 4 5 or 6 the next nodes in the least cost paths have been calculated to be 2 4 4 4 Note that this second column matches our example from source 1 We calculated the paths to N2 through to 6 and we get these and the next nodes we see 2 4 4 4 4 alright summarized in this column so we just store really this column and This column and that is the key information in what we call a routing table that is stored at n1 and We've done it for the other source nodes and 2 through to n6 and the routing tables for those are given here that is If we're at node 4 If we're at node 4 and we want to get to node 5 then the routing table tells us the next node in the least cost path Is actually node 5 we can send direct If we're at node 5 and we want to get to node 1 Then the next node in the path is node 4 so 5 sends to 4 So with fixed routing we calculate the least cost paths in this approach It's a distributed approach where the information is stored at each node in the network that is node 1 stores this table No 2 stores the second table. No 3 stores the third table We'll see a centralized approach in the previous slide, but let's continue with this one. How do we use this information? Let's say Node 1 wants to send data to node 6 Okay Once we know the routing tables. We have one packet Node 1 wants to send to node 6. So we create a packet the source address would be node 1 the destination node 6 Node 6 uses its routing table to determine who to send the packet to and we can see follow through here Node 1 has a packet destination is node 6. So we look up the destination column. We find 6 Okay, the last row node 1 therefore needs to send this packet to node 4 Node 1 sends the packet to node 4 node 4 gets the packet The destination is still node 6. So let's see what node 4 does Node 4 now has the packet Destination is 6. We look up the routing table. Okay to send a 6. We actually have to send to 5 So we forward this packet on the 5 When 5 gets the packet destination the final destination is 6 So node 5 forwards the packet on to node 6 according the routing table node 6 gets the packet and we're done Node 6 gets the packet realises that the destination address in the packet is itself So the data has reached the destination so We Generate the routing tables by calculating the least cost paths And once the routing tables are generated and created and stored at the nodes To send the data through the path. We simply look up the routing table to see who to send to next And that process is called forwarding and this is basically how the internet Works in how we deliver data through the internet today. It uses routing tables in nodes across the network and those routing tables have the data created based upon routing protocols and When we want to send data, we simply read the table to see who to send to next the routing table The general format is described here that the destination node the next node and Optionally not in the examples on the slide, but we can usually will also store the path cost if we know that There's no need to install to store the entire path just the next node in the path Now the approach that we just went through was a Distributed approach each node stores their own next nodes We could have a centralized approach where there's one special node in the network maybe node 7 in our network a special server that calculates at least cost paths and and Records that in this table If you look closely, you'll see this is just a combination of the six other tables the first column source node 1 To destinations. We don't care about sending one to one that doesn't that's not Relevant so from source one to two three four five and six the next node the two four four four four and Similar for the others the columns in this table correspond to the second column in the the tables on the next slide Different ways to store that information the distributed approach is much better for large networks It's easier to maintain that information and that's what's used in the internet and large networks today So that's the basics of fixed routing But we say it's fixed because we calculate the least cost paths Maybe when we build the network and then they remain the same while we use the network So we go away. We build the network today. We create the routing tables. We store the routing tables in the individual nodes When they want to send data, they just look at the routing table to see who to send to next Maybe if we added a new node Okay, we built the network and we decide in in two months time We need to add a new node and a new city then we could update the routing tables So when there are major changes in the network topology Adding a new lot node or link we may update so it's not fixed forever, but fixed for a reasonably long period of time now the problem with it being fixed is that as The network conditions change for example the link costs change if we don't update the routes We may start using suboptimal routes so We say that when the route is fixed for a long period of time I mean we can't respond when there are there are short-term changes in the network Maybe one link is big become congested There's a lot of data going through the link the delay goes up. Therefore. It's no longer the best path With fixed routing we don't care. We keep using it It makes it much simpler, but it means we may use the suboptimal path and get worse performance the third strategy which we were not say much more about other than say well Instead of keeping it fixed on a regular basis or in some update the routes Be adaptive change the routes as the traffic or the network conditions change and that's what's used today in the internet adaptive routing Fixed routing is very simple in that when we build the network We assign the routes and there's nothing to do after that with respect to routing But it's not very flexible when the network's running Changes in the amount of data going through the network May mean that there are better routes that we we didn't initially select so that's in it in Not very flexible and gives poor performance adaptive routing if we just jump through Before we go back to flooding Basically do the same use routing tables create them at the start, but then on a Update those routing tables as we use the network if we notice something changes the link cost changes then hopefully we can update the routes and Get new routing tables so that we still use the optimal routing the optimal route and This is what's used in the internet today and most new Large networks will use this fixed routing is only useful in small networks or networks where there are not many changes with adaptive routing we can improve the performance because If we always or try to always choose the best route It means we'll get the best performance with fixed routing if we stay with a suboptimal route We may get worse performance So that's the advantage of adaptive routing, but adaptive routing is more complex. We need some way to to collect the information About the current network status and recalculate the routes so the algorithms for doing it More complex more time-consuming and a key trade-off with adaptive routing is related to the quality of the information and the overhead and and It can be summarized as saying the more information we collect about the network and the more often we collect that information The more chance will choose the best route the more I know about the network and The more I get an update about the network the better chance I'll get the best best route through the network and that's a good thing but to collect that information and To continually update that information. There's some overhead involved We must send some extra packets to collect that information and that's a bad thing so More information is good for routing, but the more information we collect introduces a larger overhead So that's the key trade-off with adaptive routing. We want to keep the overhead low, but we want to Get as much information as possible and coming back to our our Driving to Bangkok example. I want to drive to Bangkok at 4 p.m. After the lecture Then to choose the best path what I'd really like to know is what is the the current traffic conditions at 4 p.m? I'd like to know every intersection across every possible path How many cars are there? What's the delay at every set of traffic lights if I knew that? Then I could calculate the best path But I need to know it at exactly 4 p.m Maybe someone told me at 3 p.m. Or before the lecture at 2 30 what the traffic conditions were but change between Now and when I want to go So I would need to go through more effort to collect that information The more information I collect the better chance. I'll choose the best path But the more effort required to collect that information That's the same trade-off we have here. So let's go back and We're just finished with one last example using these routing tables I think you know you have a quiz question where you need to create or fill in a routing table Not so hard. You just need to find the least cost paths and fill in the next node let me one one thing that we can do to one thing we often want to enlarge networks is to Simplify the routing table To make the amount of storage space we use as small as possible and when we need to update it We don't have to update much information We've already seen one simplification where we don't store the entire path. We just store the next node That makes it simpler But there's another one And you may notice in these six in some of them The same the next node is the same first for multiple destinations For node one if I want to send a note to I had the next node is to if I want to send to anyone else Three four five or six the next node is four so in fact in Practice we can summarize that information those nodes where the the destinations where the next node are the same instead of having Four rows we can cut it down to one row So I'll show you the concept of that sticking with our our network For the routing table for node one It is focusing on this table. Let's write it in a summary form where the again the source node is source is node one and We want we have two columns of interest the destination and the next node So we're going to create the same routing table as on the slide But we're going to make it a little bit simpler if the destination is node two The next node is node two. That's the same as the first row on the slide But If the destination is three or four or five or six then the next node is four Let's summarize that as saying if the destination is any other value And I'll write star here as some form of wild card Meaning anything else next node is four. There's our summary routing table for node one We just need two entries two rows in the routing table rather than the five that we have on the on the slide Where we introduce this Destination this special value this star means in my case any destination Assuming we look up the Destinations in order. Let's see how it's used. Let's first do it a complete the The routing tables for some of the other nodes for node Three for example, maybe node four. We're not do for all of them node four Destination Next Try and write the summary routing table for node four Also node five How can we summarize the routing table for node four? Have a look on the the one on the lecture slides and see what we can do to summarize it How many rows can we use for node four? If we can use a wild card one instance of a wild card Wild card here means any value Look at node four. What are the common next nodes? Which one occurs most Five next node five, so maybe we could use a wild card to mean any value that is give specific routes to those with the next to but a General route for those with the next note of five Node for we will say if we want to reach node one send it to if we want to reach node to Send it to if you want to reach anyone else. There are only five other five total destinations. So anyone else send to next node five and we in this In this summary form we can think that we would check the rows in order We'll check the destination in order. We'll do that via an example in a moment and First source node five we can summarize Well, we see that node next node four occurs the most So maybe we can say just destination three send a three six and a six anyone else send a four so we cut down on the number of rows and as our network grows this use of a wild card here summary form is much more powerful because If we have a network with a hundred thousand nodes If we have the full table, we'd need a hundred thousand rows in the table and we need to update them all the time But with the wild card or what sometimes we'll call a default route We can cut it down to just several rows Greatly simplifying the routing table. How do we use that? Let's say now we have a packet to send Here's our packet It has a header and some payload some data This is the header Inside the header It's created by node one. Let's say we want to send note from node one the source address is node one and The destination address is we want to send this data the payload to node six So node one has this packet What they do is since the routing tables have been created they look up the destination and in this Routing tables will do it in order and if it doesn't match we'll check the next row So the destination is six node six. It doesn't match the first row But it does match the second row because means any value here and six is any value So it matches the second row so that tells us that we can send It doesn't match that this destination, but it does match here Okay, any value therefore we send this packet on to node four node four will get the packet Looks at the destination. It needs to go to six So let's look the routing table. No destination is not one. It is not two. It's some other value Therefore we need to send to next node five So node four will send the packet to node five Destination doesn't change the destination is a final destination Not three. Ah, it matches here. It's six. So we'll send this packet on to node six If we started at node one Node six gets the packet The destination inside the header of the packet is node six So we realize ah, this is destined to me. Let's let's take the payload and process it We've finished. We've got the data to the destination so in summary we in both fixed and adaptive routing we create the routing tables and We separate the process of creating the routing tables and using the routing tables creating the routing tables is done usually in the background by routing protocols So to to put the data inside these tables to determine the least cost paths There are protocols that will do that in the background for us But to send the data across the path we call forwarding and That is done simply by looking up the tables so usually those processes of creating the tables or routing and Sending data using the tables forwarding Made distinct a separate and Here we see a case of forwarding and we see in a simplification of the routing table That is we don't have to list every possible destination. We can use some form of wildcard in Real networks. It may not be a star or wildcard, but there are other ways to represent Match multiple values not just a single destination Sometimes called a default route node one sends to Next node to if the destination is to by default it will send a node for final example on My computer. I'm connected by my Wi-Fi It turns out in the internet and we'll cover that in a later topic we have routing tables for Special devices in the network that the switches which will often refer to as routers But we also have routing tables for the end user computers the hosts like my laptop So my computer has a routing table And the command route will show me the routing table There are multiple columns in this table two rows that the top rows just the headers There are two rows of interest if we zoom in The two column the two first columns are the things that we may recognize or relate to the routing tables We've just seen We saw in the routing table. We'd have a column for the destination and a column for the next node The next switch or the next router or another name for that node is a gateway so here my software says The first column is the destination the second column is labeled gateway. That's the next node in my path and In the internet we use special addresses. We don't use n6 n1. We use IP addresses to identify those nodes So we see that one of the next nodes in the path has an IP address of 10 dot 10 dot 98 dot 1 so We also see in this case, which is outside of the scope of what we're talking about now We'll see you later in the networking IP Discussion that there are some special case addresses here all zeros in The destination and all zeros in the gateway or next node The 10 10 98 Dot 1 address identifies a particular next node in the net in the internet This all zeros address Really means there is no next node It means don't send it to another device send it direct to the destination You can send it without sending to a next node to get to the destination and we will see in the next topic Typically means the destination is on the same land as you you don't need to send to a new gateway so that's one special case and Where we use the star to represent any value here they represent the star using the all zeros address in the destination column and It's a more complex. It's not processed in order. That's a longest prefix match But the idea is if my computer wants to send to any computer With an IP address starting with ten dot ten dot ninety six Ten dot ten dot ninety six dot one ten dot ten dot ninety six dot two and so on Then the next node There is none That's what this tells us you can send direct because they're on the same land as you for anyone else That's what this value means for any other destination like 11 dot 12 dot 52 dot 64 That is not starting with ten ten ninety six For anyone else send to ten dot ten dot ninety eight dot one So that's a routing table for my laptop note that This allows me to communicate with anyone on the internet of the billions of devices on the internet I don't need one row for the billions of devices. I just need two rows in my routing table So this is where the simplification of using wild cards or values to match multiple destinations is very powerful This is sometimes referred to as my default gateway or default router Send everything unless it's going to these destinations send everything to ten ten ninety eight dot one We will return to IP addresses in the routing table in the topic on internet working Let's look at a different strategy completely different and we've mentioned it before with With the routing table with the least cost routing approach we need to collect information about the network to calculate the least cost routes But what if we don't want to collect anything? What if I want to send to a destination without knowing anything about the network? Then one approach or the approach is send to everyone That is I want to send to a destination six. I send a copy of that data to everyone I know of and tell them when they get the copy send to everyone they know of and They keep doing that until it gets to destination six. This is called flooding We flood the network with copies of the data With the hope that eventually the destination gets the copy So we'll go through some examples to explain how flooding works and some ways to to Make it perform a little bit better, and then we'll finish and come back to this and talk about the advantages and disadvantages The example we're going to use the same network as as what we've used Except so you'll notice the links are the same we still have six nodes But we don't care about the link costs and to make it simpler. We're not going to worry about the link direction So this is the same network as before but the link costs have been removed. You can follow on Follow along using the slide. I'm going to draw the picture again and make some changes Same network, maybe look different, but what are our nodes? This is node one two This is for There's no need for you to draw this because it's the same one is on the slide Just easier for me to show some of the concepts. We want to get data from node one to node six So that's our aim. We'll draw the packet again So we have a packet it has some header and some payload and the header We're going to send from node one to node six So we'll have a source address Source equals node one Destination is node six We may see later some other fields, but so far let's assume there's we know the source and destination we have one One piece of data to get to node six. That's our aim, but let's assume the nodes know nothing about the network Even though we can see that Node six is connected to three and five node one doesn't know that Node one simply knows it has three links It doesn't even who's at the other end those links. We're going to shoot So how do we get the data from node one to node six? well Send copies of that one packet to everyone that we're connected to So node one starts it has the data It's going to send a copy on the link that will go to three a copy on the link to two and a copy on the link to four So we'll send three copies of that one data packet So let's draw that and I'll not draw the packet you you see on your slide. There's a rectangle there I'll just denote. Okay. We send I'll just denote it as an arrow One will send a copy of the packet of three to two and to four and Think it happens at the same time. We've got data to send just send to everyone and Then when they receive that packet The rules are with flooding when you get the packet you look am I the destination? Okay, node four for example gets the packet is for the destination No, the header says six is the destination. So four must forward that packet on to others and The first rule send to everyone So node four takes a copy of the packet received and and duplicates it sends a copy to five three two and one All right, so that's the basics of flooding Two and three will do the same now There's some some optimizations we can make so that we don't waste Transmissions the first one will see is that when four receives on this link The destination is six. I've just received a copy on this link. There's no need to send a copy back there We know that node has a copy and Since they sent it to us. They must not be node six So there's no need to send it back to the one that just sent it to you So we'll not do that. That would be a waste So what four will do is send a copy to two three and five So we'll draw them. It sends copies of the packet to five three and two But also node two received a copy from one so node twos are the same No, two is going to send a copy to four and to three but not back to one because we just got it from one Now here's some details about the timing may come into play here Should two send a copy to four when four is sending a copy to two it may depend upon the timing which one sent first Which may depend on how long it took for the packet to get from one to four and two But in this simple example, I'll assume everything happens in in phases That is in the first phase one sends to its neighbors in The second phase those neighbors who received the copy all send at the same time to their neighbors So four is going to send to two and at the same time two is going to send to four Assuming this link is full duplex. We can send in the opposite directions at the same time So I would take note that node two also sends copies to Two and three there's no need to send back to one and Finally three is going to send copies to two four Five and six but not back to one That's the second Phase in this flooding protocol. What happens in the next phase? What's our aim? What are we trying to do here? What are we trying to communicate? From who to who the packet wants to go from node one to node six. We've got some one piece of data to get to node six That's our aim What have we done so far first node one sends to its three neighbors and then the next phase those three neighbors send to their neighbors But not back to who just sent them and the next phase note that node six is going to receive that data Some other things will happen, but node six will receive a copy of the packet from three the packet inside the header contains The destination of six when six receives this it goes okay. I'm the destination. This is for me. I've got the data. We're done Or we've achieved our aim of getting the data from node one to node six So note after three sends to its neighbors then six gets the data and we've finished in delivering the data but We may not be finished in transmitting packets in the network Consider node five and let's consider first the packet it receives from four Note five gets a packet from four destination is six node five does not know that six has the data Okay, it doesn't know what's happening at six So node five receives a packet from four and realizes okay. I must send this To my neighbors so five will send for this one received from four we'll send a copy to three and a six That's for the packet five received from four it makes a copy and sends to three and six but also Node five is going to receive a packet from three Right think at the same time it gets one from four and from three and at this stage There's no way for five to know is this packet that it gets from three the same as the one that it got from four The source is the same the destination is the same the payload is the same Doesn't mean it's a duplicate or doesn't mean it's just the payload has been sent twice by node one So there's no way for five to distinguish whether the packet from three is the same as that from four Therefore five should send again To neighbors that is it received from four sent to three and six Also received from three so sends a copy of that to four and six We'll see there's an alternative in a moment, but let's go through the the dumb approach first When it receives from three five also sends a copy to four and six So actually sends two packets to six they're actually the same ones, but it doesn't know that are we finished well Not quite It gets complex look at node two No two is going to receive a copy from three and from four When it receives from three It's going to send a copy to four and one When it receives from four, it's going to send a copy to one and three. It's other neighbors node four is going to receive from two and three and send a one Five and two when it receives from two, it's going to send a one five and three No three is going to receive received packets from four and two sending back to one to six to five Four and two That's the third phase in this protocol and then in the next phase So all those that receive packets will get copies and send again to all of their neighbors And you can see quickly that the number of packets being sent growing rapidly Okay, it's even hard. I may have made mistakes and missed some here so Some issues here We don't want to have to send too many packets through the network just to get data from node one to note six So far, how many have we sent can someone count them? How many green lines do I have? I think it's the same as the third picture on your Oh that if you sum up on your three slides all the packets sent how many do we get? Anyone can count all the green ones on mine or on your three slides all of the little rectangles What do you get? 34 or something I've counted before okay Should be around 30 should be 34. I think in the slides you consider all three slides and count those rectangles That is in this approach to send data to send one piece of payload from Node one to node six that was our aim The first approach of flooding We've sent 34 packets in the network Using this flooding approach so far we've sent 34 if we had another round there'd be many more. I cannot draw them all We'll see that We need to stop at some point and We'd like to reduce the number of packets. We've sent how can we stop? that is We went through three rounds How can we force the nodes to know well stop sending? We need to stop at some point That is Node five is going to receive many packets from three and four again, and then it's going to send it neighbors How can we stop fire from sending to its neighbors so we can not go forever? Well, we can introduce some form of counter and say okay if the packet has traveled maybe so many Has been sent so many times then stop sending it And if you look at your slides, you see that there's a number included on those packets We call it the hop limit or hop counter in this example When we send the first packet we include a another field in the header saying this is the hop limit and in this example we set it to three and The meaning of the hop limit of three means that this packet is only allowed to traverse three hops After which we will not send it again So the way that it works Node one sends a copies to its neighbors and inside the header There's a hop limit of three and add that to our header We'd include when we generate the packet the hop limit. I'll just write hop of three and The idea is when we send it to someone they will decrement that hop counter So in this case no one sends to its three neighbors when two three and four get that They decrease it by one so it goes down to two and the rule is if it's more than zero Send it if it's zero don't send it discard that packet So when node four received the packet from one the hop limit was three It decreases down to two and now took node four sends copies to its neighbors same as two and three When in the next phase the nodes receive Node five received copies and sent with a hop limit of one in the header It decremented when it received two down to one sends copies to everyone in the next phase for example Node five is going to receive a copy from four and from three. It's going to receive four packets But whenever it receives each of those it decrements it down to zero. Ah, it's zero. Do not send throw it away This packet has reached its maximum lifetime. It's a measure of how long this packet can be sent through the network And that's a key Feature in many protocols to limit the number of hops that packet can traverse After which we kill that packet it dies We remove it from the network. So that's one way to stop set a hop limit Otherwise these packets will be sent forever by everyone So let's assume we use the hop limit of three when we had a hop limit of three We counted 34 packets What if we did it again, but had a hop limit of two a second case? How many packets? That is the original packet sent by one starter with a hop limit of two Quite easy to see on the slides Instead of starting as three here. This value would be two. So we'd have three packets sent When those neighbors see if they would all send to their neighbors the same way as this but instead of the number being inside Two it'd be one so have another what do we have? nine packets so a total of 12 packets so far sent us round nine here and Then remember it's one not two when a node receives it it decrements down to zero and does not send So it would only be 12 packets sent if we started with a hop limit of two Remember that both of them are delivering the same amount of payload to the destination But the first approach uses a transmission of 34 packets in the network The second approach just uses 12 the first approach is much worse than the second one To get the same amount of data to the destination in the first approach with a hop limit of three We must send much more through the network. So that's very inefficient Reducing the hop limit increases our efficiency to get the same data to the destination less packets What if we set the hop limit as one? How many packets? hop limit Count the packets Someone everyone yell it out at the same time. How many packets if we had a hop limit of one Look at the first diagram on your slides Count count count the rectangles on that first diagram. No, not six Look at the picture. Don't guess. We'll be here forever three That is a hop limit of one means When source node one sends the further packet for the first time to his neighbors It sets the hop limit in the header to be one not three but one When two three and four receive it They get the packet Decrement to zero therefore do not send So only three packets transmitted. That's even better for efficiency So the third approach a hop limit of one is better. We send less through the network But what's the problem with the third approach with the What happened in approach three what went wrong? Node six didn't get the data Remember the aim to get the payload from node one to node six if we have a hop limit of one The data only gets to two and three and four It doesn't get to node six So less packets, but we didn't achieve our aim. So that one failed Hop limit of two the data does get to the destination a hop limit of three it gets to the destination So they were okay That is We want the hop limit to be high enough such that the data gets to the destination But low enough such that we don't have to send too many packets In this case the optimal hop limit is two If we go less we won't get the data of the destination if we go more we'll send more packets But in general we may not know how many hops to the destination So it's difficult to choose the optimal hop limit We may must we must make it quite large. Let's Let's consider some some further optimizations. So rather than having to send all these packets. Can we do even better? Let's introduce a sequence number in our packets One of the problems we had was that node two for example Received a packet from four and three and then sent on to its neighbors But node two has already Received this packet before there should be no reason to send it again to your neighbors You should only send it once to your neighbors and the way to identify whether the packet is The same as before is to include a sequence number in that packet header So that node two can identify. Ah, this packet is the same as before. Let's ignore it So we introduce a sequence number sent or set by the source if we draw the the packet now sequence number seq sure for sequence and we can set it any value initially. Let's say it's a hundred and forty six I just choose a random number The idea though is that when node one sends this packet with sequence number 46 Every copy of that packet also has sequence number 46 When you copy the packet you copy everything except the hop counter you decrement that So when node one sends to two two makes a copy and the sequence number is also 46 When three gets it the sequence number is also 46 Two is going to send to its neighbors at the same time three sends to its neighbors Which two receives a second time that packet And the way that two knows it's the same packet is it realizes I've received a packet with sequence number 46 from one Now I've just received a packet with sequence number 46 from three It's the same one as before. Let's discard the second one. Let's not send on to our neighbors So Introducing the sequence number is a way to again reduce the number of packets sent in the network When node one wants to send new data to node six something different it would change the sequence number increment it usually So Maybe we will not draw it I'll let you count how many packets sent if we use now a sequence number and a hop limit A fourth case How many packets would be sent? If we had a hop limit of three the original one And we also use sequence numbers So hop limit of three Even though we know in this case two is optimal often We will not know what the best one is if we set it to three, but we included sequence numbers How many packets would have been sent? Well, these three are sent so the first three are sent Those nine would be sent Okay, we haven't Once a node receives a copy of the packet and then it sends to its neighbors Which in this case one sent to its neighbors So one is done. It's sent to a neighbors in this case two is sent to its neighbors Three is sending to its neighbors four to its neighbors. They would be sent in the next case note that for example Two is going to receive from four and three Because of the sequence number when it two receives them it will discard them because they're the same as before So in the next phase Five will receive and send one copy to six But there's no need to send back to three and four Two when it receives from three will not send any packets So this picture If we imagine four doesn't send anything Three doesn't send anything two doesn't send anything five only sends a copy to six because Four has already sent copies to its neighbors. There's no need to send again and the sequence number allows it to determine that Four has sent to its neighbors. So when it receives it will not send to its neighbors in this phase So delete these six from four remove the four from two Remove all the ones that three sends And from node five's perspective It received from four and three But it's the same packet So there's no need to send back to three. There's no need to send a four There's no need to send two to node six only send one to node six So what do we have before we had 34 minus these six is 28 minus these four 24 minus the eight from node three is down to 16 And minus three from node five 13 packets With sequence numbers we can reduce that down to just 13 packets And the hop limit is third is three in this case Almost the same as setting the hop limit of two Without the sequence numbers with flooding our aim is to get the data from source to destination And we did that with three of these four cases With a hop limit of one it didn't work. So that's no good And the other aim is to send as few packets as possible when we get that data to the destination And to do that we have these features of use a hop limit And use sequence numbers so we don't resend the same packet multiple times And to get the data from One to six we With a hop limit of two we can get 12 packets with a hop limit of three and sequence numbers 13 packets about the same So that all with flooding But with different variations Flood the network What if we consider one other case? What if we use least cost routing? We actually created the routing tables in advance Ignoring the overhead of creating the routing tables If we did know the least cost Route from source to destination and the cost we define as hops That is we send the packet across the least hop route How many packets do we need to transmit to get data from one to six? So not using flooding but using our original routing approach if we had the routing tables already created And we wanted to get data from one to six We'd need to send two packets Because the least hop route from one to six is one via three to six We transmit a packet from one to three Then from three on to six So the best we can do is send two packets That's if we didn't use flooding With flooding the best we could do that got data to the destination was 12 packets in our case Worse if we had different parameter values So we can now compare With flooding the overhead to get the same amount of data to the destination is much much higher than least cost routing Least cost routing To send the data doesn't take much effort But with flooding we need to send many different packets through the network and that's wasteful So that's the major disadvantage of flooding The major advantage of flooding it's very easy There's no creating routing tables. There's no Dijkstra's algorithm. Don't have to discover the link costs We just send to our neighbors With a few exceptions about the sequence number and hop limit We send to our neighbors they send it on And we get to the data the data to the destination We note that if we set the hop limit too low The data won't get to the destination. So there's a problem If we set it to be high we may have to send many packets through the network as a trade-off A good thing about flooding another advantage When we send a packet assuming the hop limit is large enough when we flood a packet through the network That packet or copies of the packet will take every possible path Okay, if we have a no hop limit A packet will traverse every possible path including the least hop path There will be a packet that goes from one to three to six So in fact we can use flooding to discover what is the least hop path If we don't know in advance we could flood a packet through the network And the nodes along the way record the path that it takes When it gets to six six the first packet it receives Says inside the header this packet was from one to three to six Six now knows the least hop hop path From one to six and reverse and it can send a response back saying to one in the future Don't flood just send from one three six Send through the least hop path so we can use flooding to learn about the network topology The other nice thing about flooding is that everyone receives a copy of the data If I want to send data not just to node six, but I want to send data to everyone Then flooding works quite well Let's say I want to send a message about the status of the network I want to tell every other node what my link costs are Then using flooding I can put my link costs inside a packet Flood it through the network everyone receives a copy now everyone knows my link costs Every other node does the same thing Floods through the network copies of their link costs As a result every node learns the link costs of the entire network And now can calculate the least cost routes through the network So flooding is very useful for learning information about the network And that's what it's used for in practice It's not usually used for delivering data just for learning information about the network topology So the extensions I think we've gone through We don't send back to who just sent us a packet We can use sequence numbers. So we only forward the packet once We don't have to send when there's duplicates again using sequence numbers We can use a hop limit or hop counter When it gets down to zero don't send it on Another optimization is selective flooding In our flooding we send to all of our neighbors Selective flooding if I have three neighbors, maybe I randomly select two to send to the other one I don't send to Again to cut down on the packet sent Or instead of random today or this time I choose the first two the next time I choose the second two and so on I can rotate Or choose the neighbors based upon Maybe some characteristics choose this one with higher probability than another That's selective flooding in that we select A subset of the neighbors to send via Selective flooding reduces the number of packets sent but We may not get our packet to go get to the destination and it may not take The best path through the network. So there's some trade-offs with selective flooding So let's summarize flooding send to everyone in the network with a few exceptions The good things All possible routes are tried when we use flooding Packets take every possible route including the least hop route So that can be used to learn the least hop route All nodes are visited everyone gets a copy of the data So that can be used for distributing information to everyone Like information about the network status And it's simple There's not much that the nodes need to do. I get a packet. I send to everyone get a packet Check the hop limit sequence number send to everyone The problem the key problem. It's very inefficient as the network grows Then the number of packets that we send to get one piece of data from source to destination Is is very high If we use the wrong hop limit or selective flooding, we may not reach the destination. That's another issue I think that's enough about routing. So let's Let's finish on this topic on routing and even the previous topic on switching will summarize There's a few slides on routing protocols and algorithms. That is We've just talked about general approaches In practice, there are different protocols that Use these approaches and there are many Some of them are listed here OSPF rip bgp and others We will not cover them and we'll not look at the details of these protocols in if you take One of the courses next semester if you get through this course You'll learn about some of these specific protocols some more details about routing So let's summarize on switching and routing Some of the concepts we've learned from this topic and the previous topic We're now talking about communication networks built from Connecting devices across multiple links not just a single link And to deliver the data via these intermediate devices we use the concept called switching Where the switching node chooses the output link to send the data via And we introduce circuit and packet switching as two different approaches Circuit switching used in telephone networks packet switching is a key part of the internet today Routing is the The the step of choosing the best path What we've covered on in this topic choosing the path from source to destination And we've talked about different metrics Like delay throughput financial cost for defining best different criteria Today we've mentioned some different strategies in general. There's Fixed and adaptive routing where we find the least cost routes store them in routing tables The difference between fixed and adaptive is fixed. We We basically have static routes in adaptive will continually update the routes And we've seen the other strategy of flooding Completely different from the routing table based approach, but has advantages There are also algorithms for select choosing the best path like Dijkstra's algorithm and so on And specific protocols that implement these strategies Which we haven't talked about Circuit switching was built for telephone networks and it's still used in those today But it's not used for new networks so much Packet switching was developed to be more efficient when we have a varying amount of data to be sent Especially data generated by computers not voice data But application data web browsing email and so on And packet switching is the key concept used in the internet And all new almost all new large networks built what we call wide area networks Our next topic will define wide area networks Adaptive routing strategies are usually used in large networks as well Where networks change a lot? We use adaptive routing routing tables created and packets are sent via the path There are different algorithms for calculating shortest path Some key trade-offs That the things that determine what is the best routing approach Which routing protocol to use will depend upon how big the network is How much data goes through the network how much traffic and how often that network changes So there's no one best solution What we'll look at in the next topic we'll talk about what is a wide area network And what is a local area network And talk some aspects of those lands and wands And then after that we'll look at the internet and the structure of the internet to close the course