Distance-Vector vs Link-State Routing: RIP vs OSPF, Convergence
A routing protocol lets routers exchange route information and build their routing tables automatically. Protocols used inside an organization (IGPs) follow one of two main approaches. In a distance-vector protocol, each router hears from its neighbors "how far it is to each destination" and picks routes by adding its distance to that neighbor. RIP, the classic example, uses the number of routers passed through (the hop count) as the distance. In a link-state protocol, each router advertises the state of its own links so that all routers share a map of the network (the topology), and each one computes shortest paths with Dijkstra's algorithm. OSPF, the classic example, picks routes by the sum of costs assigned to each link. Distance-vector protocols are simple and easy to configure, but routes settle (converge) slowly after a failure, so they do not suit large networks. Link-state protocols need more computation and memory, but they react to changes quickly and scale to large networks.
| Aspect | Distance-vector (such as RIP) | Link-state (such as OSPF) |
|---|---|---|
| What each router knows | Only the distance and next hop for each destination, as heard from its neighbors; it does not know the layout of the whole network | Every router and link in its area and their costs; all routers in the area hold the same map (the link-state database) |
| Route calculation | Adds the distance to a neighbor to the distance heard from it and picks the smallest (the Bellman-Ford idea) | Computes a shortest-path tree rooted at itself from the map, using Dijkstra's algorithm |
| Metric (value expressing how good a route is) | RIP uses hop count, up to 15; 16 means "unreachable" | OSPF uses the sum of per-link costs; the cost can be set by the administrator and is commonly derived from bandwidth |
| How updates are sent | RIP sends the contents of its routing table to neighbors at a fixed interval (30 seconds in RFC 2453), and also sends changes right away (triggered updates) | When something changes, link-state information (LSAs) is spread through the whole area (flooding); otherwise Hellos check that neighbors are alive and LSAs are only refreshed at a long interval (30 minutes) |
| Convergence speed and loops | Slow; after a failure, distances can creep upward step by step (count to infinity); split horizon and similar techniques limit this | Fast; once a change has spread, each router recomputes right away, and since all routers compute from the same map, loops are unlikely |
| Network size | Suited to small networks; RIP cannot handle destinations 16 or more hops away | Suits large networks too; the network is split into areas arranged around the backbone area (area 0) |
| Resources and configuration | Light on CPU and memory; simple to configure | Needs more CPU and memory to hold the map and compute shortest paths; configuration, such as area design, is more complex |
| Examples | RIP (RIPv1, RIPv2, and RIPng for IPv6) | OSPF (OSPFv2 for IPv4, OSPFv3 for IPv6), IS-IS |
Figures are typical orders of magnitude and vary by process generation and product.