Redistributing Static Routes into RIP
Problem
You want RIP to redistribute static routes that you have configured on your router.
Solution
The redistribute static command tells RIP to advertise static routes, as well as directly connected routes and the routes that have been learned from other RIP routers:
Router1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router1(config)#ip route 192.168.10.0 255.255.255.0 172.22.1.4
Router1(config)#router rip
Router1(config-router)#redistribute static
Router1(config-router)#end
Router1#
You can define how these routes look to other routers when they are redistributed:
Router1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router1(config)#ip route 192.168.10.0 255.255.255.0 172.22.1.4
Router1(config)#router rip
Router1(config-router)#redistribute static metric 5
Router1(config-router)#distribute-list 7 out static
Router1(config-router)#exit
Router1(config)#access-list 7 permit 192.168.10.0
Router1(config)#end
Router1#
Discussion
The biggest potential problem that you will encounter with redistributing routes into RIPv1 comes from breaking network class boundaries. This version of RIP is classful, so you have to be rather careful about how you distribute routing information from other sources that may be classless. In the example in this recipe, Router1 redistributes a static route for the Class C network 192.168.10.0. But if we tried instead to redistribute a larger range, such as 192.168.12.0/22, RIPv1 would not generate any errors; the router would just quietly refuse to forward this route. RIPv2, on the other hand, will redistribute this supernet route.
Looking at the RIP database on a router with IOS level 12.0(6)T or higher shows the redistributed static route:
Router1#show ip rip database 192.168.10.0 255.255.255.0
192.168.10.0/24 redistributed
[5] via 0.0.0.0,
Router1#
After configuring the second example, the output of show ip protocols includes information about the filtering. This command also tells you what other protocols RIP is redistributing routes from:
Router1#show ip protocols
Routing Protocol is "rip"
Sending updates every 30 seconds, next due in 5 seconds
Invalid after 180 seconds, hold down 180, flushed after 240
Outgoing update filter list for all interfaces is not set
Redistributed static filtered by 7
Incoming update filter list for all interfaces is not set
Redistributing: static, rip
Default version control: send version 1, receive any version
Interface Send Recv Triggered RIP Key-chain
FastEthernet0/0.1 1 1 2
Serial0/0.2 1 1 2
FastEthernet0/1 1 1 2
Automatic network summarization is in effect
Maximum path: 4
Routing for Networks:
172.22.0.0
172.25.0.0
Routing Information Sources:
Gateway Distance Last Update
172.25.1.7 120 00:00:03
172.25.2.2 120 00:00:06
172.22.1.4 120 00:00:08
Distance: (default is 120)
Router1#
In addition to static routes, you can distribute information from other dynamic routing protocols into RIP simply by specifying which protocol's routes you want RIP to use. For example, if you have an EIGRP network that uses process number 65530 on the same router, you would redistribute it into RIP like this:
Router1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router1(config)#router eigrp 65530
Router1(config-router)#network 192.168.1.0
Router1(config-router)#exit
Router1(config)#router rip
Router1(config-router)#redistribute eigrp 65530
Router1(config-router)#end
Router1#
If you look at the show ip protocols command now, you can see that RIP redistributes routes it learns from EIGRP, but EIGRP does not redistribute routes learned from RIP. If you also want EIGRP to redistribute RIP routes, you must explicitly configure it to do so. We discuss EIGRP configuration, including redistribution examples, in Chapter 7:
Router1#show ip protocols
Routing Protocol is "rip"
Sending updates every 30 seconds, next due in 0 seconds
Invalid after 180 seconds, hold down 180, flushed after 240
Outgoing update filter list for all interfaces is
Incoming update filter list for all interfaces is
Redistributing: static, rip, eigrp 65530
Default version control: send version 1, receive any version
Interface Send Recv Key-chain
FastEthernet0/0.1 2 2
Serial0/0.2 2 2
FastEthernet0/1 2 2
Automatic network summarization is in effect
Maximum path: 4
Routing for Networks:
172.22.0.0
172.25.0.0
Routing Information Sources:
Gateway Distance Last Update
172.25.1.7 120 00:00:03
172.25.2.2 120 00:00:06
172.22.1.4 120 00:00:08
Distance: (default is 120)
Routing Protocol is "eigrp 65530"
Outgoing update filter list for all interfaces is
Incoming update filter list for all interfaces is
Default networks flagged in outgoing updates
Default networks accepted from incoming updates
EIGRP metric weight K1=1, K2=0, K3=1, K4=0, K5=0
EIGRP maximum hopcount 100
EIGRP maximum metric variance 1
Redistributing: eigrp 65530
Automatic network summarization is in effect
Routing for Networks:
192.168.1.0
Routing Information Sources:
Gateway Distance Last Update
Distance: internal 90 external 170
Router1#
Table 6-1 shows a list of foreign protocols that RIP can redistribute.
Type | Description |
---|---|
bgp | Border Gateway Protocol |
connected | Directly connected interfaces |
egp | Exterior Gateway Protocol |
eigrp | Enhanced IGRP |
igrp | Interior Gateway Routing Protocol |
isis | ISO IS-IS Routing Protocol |
mobile | IP Mobility routes |
ospf | Open Shortest Path First |
rip | Routing Information Protocol |
static | Static routes |
The second example shows how to set a particular metric when redistributing a route into RIP:
Router1(config)#router rip
Router1(config-router)#redistribute static metric 5
In this case, all static routes will appear with a RIP metric of 5. Because of the maximum metric value of 16, you need to be extremely careful with how you distribute routes into RIP. This example shows how to set a metric when redistributing static routes, but you can use the same technique when redistributing routes from any source:
Router1(config)#router rip
Router1(config-router)#redistribute eigrp 65530 metric 5
Finally, we will point out a slightly confusing irregularity with the redistribute command. Although this command seems to allow you to redistribute RIP into RIP, in fact it won't allow it:
Router1(config)#router rip
Router1(config-router)#redistribute rip
redistribution of "rip" via "rip" not allowed
dialhost(config-router)#
This is actually a good thing because RIP doesn't support process numbers, unlike other routing protocols available on Cisco routers. It makes sense to redistribute, for example, one EIGRP process into another EIGRP process; it doesn't make sense to redistribute within a process. If this were possible, it would be ambiguous which routes were internal and which were external.