Creating a Default Route in RIP

Problem

You want RIP to propagate a default route.

Solution

There are two ways to get RIP to propagate a default route. The preferred method is using the default-information originate command as follows:

Router1#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router1(config)#ip route 0.0.0.0 0.0.0.0 172.25.1.1 Router1(config)#router rip Router1(config-router)#default-information originate Router1(config-router)#end Router1#

In simple situations, you can accomplish the same thing by just redistributing a static route:

Router1#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router1(config)#ip route 0.0.0.0 0.0.0.0 172.25.1.1 Router1(config)#access-list 7 permit 0.0.0.0 Router1(config)#router rip Router1(config-router)#redistribute static Router1(config-router)#distribute-list 7 out static Router1(config-router)#end Router1#

 

Discussion

There are two main advantages to using default originate instead of simply redistributing static routes. The first is that you may have other static routes on your router that you do not want to distribute, or that you want to distribute with a different default metric. In this case, if you just use redistribute static, you will need to filter out the unwanted routes using route maps, as shown in Recipe 6.4, or a distribute-list, as we use in this recipe.

The other important advantage is that the default-information originate option lets you create a conditional default route. This means that you can configure the router to create and distribute a default route only if some other route is present. Usually this other route is a distant network that indicates that the router is able to see enough of the outside world to be a reliable default router:

Router1#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router1(config)#access-list 20 permit 192.168.55.0 Router1(config)#route-map DEFAULTROUTE permit 10 Router1(config-route-map)#match ip address 20 Router1(config-route-map)#exit Router1(config)#router rip Router1(config-router)#default-information originate route-map DEFAULTROUTE Router1(config-router)#end Router1#

In this example, if the distant network 192.168.55.0 is present in the routing table, RIP will generate and distribute a default route. Usually you would just do this on the RIP router that forms a gateway to another network.

You can see how RIP distributes the default route with the show ip rip database command:

Router1#show ip rip database 0.0.0.0 0.0.0.0 0.0.0.0/0 redistributed [1] via 0.0.0.0, Router1#

 

See Also

Recipe 6.4

Категории