ルートフィルタ設定(ルートマップ)
ルートフィルタの設定を行います。ここでは、ルートの再配送時にルートマップを使ってルートフィルタを検証してみます。
まずは、RIPv2、OSPFによるネットワークを構築し、Router_B上で再配送の設定を行います。
再配送の設定については、「ルート再配送(redistribute)」を参考にしてみて下さい。

各ルータのルーティングの設定は、以下のようになります。
●Router_A
Router_A(config)#router rip
Router_A(config-router)#version 2
Router_A(config-router)#network 10.0.0.0
Router_A(config-router)#no auto-summary
●Router_B
Router_B(config)#router rip
Router_B(config-router)#version 2
Router_B(config-rouiter)#redistribute ospf 1 metric 10
Router_B(config-router)#network 10.0.0.0
Router_B(config-router)#no auto-summary
Router_B(config)#router ospf 1
Router_B(config-router)#redistribute rip metric 100 subnets
Router_B(config-router)#network 20.0.0.0 0.255.255.255 area 0
●Router_C
Router_C(config)#router ospf 1
Router_C(config-router)#version 2
Router_C(config-router)#network 20.0.0.0 0.255.255.255 area 0
Router_C(config-router)#network 172.16.0.0 0.0.255.255 area 0
Router_C(config-router)#network 192.168.1.0 0.0.0.63 area 0
Router_C(config-router)#network 192.168.1.64 0.0.0.63 area 0
Router_C(config-router)#network 192.168.1.128 0.0.0.31 area 0
Router_C(config-router)#network 192.168.1.160 0.0.0.31 area 0
●Router_Aの設定
!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname Router_A
!
boot-start-marker
boot-end-marker
!
enable password cisco
!
no aaa new-model
ip subnet-zero
!
ip cef
!
interface FastEthernet0
no ip address
shutdown
speed auto
!
interface Serial0
ip address 10.0.0.1 255.0.0.0
clockrate 64000
no fair-queue
!
router rip
version 2
network 10.0.0.0
no auto-summary
!
ip classless
no ip http server
!
line con 0
line aux 0
line vty 0 4
password cisco
login
!
end
●Router_Bの設定
!
version 12.1
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname Router_B
!
enable password cisco
!
memory-size iomem 25
ip subnet-zero
!
interface Serial0
ip address 10.0.0.2 255.0.0.0
no fair-queue
!
interface Serial1
ip address 20.0.0.1 255.0.0.0
clockrate 64000
!
interface FastEthernet0
no ip address
shutdown
speed auto
!
router ospf 1
redistribute rip metric 100 subnets
network 20.0.0.0 0.255.255.255 area 0
!
router rip
version 2
redistribute ospf 1 metric 10
network 10.0.0.0
no auto-summary
!
ip classless
no ip http server
!
line con 0
exec-timeout 0 0
transport input none
line aux 0
line vty 0 4
password cisco
login
!
no scheduler allocate
end
●Router_Cの設定
!
version 12.2
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname Router_C
!
enable password cisco
!
memory-size iomem 25
ip subnet-zero
!
interface Loopback0
ip address 192.168.1.1 255.255.255.192
ip ospf network point-to-point
!
interface Loopback1
ip address 192.168.1.65 255.255.255.192
ip ospf network point-to-point
!
interface Loopback2
ip address 192.168.1.129 255.255.255.224
ip ospf network point-to-point
!
interface Loopback3
ip address 192.168.1.161 255.255.255.224
ip ospf network point-to-point
!
interface Loopback4
ip address 172.16.1.1 255.255.255.0
ip ospf network point-to-point
!
interface Loopback5
ip address 172.16.2.1 255.255.255.0
ip ospf network point-to-point
!
interface FastEthernet0
no ip address
shutdown
speed auto
!
interface Serial0
ip address 20.0.0.2 255.0.0.0
no fair-queue
!
interface Serial1
no ip address
shutdown
!
interface Serial2
no ip address
shutdown
!
router ospf 1
log-adjacency-changes
network 20.0.0.0 0.255.255.255 area 0
network 172.16.0.0 0.0.255.255 area 0
network 192.168.1.0 0.0.0.63 area 0
network 192.168.1.64 0.0.0.63 area 0
network 192.168.1.128 0.0.0.31 area 0
network 192.168.1.160 0.0.0.31 area 0
!
ip classless
no ip http server
!
line con 0
line aux 0
line vty 0 4
password cisco
login
!
end
Router_Aのルーティングテーブルを表示します。
●Router_Aのルーティングテーブル
Gateway of last resort is not set
R 20.0.0.0/8 [120/10] via 10.0.0.2, 00:00:14, Serial0
172.16.0.0/24 is subnetted, 2 subnets
R 172.16.1.0 [120/10] via 10.0.0.2, 00:00:14, Serial0
R 172.16.2.0 [120/10] via 10.0.0.2, 00:00:14, Serial0
C 10.0.0.0/8 is directly connected, Serial0
192.168.1.0/24 is variably subnetted, 4 subnets, 2 masks
R 192.168.1.64/26 [120/10] via 10.0.0.2, 00:00:14, Serial0
R 192.168.1.0/26 [120/10] via 10.0.0.2, 00:00:14, Serial0
R 192.168.1.160/27 [120/10] via 10.0.0.2, 00:00:15, Serial0
R 192.168.1.128/27 [120/10] via 10.0.0.2, 00:00:15, Serial0
全てのルートが表示されています。
フィルタの作成と適用
Router_Bで、OSPFからRIPv2へ再配送する時に、標準アクセスリスト(ディストリビュートリスト)で送信するルートを192.168.1.0/26、192.168.1.64/26、192.168.1.128/27、192.168.1.160/27のルートだけにします。

