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. OSPF 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

router ospf 7 router-id 192.168.250.9

redistribute connected subnets tag 9 network 172.16.9.0 0.0.0.255 area 0

redistribute the loopback interfaces 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

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route

Gateway of last resort is not set

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, SerialO 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, SerialO * 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)

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

128.100.2.0 192.168.250.9 1095 0x80000024 0xD34C 9

172.16.9.0 192.168.250.9 844 0x80000026 0x3807 9

mark#

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 network command 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.

Tag added du redistribution

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 EthernetO No OSPF hellos out EO (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 SerialO No RIP broadcasts out SO

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

Gateway of last resort is not set

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

peter#

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 SerialO distribute list applied to sO

ip classless !

access-list 10 deny 128.100.0.0 0.0.255.255 * access list deny all 128.100.x.x access-list 10 permit any !

mathew#show ip route

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default U - per-user static route, o - ODR

Gateway of last resort is not set

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

.1C

.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

mathew#

Was this article helpful?

0 0

Responses

  • lyle
    How to influence routes ospf?
    6 months ago
  • alighiero genovesi
    What are ways to influence routing?
    3 months ago

Post a comment