Problem
You want to run RIP on a simple network.
Solution
The following commands show how to configure basic RIP functionality:
Router2#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router2(config)#interface Ethernet0 Router2(config-if)#ip address 192.168.30.1 255.255.255.0 Router2(config-if)#interface Serial0.1 Router2(config-subif)#ip address 172.25.2.2 255.255.255.0 Router2(config-subif)#exit Router2(config)#router rip Router2(config-router)#network 172.25.0.0 Router2(config-router)#network 192.168.30.0 Router2(config-router)#exit Router2(config)#end Router2#
Discussion
You enable RIP for an interface by associating its IP address with a network. For example, the Serial0.1 subinterface in this example has an IP address of 172.25.2.2. So if you want this subinterface to take part in RIP route distribution, you just need to include a network statement that includes its address:
Router2(config)#router rip Router2(config-router)#network 172.25.0.0
If you have other interfaces that are also part of 172.25.0.0/16 on this router, they will take part in RIP as well. It's important to note that RIP network statements work with classful network addresses. The network command may appear to accept subnets of classful addresses, but it will internally rewrite these subnet addresses with the classful network address:
Router2#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router2(config)#router rip Router2(config-router)#network 172.25.1.0 Router2(config-router)#end Router2#show run | begin router rip router rip network 172.25.0.0 Router2#
Since 172.25.0.0 is a Class B network, the statement network 172.25.0.0 tells the router to include all interfaces with IP address in this range. Note, however, that the other address on this router, 192.168.30.1, is part of the Class C network, 192.168.30.0/24, which is why we need the second network command:
Router2(config)#router rip Router2(config-router)#network 192.168.30.0
If your router has several addresses that belong to different network classes, as in, for example, 192.168.x.0/24, you have to specify them all separately:
Router2(config)#router rip Router2(config-router)#network 192.168.1.0 Router2(config-router)#network 192.168.2.0 Router2(config-router)#network 192.168.3.0
It can sometimes be confusing to know which networks to specify. You use the network command to specify both the routes that RIP advertises and the interfaces that it uses.
If your router receives a route from another router, it will pass it along to other routers, whether you have specified a network statement for this address or not. So the network command selects only the routes that are local to this router, such as directly connected networks. However, the router will only distribute information about directly connected routes if there is a network statement for these routes. And the router will exchange RIP information only through interfaces specified by network statements.
The network command also selects the interfaces that will use RIP. By default, the router will run RIP on any interfaces whose IP addresses are contained within the range specified in the network statement. We discuss exceptions to this rule in Recipe 6.6.
The show ip protocol command gives a lot of useful information about what interfaces and address ranges are involved in the routing protocol:
Router2#show ip protocol Routing Protocol is "rip" Sending updates every 30 seconds, next due in 7 seconds Invalid after 180 seconds, hold down 180, flushed after 240 Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set Redistributing: rip Default version control: send version 1, receive any version Interface Send Recv Triggered RIP Key-chain Ethernet0 1 1 2 Serial0.1 1 1 2 Automatic network summarization is in effect Maximum path: 4 Routing for Networks: 172.25.0.0 192.168.30.0 Routing Information Sources: Gateway Distance Last Update 172.25.2.1 120 00:00:17 Distance: (default is 120) Router2#
As you can see from the output of this command, the router will send RIP Version 1 on both interfaces Ethernet0 and Serial0.1, but it will listen for both Versions 1 and 2. You can force the router to use only Version 1 to send and receive routing information for all interfaces with the following command:
Router2#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router2(config)#router rip Router2(config-router)#version 1 Router2(config-router)#end Router2#
However, it is usually better to restrict what you send rather than what you receive. That way, if another device is misconfigured to send the other version, it doesn't break the network. We will discuss how to configure different RIP version options in Recipe 6.14.
Once you have RIP running successfully between two or more routers, you can look at your routing table to see which routes the router is learning, and from where:
Router2#show ip route rip R 172.22.0.0/16 [120/1] via 172.25.2.1, 00:00:00, Serial0.1 R 172.25.1.0/24 [120/1] via 172.25.2.1, 00:00:00, Serial0.1 R 192.168.20.0/24 [120/2] via 172.25.2.1, 00:00:00, Serial0.1 Router2#
This command just gives a subset of the output of the more general show ip route command, which we discussed in Chapter 5. The example output shows that the router has learned that it can get to the destination network 192.168.20.0/24 through the next-hop router, 172.25.2.1, which is on interface Serial0.1.
The two numbers in the square brackets, [120/2], are the administrative distance and the RIP metric respectively. Cisco routers give all RIP routes a default administrative distance of 120. The metric value of 2 indicates how far away this network is. By default, the metric is the same as the number of hops, but you can adjust metric values to break this rule. We will discuss how to change metric values in Recipes 6.3, 6.4, 6.5, and 6.9, and we talk about administrative distances in Chapter 5.
Another useful command for looking at RIP functions on your router is the show ip rip database command, introduced in IOS level 12.0(6)T:
Router2#show ip rip database 172.22.0.0/16 auto-summary 172.22.0.0/16 [1] via 172.25.2.1, 00:00:13, Serial0.1 172.25.0.0/16 auto-summary 172.25.1.0/24 [1] via 172.25.2.1, 00:00:13, Serial0.1 172.25.2.0/24 directly connected, Serial0.1 192.168.20.0/24 auto-summary 192.168.20.0/24 [2] via 172.25.2.1, 00:00:13, Serial0.1 192.168.30.0/24 auto-summary 192.168.30.0/24 directly connected, Ethernet0 Router2#
This allows you to see more detailed information about each of the routes in the RIP database.
See Also
Recipe 6.3; Recipe 6.4; Recipe 6.5; Recipe 6.6; Recipe 6.9; Recipe 6.14; Chapter 5
Router Configuration and File Management
Router Management
User Access and Privilege Levels
TACACS+
IP Routing
RIP
EIGRP
OSPF
BGP
Frame Relay
Handling Queuing and Congestion
Tunnels and VPNs
Dial Backup
NTP and Time
DLSw
Router Interfaces and Media
Simple Network Management Protocol
Logging
Access-Lists
DHCP
NAT
First Hop Redundancy Protocols
IP Multicast
IP Mobility
IPv6
MPLS
Security
Appendix 1. External Software Packages
Appendix 2. IP Precedence, TOS, and DSCP Classifications
Index