RIP

The routing tables in gateways and hosts must be initialized and kept up to date. One of the protocols that has been designed for dynamic table update is the Routing Information Protocol (RIP).

Active gateways advertize their routes to others by broadcasting periodically a RIP message, which contains pairs of (IP address, number of hops), i.e. the IP address of a network and the number of hops along the path to that network. RIP uses a hop count metric to measure the distance to a destination. A gateway is defined one hop from directly connected network, two hops from a network that is reachable through an other gateway, three hops from a network that is reachable through two other gateways etc.

Passive hosts and other gateways listen and update their tables according to the broadcasted RIP messages. The routing tables will be updated with the smallest hop count to a particular network.

RIP updates may cause inconsistencies. Consider the following example :

The three gateways each have a route to network N1 (a). G1 is directly connected, G2 has learned it from G1 and G3 has learned from G3 from the RIP broadcast messages. When the connection between network N1 and gateway G1 disappears (b), G1 will set the hop count for the network in its routing table to infinity and report the new route in the next RIP message. But if G2 can broadcast its old value for hop count to network N1 (which is 2), just before G1 could send out the new RIP message with hop count infinity, G1 will update its routing table with a route through gateway G2 (i.e. will set the hopcount to N1 to 3), since the hop count of 2 indicates a shorter route than the direct route with hop count than infinity. Possible solutions to minimize the occurrence of a routing loop are:

RIP uses the convention, that IP address 0.0.0.0 in a routing table means the default address.

RIP uses UDP as the transport protocol and operates at UDP port 520.

The use of broadcast, potential for routing loops, hold down can make RIP inefficient for Wide Area Networks. For WAN other protocols are used for updating routing tables in the gateways.