●フィルタの作成
ルートごとに、異なるシードメトリックを設定するルートマップを作成します。ルートマップでは、再配送時にルートのフィルタだけでなく、ルートごとにシードメトリックを設定してメトリックを調整することができます。
はじめに、ルートマップで使用するアクセスリストを作成します。
Router_Bで標準アクセスリストを使って以下のアクセスリストを作成します。
Router_B(config)#access-list 1 permit 192.168.1.0
Router_B(config)#access-list 2 permit 192.168.1.64
Router_B(config)#access-list 3 permit 192.168.1.128
Router_B(config)#access-list 4 permit 192.168.1.160
次に、ルートマップを作成します。その際、ルートごとに異なるシードメトリックを与えます。
192.168.1.1/26 ・・・ シードメトリック5
192.168.1.64/26 ・・・ シードメトリック6
192.168.1.128/27 ・・・ シードメトリック7
192.168.1.160/27 ・・・ シードメトリック8
ルートマップの設定は、以下のようになります。
Router_B(config)#route-map ospf-to-rip permit 10
Router_B(config-route-map)#match ip address 1
Router_B(config-route-map)#set metric 5
Router_B(config-route-map)#route-map ospf-to-rip permit 20
Router_B(config-route-map)#match ip address 2
Router_B(config-route-map)#set metric 6
Router_B(config-route-map)#route-map ospf-to-rip permit 30
Router_B(config-route-map)#match ip address 3
Router_B(config-route-map)#set metric 7
Router_B(config-route-map)#route-map ospf-to-rip permit 40
Router_B(config-route-map)#match ip address 4
Router_B(config-route-map)#set metric 8

●フィルタの配置
Router_BでOSPFからRIPへ再配送時に、上で作成したフィルタを使って、ルートマップでルートのフィルタを行うように設定します。
はじめに、設定したルート再配送の設定、「redistribute ospf 1 metric 10」は、削除します。
Router_B(config)#router rip
Router_B(config-router)#no redistribute ospf 1 metric 10
Router_B(config-router)#redistribute ospf 1 route-map ospf-to-rip
Router_Bから再配送される経路情報は、192.168.1.0/26、192.168.1.64/26、192.168.1.128/27、192.168.1.160/27の4つのルートになり、各ルートには、異なるシードメトリックが設定され再配送されます。
Router_Aのルーティングテーブルを表示してみます。
●Router_Aのルーティングテーブル
Gateway of last resort is not set
C 10.0.0.0/8 is directly connected, Serial0
192.168.1.0/24 is variably subnetted, 4 subnets, 2 masks
R 192.168.1.64/26 [120/6] via 10.0.0.2, 00:00:01, Serial0
R 192.168.1.0/26 [120/5] via 10.0.0.2, 00:00:01, Serial0
R 192.168.1.160/27 [120/8] via 10.0.0.2, 00:00:01, Serial0
R 192.168.1.128/27 [120/7] via 10.0.0.2, 00:00:01, Serial0
R 172.16.1.0 [120/10] via 10.0.0.2, 00:00:14, Serial0
R 172.16.2.0 [120/10] via 10.0.0.2, 00:00:14, Serial0
のルートを受信しなくなりました。これは、Router_B側でルート情報の再送信時に、「172.16.1.0」「172.16.2.0」のルートがフィルタされたからです。
R 192.168.1.64/26 [120/6] via 10.0.0.2, 00:00:01, Serial0
R 192.168.1.0/26 [120/5] via 10.0.0.2, 00:00:01, Serial0
R 192.168.1.160/27 [120/8] via 10.0.0.2, 00:00:01, Serial0
R 192.168.1.128/27 [120/7] via 10.0.0.2, 00:00:01, Serial0
各ルートごとに指定したシードメトリックが反映されていることが確認できます。
