route-map による限定再配送と1デバイスインターフェース間の複数プロトコル再配送の注意点




条件
・R3にてLo0,1をRIPへ再配送してください。
・R2にてLo0をOSPFへ再配送してください。
・R2にてOSPFとRIPを相互に再配送してください。
・条件2にてRIPからOSPFへは30.30.30.30/32のみ再配送してください。
・RIPドメインから20.20.20.20へアクセスできるよう配慮してください。


まず下記設定からスタートです。

R1
interface Serial1/0
ip address 1.1.1.1 255.255.255.0
!
router ospf 1
 network 1.1.1.1 0.0.0.0 area 0

R2
interface Serial1/0
ip address 1.1.1.2 255.255.255.0
!
interface Serial1/1
ip address 2.2.2.2 255.255.255.0
!
interface lo0
ip address 20.20.20.20 255.255.255.0
!
router rip
version 2
net 2.2.2.0
redistribute ospf 1 metric 1
!
router ospf 1
network 1.1.1.2 0.0.0.0 area 0
redistribute connected subnets

R3
interface s1/1
ip add 2.2.2.3 255.255.255.0
!
interface lo0
ip add 30.30.30.30 255.255.255.255
!
interface lo1
ip add 31.31.31.31 255.255.255.255
!
router rip
version 2
net 2.2.2.0
redistribute connected metric 1



上記設定の状態で、R2,R3のループバックインターフェースが各プロトコルへ再配送されて
いますので、条件の2つめまでは達成されています。


R3#sh ip rip data
1.0.0.0/8    auto-summary
1.0.0.0/8
    [1] via 2.2.2.2, 00:00:21, Serial1/1
2.0.0.0/8    auto-summary
2.2.2.0/24    directly connected, Serial1/1
30.0.0.0/8    auto-summary
30.30.30.30/32    redistributed
    [1] via 0.0.0.0,
31.0.0.0/8    auto-summary
31.31.31.31/32    redistributed
    [1] via 0.0.0.0,

R2#sh ip ospf data

                Type-5 AS External Link States

Link ID         ADV Router      Age         Seq#       Checksum Tag
2.2.2.0         2.2.2.2         171         0x80000004 0x005D32 0
20.20.20.20     2.2.2.2         171         0x80000002 0x000E39 0


・R2にてOSPFとRIPを相互に再配送してください。
・条件2にてRIPからOSPFへは30.30.30.30/32のみ再配送してください。

3つめと4つめの条件ですが、まずはR2にて相互再配送とRIP→OSPFはroute-mapにてフィルタをかけます。

R2
router ospf 1
redistribute rip subnets route-map RIP2OSPF

router rip
redistribute ospf 1 metric 1

access-list 1 permit 30.0.0.0 0.0.0.0

route-map RIP2OSPF permit 10
match ip add 1

access-list で 30.0.0.0 を指定していることとしては、配送元がRIPなので、
30.30.30.30/32 は 30.0.0.0/8 でR2に広報されていることからです。
下記 sh ip route 参照。

R2#sh ip route
Gateway of last resort is not set

     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Serial1/0
     2.0.0.0/24 is subnetted, 1 subnets
C       2.2.2.0 is directly connected, Serial1/1
     20.0.0.0/32 is subnetted, 1 subnets
C       20.20.20.20 is directly connected, Loopback0
R    31.0.0.0/8 [120/1] via 2.2.2.3, 00:00:25, Serial1/1
R    30.0.0.0/8 [120/1] via 2.2.2.3, 00:00:25, Serial1/1


これで、R1では 31.31.31.31 は見えず、30.30.30.30 だけ教えてもらっている状態になります。

R1#sh ip route
Gateway of last resort is not set

     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Serial1/0
     2.0.0.0/24 is subnetted, 1 subnets
O E2    2.2.2.0 [110/20] via 1.1.1.2, 00:40:43, Serial1/0
     20.0.0.0/32 is subnetted, 1 subnets
O E2    20.20.20.20 [110/20] via 1.1.1.2, 00:41:23, Serial1/0
O E2 30.0.0.0/8 [110/20] via 1.1.1.2, 00:00:21, Serial1/0


これで達成かと思いきや、5つめの条件が、達成されていません。 R3にてsh ip route を見ると 20.20.20.20 への到達経路がありません。

R3#sh ip route
Gateway of last resort is not set

R    1.0.0.0/8 [120/1] via 2.2.2.2, 00:00:07, Serial1/1
     2.0.0.0/24 is subnetted, 1 subnets
C       2.2.2.0 is directly connected, Serial1/1
     31.0.0.0/32 is subnetted, 1 subnets
C       31.31.31.31 is directly connected, Loopback1
     30.0.0.0/32 is subnetted, 1 subnets
C       30.30.30.30 is directly connected, Loopback0

R2にてLo0 をOSPFに再配送し、OSPFをRIPに再配送したのになぜ、Lo0 がRIPへ
広報されていないのか、、、これはどうやら仕様らしい。
同一デバイスにてプロトコルAをプロトコルBに再配送し、プロトコルBをプロトコルC
に再配送してAがCへ再配送されることはないとのこと。公式文書はどっかにあるかな?

なので、R2のLo0をRIPへ直接再配送してやるしかないらしい。

R2
router rip
redistribute connected metric 1 route-map CONN2RIP

route-map CONN2RIP permit 10
match inteface lo0

ってかんじですね。

これで下記のように R3で 20.0.0.0 への経路が現れました。

R3#sh ip route
Gateway of last resort is not set

R    1.0.0.0/8 [120/1] via 2.2.2.2, 00:00:22, Serial1/1
     2.0.0.0/24 is subnetted, 1 subnets
C       2.2.2.0 is directly connected, Serial1/1
R    20.0.0.0/8 [120/1] via 2.2.2.2, 00:00:02, Serial1/1
     31.0.0.0/32 is subnetted, 1 subnets
C       31.31.31.31 is directly connected, Loopback1
     30.0.0.0/32 is subnetted, 1 subnets
C       30.30.30.30 is directly connected, Loopback0


更新日:2012年8月12日