Presentation is loading. Please wait.

Presentation is loading. Please wait.

Routing We first need to know what is a route… Come on we all know what is a route!!! A path that leads us to our destination is known as a route. Just.

Similar presentations


Presentation on theme: "Routing We first need to know what is a route… Come on we all know what is a route!!! A path that leads us to our destination is known as a route. Just."— Presentation transcript:

1 Routing We first need to know what is a route… Come on we all know what is a route!!! A path that leads us to our destination is known as a route. Just think Mac needs to go to his school. If does not know how will he find out the route? He will ask somebody isn't it? Lets say he has police men to ask at some crossings who know about some of the places near them and other policemen standing at other crossings. The next slide displays such a situation. The arrows indicate the places and policemen, a policeman knows. Lets see how Mac finds out the route to his school!!!

2 I want to go to school This way R2 = 2 stops R3 = 3 stops so I will send him via R2 I want to go to school I dont know any one other than R4 I will send him via R4 Go this way Where is my school There you are This block Geeeeee… !!!! I am here!!! R1 R2 R4 R3 R5 R6

3 So, we can see that Mac has ultimately found out the route!!! We can also see that a path has been established from Macs starting place to his school. Now let us figure out the various components involved in this model. Mac – Analogous to Data Packet Blocks – Analogous to Distinct Networks Police Men – Analogous to routers.

4 Now we can explain Router – Router is a device that connects different networks and also finds the minimum cost path between them. The fact is that a router never finds out the full path. Doing this is practically not possible. It just redirects the data packet to the next router (also referred to as next hop) on the shortest path. We will now try to learn how.

5 What is meant by shortest path ? Well, the path from one point to another is logically weighted according to the distance. The weight is called metric. Metric is calculated on the basis of a number of factors. For instance – Number of Hops – Number of routers the data will have to pass through. Time required – The total time delay of the path. Cost – The path taken may cost some units at every router.

6 So how do we estimate the metric? To estimate the metric and find out the shortest path on that basis, some standardized algorithms may be used. Before this we must understand a mathematical model representing a network.

7 Lets first define a network A network (also called a graph) can be defined by two sets – A set of nodes (or vertices – machines) V. A set of connections (Edges or links) E. An edge may be defined by a pair of vertices. Thus for an edge to exist at least two vertices must exist in V. If number of vertices is n then the maximum no. of edges is n C 2. V1 V2 V4 V3 E4 E5 E1 E3 E2 Thus the sets E and V may be defined as – V = {V1, V2, V3, V4} E = { (v1,v2), (v1,v3), (v1,v4), (v2,v3), (v3,v4) }

8 Other definitions Directed Graph (or Digraph) – When the elements of E are ordered pairs then we call the graph a directed graph. This means, that while traversing through the edge, we can take only a fixed direction, as implied by arrows. V1 V2 V4 V3 E4 E5 E1 E3 E2 Thus the sets E and V may be defined as – V = {V1, V2, V3, V4} E = { (v1,v2), (v3, v1), (v1,v4), (v2,v3), (v4, v3) }

9 Weighted Graph – This is a kind of graph where the element of E are triples with two vertices and a number representing the weight (cost) of the edge. V1 V2 V4 V3 E1, 2 Thus the sets E and V may be defined as – V = {V1, V2, V3, V4} E = { (v1,v2, 2), (v3, v1, 5), (v1,v4, 1), (v2,v3, 4), (v4, v3, 2) } E4, 4 E2, 5 E3, 1 E5, 2 Path – This is a part of the graph connecting two distinct vertices and has no loops. More fundoo – It consists of subsets of V and E where each element of V is associated with some E. V1 V2 V4 V3 E4 E5 E1 E3 E2 The highlighted part is a path from V2 to V4

10 Tree – This is a graph or sub-graph where there exists maximum one path between two nodes. This simply means that there is no loop in the graph. V1 V2 V4 V3 E1, 2 The highlighted portion is a tree E4, 4 E2, 5 E3, 1 E5, 2 Spanning Tree – A tree that covers all the vertices of the graph or network is called a spanning tree. V1 V2 V4 V3 E4 E5 E1 E3 E2 The highlighted part is a spanning tree

11 Algorithms to find the shortest path between two nodes. Dijkstras Algorithm The algorithm works as follows: 1. Label the start vertex's final value as 0 (as it is the origin), and label it Update the working values (if they have no working value yet, or if the new working value is lower) of all the vertices that can be reached directly from the last vertex labelled. 3. Choose the unlabelled vertex with the smallest working value, and record its working value as its final value and record its order of labellling. 4. Repeat steps 2 and 3 until the destination vertex is labelled. The working value for the destination vertex is its best working value. The shortest route can now be found by tracking back: If vertex a lies on the route, then vertex b is the previous vertex if the label at a - label at b =weight of edge ab

12 Example of using Dijkstra's algorithm to get from A to C: This is the graph given Step 1 – Label the start vertex's final value as 0 (as it is the origin), and label it 1.

13 Step 2 – Update the working values of B,E and D. Step 3 – Choose the vertex with the lowest working value (B), and record its working value as its final value and the order in which it was labelled

14 Step 4 Update all working values 5 Label the smallest working value vertex with no label (E),final value=working value.

15 Step 6 – Update working values (no change) Step 7 – Choose smallest working value (D), label. Step 8 – Update working values (No change) Step 9 – Choose and label smallest working value, unlabelled, vertex. It is C, so C's final working value is To find the path: 7-5=2 and 7-1=6 so the path can either be ADC or ABC (it doesn't matter which we choose).

16 There are a number of similar algorithms for finding the shortest path. There is another called Floyds Algorithm in which we use a matrix formation to find out the shortest paths, but right now let us concentrate on basics. So how does the router take advantage of these algorithms? The routers actually communicate with their neighbours to create a table called routing table This is how a routing table looks like. DestinationGateway Flags Ref Use Interface UH lo0 default UG U le UG UG UG UG

17 If we look at the above table closely, we will find that it has the next hop information. For instance if some packet is destined for the network then it will be sent to the gateway The rest of the headache is to be taken by the later. A question may be asked over here that how was this routing table generated?. The routers have communicated the costs of connecting to their neighbours to all the other routers. Then the routers have used some or other shortest path algorithms to determine the routing table for itself. This communication may be done only once (The first time they are connected – Static Routing), Periodically (At fixed time intervals - Dynamic) or in Triggered manner (Whenever there is some change in the network – new router is added or an existing one is removed etc. - Triggered). Table updating can also be done manually in some routers. However in a vast network like the internet, we would like automatic configurations.

18 Are there any standard methods for communication between routers? Yes, of course there are!!! The simplest method is Flooding – A router sends a copy of its table to its neighbours. These neighbours update the table accordingly and send it to their neighbours and this way, all the routers in the network share their data. However this leads in congestion in the network and leads to multiple copies of the same data reaching on place. To avoid this problem, occurring on a periodic basis, triggered updating schemes are used. Moreover time stamps are attached with these packets so that old or already received packets can be rejected.

19 There are many protocols that define rules for the communication between routers. E.g. RIP, BGP etc. Two important definitions - 1.Routing Protocols – The protocols that govern how the routing should be managed 2.Routed Protocols – The protocols that govern the data flow.


Download ppt "Routing We first need to know what is a route… Come on we all know what is a route!!! A path that leads us to our destination is known as a route. Just."

Similar presentations


Ads by Google