220 likes | 844 Views
Routing Algorithms. Distance Vector Routing Each node knows the distance (=cost) to its directly connected neighbors A node sends periodically a list of routing updates to its neighbors. If all nodes update their distances, the routing tables eventually converge
E N D
Routing Algorithms Distance Vector Routing • Each node knows the distance (=cost) to its directly connected neighbors • A node sends periodically a list of routing updates to its neighbors. • If all nodes update their distances, the routing tables eventually converge • New nodes advertise themselves to their neighbors 2. Link State Routing • Each node knows the distance to its neighbors • The distance information (=link state) is broadcast to all nodes in the network • Each node calculates the routing tables independently COMM3380
Distance Vector Protocol Example Routing Information Protocol (RIP) COMM3380
Routing Information Protocol (RIP) • RIP is an IGP for use within an autonomous system • Designed for small networks with same speed links • Uses UDP port 520 • Request and Response messages - requests update and responds with update • Broadcasts request out every RIP configured interface on start up of routing protocol. • Upon receipt of response message, routes are checked in current routing table, if absent, routes are added, if existing, route only updated if it has a lower hop count COMM3380
RIP broadcast from a neighbouring router • If the destination is not in the table, then create a new table entry for it. • If the destination is already in the table via a different route but the received list gives a shorter distance to it, then change the table entry. • If the destination is already in the table via the same route, but the received list gives a distance that is different then change the table entry. • Otherwise do nothing with this destination/distance pair of values. COMM3380
RIP : Count to infinity problem • B – X -> distance = 0 • A – X -> distance = 1 • If connection from B to X fails -> B – X marked unreachable • A broadcasts DV list • B sees A-X at distance 1 -> thinks link B-A-X exists with distance 2 -> updates table -> routing loop between A and B for traffic destined for X COMM3380
Now B broadcast its DV list with X reachable via A at distance = 2 A sees distance B-X has changed from distance 0 to 2 -> A updates A-X to distance = 3 A broadcasts -> B see A-X with distance=3 -> B updates entry B-X to distance=4 Continues until distance = 16 reached -> unreachable RIP : Count to infinity problem COMM3380
Split Horizon • Solves trivial count-to-infinity problem • Routers never advertise the cost of a destination back to its next hop, i.e. where it learned it from • Poison Reverse -> advertise back infinity COMM3380
Routing Loop Avoidance • Routing loops can still occur in any network due to router configuration errors. • To prevent -> IP packet has a time to live (TTL) value in its header-> decremented by each router as it receives the packet. If the TTL of a packet becomes zero, the router discards it. COMM3380
RIP Message Format COMM3380
RIP v1 • Command specifies Request = 1 or Response - 2 • Version Ripv1 = 1 • AFI - Address-Family Identifier - specifies protocol, IP = 2 • IP address of destination route • Metric - hop count to destination • Up to 25 routes - AFI, IP and Metric combinations COMM3380
RIP Operations • On start-up, RIP broadcast Request message out each RIP enabled interface. • From then on, it listens for Request and Response messages from others. • Neighbour routers respond to initial Request with full routing table in Response Message(s) - 25 routes per Response packet. • On receipt of Response message, • If route entry is new, it is added to routing table with address of advertising router. • If the route entry is not new and the hop count is the same, the timer is updated. • If the route entry is not new and the hop count is lower, the new next hop information is entered. • If the route entry if not new and the hop count is greater, the route is marked as Hold down. • Routers continue to send gratuitous Response message(s) out each RIP enable interface every 30 seconds COMM3380
RIP Version 2 Changes • Classless routing and subnet masks in routing updates • Routing update authentication • Next-hop addresses for each route • External route tags • Multicast route updates, instead of broadcast • Same procedures, timers & functions of v1 COMM3380
RIPv2 Packet • Command specifies Request = 1 or Response - 2 • Version Ripv2 = 2 • AFI - Address-Family Identifier - specifies protocol, IP = 2, 0xffff -> Authentication Entry in place of first routing entry • Route Tag - mark external or redistributed routes into RIP • Network - IP address of destination route • Subnet Mask - allows for classless routing • Metric - hop count to destination • Up to 25 routes - AFI, IP and Metric combinations • Maximum datagram size 512 octets • Authentication by password in update COMM3380
RIP v1 & v2 • Metric of hop count only allowable of 1-15. At 16, destination is considered unreachable, to prevent routing loops. This limits the depth of a network to run RIP. • Update timer - Router sends gratuitous Response message out each interface every 30 seconds with full routing table. • Expiration timer - initialized to 180 seconds for a new route and reset upon update of that route. If timer expires, hop count set to 16, unreachable, but still advertised. • Flush timer - set to 240 seconds upon initialization, once expired, route is removed from routing table and no longer advertise. • Holddown timer - Cisco only - set for 180 seconds when updated route has a higher hop count than previous advertisement. COMM3380