28 May, 2013

OSPF Redistribution and Route Control

OSPF Redistribution and Route Control

To filter specific routing updates in OSPF, you must use an inbound distribution list. An OSPF router does not send routing updates in the traditional manner; therefore, only an inbound distribution list on the router receiving the update works for route control. When redistributing one protocol into another, use the redistribute command along with the default metric. A route map should be used in place of a distribute list when controlling specific routes during the redistribution process. A route map provides for many more options during redistribution and is a powerful routing tool.

Commands to Control Route Filtering/Redistribution

To call a standard access list to filter inbound routing updates, use the following command:

Router(config-router)#distribute-list [1-99] [in][interface_name]

The in option is applied from the view of the interface. In other words, to prevent a routing update from entering an interface, use the in option. This command filters only the route, not the LSA.
To redistribute other routing protocols into OSPF, use the following command:
Router(config-router)#redistribute [connected | static | bgp | rip igrp | eigrp | isis] [subnets] [tag tag_number] [metric cost][metric-type {OE1 | OE2}][route-map]

With OSPF, the keyword subnets always should be used when redistributing more then one network into OSPF. When redistributing routes into OSPF, only routes that are not subnetted are redistributed if the subnets keyword is not specified. An optional tag can be added during redistribution. This tag appears in the OSPF database and can be used to quickly identify where route redistribution occurs in the internetwork. A route map might be added for additional route control. An optional metric/cost also can be supplied for routes originating from the routing protocol being redistributed that are different from the default metric. When OSPF redistributes routes, the default route type will be an OSPF external Type 2 route (O E2). To change this to an OSPF external Type 1 route (O E1), use the metric-type argument on the redistribution command.
To set the default cost of all routes redistributed into OSPF, use the following command:

Router(config-router)#default-metric [cost 1-4294967295]

You must supply a default metric whenever redistributing. A common metric to use is default-metric 10. Recall from the previous chapter that more important than the actual value of the default metric is the practice of using the same metric throughout the routing domain, so all redistributed routes will have the same cost.

Commands to Influence OSPF Routing Decisions
You can control routing updates within OSPF in multiple ways. Recall that OSPF calculates a cost to a destination based on a formula involving bandwidth. To influence route decisions, you can either change the bandwidth on the interface, which in turn will affect the cost of the link, or directly change the cost of the interface.
OSPF also supports the direct changing of the administrative distance with the distance command, much like EIGRP. OSPF also uses the passive interface command to prevent hellos from being sent on the link.
To specify the cost of an interface in OSPF, use the following command:

Router(config-if)#cost [cost 1-4294967295]

This command is used only by OSPF and does not affect the actual traffic on the link.
To specify the bandwidth of an interface in kilobits per second, use the following command:

Router(config-if)#bandwidth [bandwidth_kbps 1-4214748364]

The bandwidth command is used only by routing protocols to derive a cost for the interface, and it also does not affect the actual traffic on the link.
To change the administrative distance of OSPF routes, use the following command:

Router(config-router)#distance ospf {[intra-area [1-255] [inter-area [1-255][external [1-255]}

OSPF uses three different administrative distances: intra-area, interarea, and external. Routes within an area are intra-area; routes from another area are interarea; and routes injected by redistribution are external. The default administrative distance for each type of route is 110.
To prevent the sending of OSPF hellos on the link, use the following command:

Router(config-router)#passive-interface interface_name

Because hellos are suppressed, neighbors will not be formed, so no routing updates will be sent or received.
Practical Example: Route Filtering/Redistribution

Let's apply a couple of these concepts to a practical model in route filtering and redistribution to gain a better grasp of them.Figure 12-9 modifies the internetwork from the previous model in Example 12-8. The mark router is now an ASBR between the OSPF domain and a RIP domain. You also will redistribute some loopback interfaces on the router paul. On the mathew router, you will apply an inbound distribution list to filter the external networks or the loopback networks from the router paul.
Figure 12-9 Network for Route Filtering/Redistribution

Beginning with the paul router, we have added two loopback interfaces, 128.100.1.1/24 and 128.100.2.1/24. To redistribute these networks, you will use the redistribute connected command with the subnets argument. The default metric or cost will be set to 10. In this example, a tag is set on the redistribution. Example 12-20 illustrates how the tag shows up in the OSPF database. Example 12-18 lists the relevant configuration of the router paul.

Example 12-18. Configuration of the paul Router

interface Loopback20
ip address 128.100.1.1 255.255.255.0
no ip directed-broadcast
!
interface Loopback21
ip address 128.100.2.1 255.255.255.0
no ip directed-broadcast
!
interface Ethernet0/0
ip address 172.16.9.9 255.255.255.0
no ip directed-broadcast
!
<<<text omitted>>>
!
router ospf 7
router-id 192.168.250.9
redistribute connected subnets tag 9        
redistribute the loopback interfaces
network 172.16.9.0 0.0.0.255 area 0
default-metric 10                

Use a cost of 10 on redistributed networks

!

To verify the redistribution, perform show ip route on the mark router. Example 12-19 demonstrates this command.

Example 12-19. show ip route on Router mark


mark#show ip route
     172.16.0.0/16 is variably subnetted, 8 subnets, 4 masks
O IA    172.16.9.0/24 [110/74] via 172.16.1.5, 08:58:07,Serial0
O       172.16.10.0/24 [110/138] via 172.16.1.5, 18:33:11,Serial0
O       172.16.1.5/32 [110/64] via 172.16.1.5, 18:33:11, Serial0
C       172.16.5.0/24 is directly connected, Ethernet0
O IA    172.16.2.4/30 [110/128] via 172.16.1.5, 08:58:08, Serial0
O       172.16.1.1/32 [110/128] via 172.16.1.5, 18:33:11, Serial0
C       172.16.1.0/24 is directly connected, Serial0
O IA    172.16.3.0/24 [110/134] via 172.16.1.5, 08:58:09, Serial0
     128.100.0.0/24 is subnetted, 2 subnets
