IPv6 Route Filtering and Metric Manipulation in OSPF

IPv6 Route Filtering and Metric Manipulation in OSPF

Problem

You want to manipulate the IPv6 routing tables distributed by OSPF.

Solution

OSPF Version 3 has many of the same features for route filtering and metric manipulation that we previously saw for OSPF Version 2 in Chapter 8. There are two commands for configuring link costs.

The first command changes the costs globally for all links according to their bandwidth values:

Router1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router1(config)#ipv6 router ospf 1
Router1(config-rtr)#auto-cost reference-bandwidth 1000
%OSPFv3: Reference bandwidth is change.
Please ensure reference bandwidth is consistent across all routers.
Router1(config-rtr)#exit
Router1(config)#end
Router1#

The second method changes the costs for individual links:

Router1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z
Router1(config)#interface FastEthernet0/0
Router1(config-if)#ipv6 ospf cost 500
Router1(config)#end
Router1#

We can also filter routes in OSPFv3, but only according to the same rules that we previously saw for OSPFv2:

Router1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router1(config)#ipv6 prefix-list BLOCK_99_E seq 5 deny AAAA:99::E:0/112
Router1(config)#ipv6 prefix-list BLOCK_99_E seq 10 permit ::/0 le 128
Router1(config)#ipv6 router ospf 1
Router1(config-rtr)#distribute-list prefix-list BLOCK_99_E in
Router1(config-rtr)#exit
Router1(config)#end
Router1#

Discussion

The first configuration example shown in the Solution section of this recipe sets the global reference bandwidth for OSPF to use in calculating link costs. This command is exactly the same as we previously saw in Chapter 8:

Router1(config)#ipv6 router ospf 1
Router1(config-rtr)#auto-cost reference-bandwidth 1000

The default reference-bandwidth for OSPFv3 is 100 Mbps. This means that links with a bandwidth of 100 Mbps and higher are assigned an OSPF cost value of 1. Links with lower bandwidths are assigned a cost value equal to this reference bandwidth divided by the interface bandwidth. So, by default a 10 Mbps Ethernet link has a cost of 10, and a 1.554 Mbps T1 link has a cost of 64. Note that the cost value is an integer.

Unfortunately, the default value of 100 Mbps is probably too low for most networks these days, as it fails to distinguish between Fast Ethernet and Gigabit Ethernet, both of which are rather common. So a reasonable starting point for these networks would be to set a reference bandwidth of 10,000, corresponding to a 10 Gigabit backbone link. This has the unfortunate consequence of assigning any link slower than 152 kbps a cost of 65,535, which is the maximum allowed in OSPF.

We discuss this problem in more detail in Chapter 8, since it is generic to OSPF. The way around it is to assign costs to individual links, which you can do using the method shown in the second configuration example:

Router1(config)#interface FastEthernet0/0
Router1(config-if)#ipv6 ospf cost 500

This example assigns an OSPF link cost of 500 to this interface. Remember that lower-cost paths are preferred when OSPF constructs its shortest-path routing table. So you can also use this command to manually force traffic to use a particular network link preferentially.

As we discussed in Chapter 8, you can block individual prefixes in OSPF, but this doesn't have the same meaning as for RIP:

Router1(config)#ipv6 prefix-list BLOCK_99_E seq 5 deny AAAA:99::E:0/112
Router1(config)#ipv6 prefix-list BLOCK_99_E seq 10 permit ::/0 le 128
Router1(config)#ipv6 router ospf 1
Router1(config-rtr)#distribute-list prefix-list BLOCK_99_E in

The OSPF algorithm requires that every router in an area must see exactly the same list of link state advertisements. Otherwise there is a serious risk that routing within this area will become unstable and perhaps generate loops. So there is no way to prevent a router from distributing the LSA information that it has received from other routers in the same area.

However, because OSPF keeps the LSA database separate from the routing table, you can use a distribute-list, as we have done in this example, to prevent the router from installing particular routes in its own routing table. In this case, you can see that the route in question, AAAA:99::E:0/112, is in the OSPF database:

Router1#show ipv6 ospf database

OSPFv3 Router with ID (1.0.0.1) (Process ID 1)

Router Link States (Area 0)

ADV Router Age Seq# Fragment ID Link count Bits
1.0.0.1 1687 0x8000000F 0 1 B
1.0.0.2 409 0x80000011 0 1 B

Net Link States (Area 0)

ADV Router Age Seq# Link ID Rtr count
1.0.0.2 409 0x8000000D 3 2

Inter Area Prefix Link States (Area 0)

Inter Area Prefix Link States (Area 0)

ADV Router Age Seq# Prefix
1.0.0.1 439 0x8000000D AAAA:1::/64
1.0.0.2 1507 0x8000000D AAAA:1::/64
1.0.0.2 491 0x8000000D AAAA:99::E:0/112
1.0.0.2 491 0x8000000D AAAA:99::D:0/112

But this prefix isn't present in the routing table.
Router1#show ipv6 route AAAA:99::E:0/112
% Route not found
Router1#

See Also