Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Routing table and routing algorithms


Published on

Published in: Education, Technology
  • Login to see the comments

Routing table and routing algorithms

  1. 1. Routing table and routing algorithms
  2. 2. Route Maintenance and lookup <ul><li>Routing table is divided into two groups </li></ul><ul><ul><li>Procedures used to determine the correct rout for a datagram </li></ul></ul><ul><ul><li>Procedure used to add , change or delete routes </li></ul></ul><ul><li>The main data structure for storing the routes is an array </li></ul><ul><li>Each entry in the array corresponds to a bucket </li></ul><ul><ul><ul><li>Contains pointers to a linked list of records for a route to destination </li></ul></ul></ul><ul><ul><li>Each record on the list contains </li></ul></ul><ul><ul><ul><li>Destination IP address </li></ul></ul></ul><ul><ul><ul><li>Subnet mask </li></ul></ul></ul><ul><ul><ul><li>Next-hop address </li></ul></ul></ul><ul><ul><ul><li>Network interface to use for sending the next-hop address </li></ul></ul></ul><ul><ul><li>To compute hash function - IP uses only the network portion of the destination IP address </li></ul></ul><ul><ul><li>To Search linked list – entire destination address is used </li></ul></ul>
  3. 3. Routing table data structure <ul><li>Structure route contains the contents of a node on the linked list and contains routing information for one possible destination </li></ul><ul><ul><li>rt-net - destination address </li></ul></ul><ul><ul><li>rt-mask - 32 bir mask </li></ul></ul><ul><ul><li>rt-gw - next-hop gateway for the route </li></ul></ul><ul><ul><li>rt-metric - distance of the gateway in hops </li></ul></ul><ul><ul><li>rt-ifnum - internal number of the network interface </li></ul></ul><ul><li>Fields used by the IP software </li></ul><ul><ul><li>rt-key - sort key used when inserting a node on the linked list </li></ul></ul><ul><ul><li>rt-refcnt - reference count of processes that hold a pointer to the route </li></ul></ul><ul><ul><li>rt-usecnt - counts the number of times the route has been used </li></ul></ul><ul><ul><li>rt-next - contains pointers to the next node on the list </li></ul></ul>
  4. 4. Routing table data structure … <ul><li>rttable is defined in route.h </li></ul><ul><ul><li>it is an array of pointers to route structures </li></ul></ul><ul><li>rtinfo – aglobal structure holds few other data items </li></ul><ul><ul><li>Default route – used for any destination not contained in the table </li></ul></ul><ul><ul><li>ri-default – points to a route struc. that has the next-hop addr. for default route </li></ul></ul><ul><ul><li>ri-valid - a boolean value TRUE if data structures are initialized </li></ul></ul>
  5. 5. Origin of route and persistence <ul><li>Information in the routing table comes from several sources </li></ul><ul><ul><li>initial set of routes from secondary storage when system starts </li></ul></ul><ul><ul><li>during execution </li></ul></ul><ul><ul><li>network managers </li></ul></ul><ul><li>Field rt-ttl in each routing entries specify a time that the entry remains val id </li></ul><ul><ul><li>routing ptorocols can use this rt-ttl </li></ul></ul><ul><ul><li>Managers can use infinite rt-ttl </li></ul></ul>
  6. 6. Routing a datagram <ul><li>Utility procedure </li></ul><ul><li>netnum procedure – extracts the network portion of a given IP address </li></ul><ul><ul><li>Address class is used to determine which octets contain the network part </li></ul></ul><ul><ul><li>Returns the specified address with all host bytes set to zero </li></ul></ul>
  7. 7. <ul><li>netmatch procedure – used to compare a destination address to a routing entry </li></ul><ul><ul><li>Routing entry has subnet mask and IP address </li></ul></ul><ul><ul><li>Subnet mask is used to mask off host bits and compare the result to the network entry </li></ul></ul><ul><ul><li>If there is match </li></ul></ul><ul><ul><ul><li>TRUE else </li></ul></ul></ul><ul><ul><ul><li>FALSE </li></ul></ul></ul><ul><li>netmatch tests for a broadcast datagram explicitly </li></ul>
  8. 8. <ul><li>NOTE: Action taken on a broadcast message depends on the source of the datagram </li></ul><ul><li>Broadcast message from n/w interface </li></ul><ul><ul><li>Deliver to the local machine via pseudo-network interface </li></ul></ul><ul><ul><li>A mask of all 1’s is used to route the arriving broadcast datagram </li></ul></ul><ul><li>Locally generated broad cast </li></ul><ul><ul><li>Send to the appropriate n/w interface </li></ul></ul><ul><ul><li>n/w specific route is used to route outgoing datagram </li></ul></ul>
  9. 9. <ul><li>netmask procedure – to find the subnet mask for a destination address </li></ul><ul><li>Two parameters are used </li></ul><ul><ul><li>Subnet mask variable </li></ul></ul><ul><ul><li>Destination IP address </li></ul></ul><ul><li>First sets the subnet mask to all 0’s and then checks several cases </li></ul><ul><ul><li>If destination address is all 0’s netmask returns mask of all 0’s </li></ul></ul><ul><ul><li>for other destinations procedure calls netnum to extract the network portion of the destination address </li></ul></ul><ul><ul><li>Check each locally-connected network for the subnet mask </li></ul></ul><ul><ul><li>If dest. netmask and locally-connected n/w, extract the subnet mask and return it </li></ul></ul><ul><ul><li>If no iformation is found, it set the subnet mask to cover the network part of the address </li></ul></ul>
  10. 10. <ul><li>rthash procedure – called to hash a destination n/w addres </li></ul><ul><li>Sums the individual octets of the network address </li></ul><ul><li>Divide by the hash table size </li></ul><ul><li>Return the remainder </li></ul>
  11. 11. Obtaining a route <ul><li>rtget procedure - searches the routing table and returns a pointer to the entry for that route </li></ul><ul><li>Route.ri_valid – specifies whether </li></ul>