O E2    128.100.1.0 [110/20] via 172.16.1.5, 08:58:09, Serial0   

      redistributed routes
O E2    128.100.2.0 [110/20] via 172.16.1.5, 08:58:09, Serial0
During redistribution, we also put a tag of 9 on the routes.

Example 12-20 lists the OSPF database of mark showing how the tag is propagated throughout OSPF.
Example 12-20. OSPF Database on the Router mark
mark#show ip ospf database
       OSPF Router with ID (192.168.250.6) (Process ID 7)
<<text omitted>>
                Type-5 AS External Link States
Link ID         ADV Router      Age         Seq#       Checksum Tag
128.100.1.0     192.168.250.9   1094        0x80000024 0xDE42   9
      Tag added during
   128.100.2.0     192.168.250.9   1095        0x80000024 0xD34C 9
      redistribution
172.16.9.0      192.168.250.9   844         0x80000026 0x3807   9

Notice that during redistribution, the 172.16.9.0 route also is redistributed. This is because the Ethernet network also is considered a local network. To prevent this from happening, add a route map to the redistribution command to filter any unwanted networks.

Next, you will integrate the RIP domain into OSPF on the router mark. To accomplish this, enable RIP on the mark router. When doing this, you will put the E0 interface into a passive state for OSPF and the S0 interface into a passive state for RIP. A more specific network command also will accomplish this, which is another good reason to limit the wildcard mask on the networkcommand to a single network or interface. To enable redistribution, use the redistribute rip subnets command on the mark router. Likewise, you will have to redistribute OSPF into RIP. The default metric that you will use for OSPF is 10. Example 12-21 shows the OSPF portion of router mark.

Example 12-21. Routing Protocol Configuration of mark

    router ospf 7
    router-id 192.168.250.6
    redistribute rip subnets    
    redistribute RIP into OSPF
    passive-interface Ethernet0      
    No OSPF hellos out E0 (optional)
    network 172.16.1.0 0.0.0.255 area 10
    default-metric 10           
    Use 10 as the cost to the RIP domain
   !
   router rip
   redistribute ospf 7           
   redistribute OSPF into RIP
   passive-interface Serial0        
   No RIP broadcasts out S0
   network 172.16.0.0
   default-metric 3             

   Use a hop count of 3 for OSPF routes

Because one redistribution point exists in the network, you do not have to worry about redistribution loops or "route feedback." Before redistribution will be complete, you have to summarize the 172.16.2.4/30 network. This is because RIP receives routes through an interface on a 24-bit boundary. In this model, you accomplished this with the area range command. We will discuss more about this in the next session. The best way to verify redistribution in this model is to view the route table of the router peter and verify that all the OSPF routes are reachable by ping tests. Example 12-22 lists the route table of peter.

Example 12-22. Route Table of peter After Redistribution


peter#show ip route
<<<text omitted>>>
     172.16.0.0/16 is variably subnetted, 8 subnets, 2 masks
R       172.16.9.0/24 [120/3] via 172.16.5.5, 00:00:01, Ethernet0
R       172.16.10.0/24 [120/3] via 172.16.5.5, 00:00:01, Ethernet0
R       172.16.1.5/32 [120/3] via 172.16.5.5, 00:00:01, Ethernet0
C       172.16.5.0/24 is directly connected, Ethernet0
R       172.16.1.1/32 [120/3] via 172.16.5.5, 00:00:02, Ethernet0
R       172.16.1.0/24 [120/1] via 172.16.5.5, 00:00:02, Ethernet0
R       172.16.2.0/24 [120/3] via 172.16.5.5, 00:00:02, Ethernet0
R       172.16.3.0/24 [120/3] via 172.16.5.5, 00:00:02, Ethernet0
R    128.100.0.0/16 [120/3] via 172.16.5.5, 00:00:02, Ethernet0
To demonstrate route filtering in OSPF, you will apply an inbound distribute list to the router mathew. The configuration of the mathew router resembles the following example. At the end of Example 12-23 is the new route table for mathew, without the 128.100.1.0/24 and 128.100.2.0/24 routes.

Example 12-23. Distribute List on the mathew Router

    router ospf 7
    network 172.16.1.0 0.0.0.255 area 10
    network 172.16.10.0 0.0.0.255 area 10
    distribute-list 10 in Serial0   
    distribute list applied to s0
   !
    ip  classless
   !
    access-list 10 deny   128.100.0.0 0.0.255.255   
    access list deny all 128.100.x.x
    networks
    access-list 10 permit any
   !
mathew#show ip route
     172.16.0.0/16 is variably subnetted, 9 subnets, 2 masks
C       172.16.250.0/24 is directly connected, Loopback0
O IA    172.16.9.0/24 [110/74] via 172.16.1.5, 01:01:06, Serial0
C       172.16.10.0/24 is directly connected, Ethernet2
O       172.16.1.5/32 [110/64] via 172.16.1.5, 01:01:06, Serial0
O       172.16.5.0/24 [110/129] via 172.16.1.5, 01:01:06, Serial0
O       172.16.1.6/32 [110/128] via 172.16.1.5, 01:01:06, Serial0
C       172.16.1.0/24 is directly connected, Serial0
O IA    172.16.2.0/24 [110/128] via 172.16.1.5, 01:01:06, Serial0
O IA    172.16.3.0/24 [110/134] via 172.16.1.5, 01:01:06, Serial0