 We know routing is about finding a path to deliver our data from source to destination. We used an example network and we said what we want to do is find from a source to a destination, find the least cost paths or the least cost routes because when we send our data, when we send our data we want the data to travel across the path which costs us the least amount. So with fixed routing and also with adaptive routing what we do is somehow we need to learn about the network and then from that network information calculate the least cost paths. The least cost paths are then stored in routing tables. The paths that you created and our example we for example this was a case with distributed routing tables of six routing tables for each node and the way that we read the routing tables is that if node 4 has a packet to send to destination 3 then the next node to send to is 5. So this is relevant for both fixed and adaptive routing. The difference between the two is fixed routings we just discover the paths at the start. Adaptive routing we continually recalculate the least cost paths. As the network operates we get updates of what are the new link costs are their new nodes new links in the network and when the changes occur we recalculate the paths and update our routing tables. And a routing protocol does that for us. So you find a device a node in the network like a wireless router or a router for a campus and that may be running a routing protocol that is continuously trying to learn about the network topology learn about the link costs and continually calculating and updating the routing tables. So the process of updating the routing tables is part of the routing protocol. The process of sending data is called forwarding where we have data and we just look up based upon the destination address look in the table to know who to send it to who to forward to. So first well we do routing to create the routing tables and deliver the data using forwarding using the routing tables. But we then we come to a different case flooding and that's what we finish with in the last lecture and we went through some examples let's just summarize flooding is a very simple approach for delivering data there's no separation between routing and forwarding there is no routing table it's very simple in that what we do is we have data to send to a node send it to everyone of course if we send that data to everyone a copy to everyone then our destination node should receive a copy. So instead of choosing the route first just send the data immediately but don't just send it across one path send it across all possible paths a copy of the original packet is sent to the neighbors of the source so the source sends to its neighbors those that receive it then send on to their neighbors they forward a copy of the packet to its neighbors and at the end the destination should get a copy it's very simple there's no need for running a separate routing protocol no need to calculate least cost paths no need to know about the network topology in advance you just need to know who your neighbors are which every node knows anyway so there's no discovery of the network topology information needed to send so very simple another benefit of flooding is that when you send copies of the packets at least one copy will take well all possible paths will be traversed at least one packet will take the minimum hop route for example we went through the case where we send to three of our neighbors and then three sends to its neighbors to its neighbors and so on one copy of our packet from one destination six takes the minimum hop path in this case the minimum hop path is one to three to six one sends to three three send a six six receives the data so it's useful if we want to send data across the minimum hop path maybe not the minimum cost path but the minimum number of hops especially we want to find the minimum hop path to some node of course other other copies of that same packet would take longer hop paths one copy went one three six another copy went one four five six another advantage of flooding is that we get the data to every node in the network so although we said we wanted to deliver the destiny to destination six actually a copy of that data got to all nodes in our example so that's useful if we don't want to deliver to just one destination but to deliver to every node maybe you want to send a message to everyone in the network to update them about the status of your links then use flooding just send to all your neighbors they now have a copy they send to their neighbors so they have a copy and eventually everyone gets a copy of that data so it's very useful for distributing information to everyone especially distributing information about the network status the costs and so on but it's very inefficient to get one data packet from node one to node six in our example we needed to send many data packets in in the network that's where we say it's very inefficient we could count them in in this example how many transmissions are there in the network well node one sends three packets so that's three so far then nodes two three and four the neighbors send some packets what another four plus two plus three so 12 packets so far transmitted in the network nine here plus the original three and then in the next round then we have all these others and you count them as what 12 18 22 26 34 packets transmitted in this simple case just to get one packet from node one to node six so 34 transmissions in the network to get one data packet from node one to node six if we use least cost routing or we routed across say the minimum number of hops instead of flooding how many packets need to be transmitted if we didn't use flooding but we knew to send the packet from one to six across the path with the least number of hops how many transmissions to get data from one to six what's the least hop path from one to six one three six so if we knew that path in advance then we could just send a packet one to three there's one transmission three to six to transmission so if we had routing happening in advance to send the data just two transmissions but with flooding we have 34 transmissions to get the same amount of data to the destination that's why we say flooding is very inefficient because we'd like to use those so we'd like to know another way to think of it if we send the data from one to three to six the transmissions from one to four one to two are wasteful they weren't needed to get the data to six so inefficient is the main disadvantage of flooding and it's not used except well it's not used commonly in large networks except for special purposes like distributing information to everyone if we need to do that then flooding is appropriate but if we want to deliver data from one node to one other node flooding is very inefficient in large networks we should first discover the the least cost path first now the rules and we'll come back to one more disadvantage so that the rules were send your neighbors and the neighbors send to their neighbors but there are a few extensions or exceptions there don't send back to the node that just sent you the packet if I send to my neighbors they're not going to send back to me because the idea is to get this data to the destination if I just sent it to them they know I have a copy and there's no need for them to send it back to me so we saw that one sends to two three and four in the next phase two does not send back to one there's no need in that case that's the basic rule but we can make it even better by introducing sequence numbers so we can distinguish which packets are original and which packets are copies or duplicates and so if we include sequence numbers then we can add these other rule two and three to say only forward the packet once if you've received the packet before no need to send to your neighbors again if you receive a packet which is the same from two different nodes then you only need to retransmit one copy onto your neighbors those two rules two and three were not used in this example because you see that what two sends to three and four which is okay but then in the next step so if we focus say on node two it's going to receive a packet from three and it's going to receive the packet from four if we do not have a sequence number then what it does is when it receives those two packets it sends copies to its neighbors except who sent it to it but if we did have sequence numbers when two receives the packet from three it realizes are I've already got this one before I've already sent it to my neighbors no need to do it again similar when it receives a packet from so from three and from four it doesn't send on to its neighbors because it's already sent to its neighbors the goal is to send one copy of the packet to your neighbors there's no need to resend and that cuts down on the number of transmissions which is a good thing so sequence numbers are commonly used another feature that we saw is a hop limit the idea is when we send a packet we want a limit how many times it's transmitted through the network how many hops it will traverse so the hop limit is a like a hop counter and this example included the hop limit or the hop counter inside the packet inside the packet header so the number three says that node one wants this packet to go no more than three hops and how it works is we transmit the packet to our neighbors when then they receive the packet they reduce the hop counter down to two and then send it on to their neighbors so two three and four send on to their neighbors but now the hop counter inside the packet or the hop limit is two next step the nodes receive decrease it to one and transmit it on to their neighbors so that's the next step many transmissions there the next step when you receive say node four is going to receive copies from three five and two it decreases the hop limit to zero and at that point says let's discard the packet no no need to send it any any further because it's reached the hop limit of three hops so once it gets to zero don't send any more packets and that's why there's no next step in this case because no node after this stage is going to send packets further and you see that with a hop limit of three the packet will traverse at most three hops if the hop limit was one and instead of three in this example what would happen if when node one sends the original packet it chooses the hop limit if it instead shows a hop limit of one what would happen well no we still have a destination node six I want to get the data to six I don't know where six is remember in this case even though we can see six is over here node one is just connected to three other nodes it doesn't know where six is node one so it sets the hop limit initially to one what happens it stops where's it stop two three and four all right so node one will send to its neighbors they'll receive a copy two three and four I receive a copy hop limit is currently one decrement to zero okay do not send it any further the result would be six doesn't receive the data so that's a bad scenario because the hop limit is too small meaning that in this case node six is it is two hops away from one so hop limit of one means that six won't get the data and have been ineffective in our data delivery so the hop limit should be large enough to allow the data to get that it to the destination and small enough such that it doesn't keep getting transmitted by other nodes in the network so if we set the hop limit to four even though it will get to six the nodes will keep transmitting more times in this case the ideal hop limit would be two but in practice node one which sets the original hop limit doesn't know how many hops to node six so it needs to choose or estimate some value the hop limit is commonly used in protocols especially when there are errors that is if we have some scenario where something goes wrong and four sends a copy to five five sends back to four and they keep sending back to each other without a hop limit they'd keep doing that forever so if there's some error in the configuration of the network where they keep sending to each other back and forth with no hop limit that would keep happening with a hop limit eventually one would stop that's used in some protocols so our example considered the case with no sequence numbers but with a hop limit of three and we had another example where we introduced a sequence number same scenario but we saw that if we had a sequence number there'll be less transmissions node four once it's transmitted to its neighbors once it will no longer transmit to its neighbors again so normally that hop limit the sequence number as well as the source and destination addresses are included in the header of the packet so flooding very simple gets data to everyone but very inefficient because many many transmissions to get the data from one to one node to another a variation of flooding is called selective flooding the flooding we went through is like full flooding we send to everyone selective flooding is instead of send to all of your neighbors select some of them to send to and there are different ways to select could be random round robin probability based just quickly for example in this case node one sends to all three neighbors selective flooding could be okay node one has a packet let's randomly select two of my three neighbors to send to in the first case okay I select two and four send to them they randomly select some of their neighbors to send to maybe the next time we have data to send we do it again and we may send it to different nodes so this cuts down on the transmissions but it means that not everyone gets a copy and maybe our packet will not get to the destination it can be random selection maybe round robin which means we take in turns send to two and three in the first instance the next time I have a packet to send send to four and two and the next case send to three and four and just keep swapping between the neighbors we use so there are extensions that we will not go into any further flooding in large network is mainly used now to distribute information to everyone in those cases we want to tell everyone something flooding can be used but to get from one node to one other node it's very inefficient you can try some other cases what if the hop limit was to I think you work out and other conditions with flooding any questions on flooding send to everyone so that finishes our topic on routing let's just head to the end so adaptive routing is what's used in the internet we have some routing protocol that finds the path updates the routing tables it adaptive routing means that we continually update those routing tables meaning we'll always or more more times will choose the best part if we don't update we may use a suboptimal part but it can be complex complex algorithms needed to select the best path and in all cases this is maybe an important point there's a trade-off when we do routing in terms of the quality of the information and the overhead the overhead is how many packets do we need to send through the network to get the data from source to destination we want it to be low fewer transmissions quality is about the information we know about the network in order to select the best path we want more information so that we have a better chance of choosing the best part the more information required to choose the route and the more often you update that information then the more overhead so the overhead is bad but the more information you you gather and the more often you updated the and it's not written here the the more chance that you'll choose the best route there are a few side effects there that if if we update very often or too often it may mean that we oscillate or have instability in switch switching between paths if we update too slowly then we may choose a path which is not the best part we use information which is irrelevant so routing protocols need to make the trade-off there there's an example there which will not go through let's just summarize and this is a summary not just on routing but also on the previous topic of circuit and packet switching so about networks in general communication networks formed by connecting devices across multiple links so no no longer we're dealing with just a single link but using multiple links to get data from one node to another switching is the process of delivering the data across a network we went through circuit and packet switching packet switching is what's used in most data communication networks today and was what we will focus on routing is determining the path to take and we've mentioned some different metrics like financial cost delay throughput number of hops and we've gone through strategies like flooding is one adaptive and fixed routing at our others but there are also different algorithms like Bellman Ford Dykstra algorithm and many different protocols that implement those algorithms and strategies which we haven't mentioned in practice circuit switching mainly developed for telephone networks and still used in telephone networks and some other networks today packet switching developed to be more efficient when we have computer generated data not people talking on the phone but people sending requests for web pages sending emails and so on and packet switching is the concept used in the internet and most new networks built today in large networks adaptive routing is needed because things change on a regular basis in large networks so you need to adapt to keep up to those changes dykstra and Bellman Ford at the two most common algorithms for determining the shortest or the least cost path and that the trade-offs for different routing protocols which is the best routing protocol which is the approach to use depends upon how big the network is is at six nodes like in our example or 600 nodes how much data is being sent through the network is it just the data from three or four people or is it the data from millions of people being sent through the network and how often does the network change if I build a network across Bangkok and it has six nodes and it's has six nodes for the next 12 months versus I build a network and every day there's a new node being added to that network so that those factors impact on which routing approach should be used there's no one best solution there and that finishes on these topics of switching and routing and we'll now move on to individual networks lands and wands but any questions on routing before we move on to your next set of lecture notes