Cisco IOS ルーティング – OSPF virtual linkの設定

スポンサーリンク

OSPFにはバックボーンエリア(Area 0)という概念があり、全てのエリアはバックボーンに接続されていなければなりません。もし、非バックボーンエリア間を接続したい場合は、virtual linkという特殊な設定を使用します。

コマンド一覧

このシナリオで重要なコマンド一覧は以下の通りです。

Router(config)# router ospf <proc>
Router(config-router)# area <num> virtual-link <remote_router_id>

構成図

以下の構成で動作確認を行います。

    area 23                          area 0                       area 45 stub
    <------><------------------------------------------------------><------>
         e0/1      e0/0                                  e0/0      e0/1
         .2+--------+.2                                  .4+--------+.4
       ┌--+   R2   +------┐                      ┌------+   R4   +--┐
       │  +--------+      │    e0/0      30/1    │      +--------+  │
       │                  │    .1+--------+.1    │                  │
       │                  ├------+   R1   +------┤                  │
       │                  │      +--------+      │                  │
       │  +--------+      │                      │      +--------+  │
       └--+   R3   +------┘                      └------+   R5   +--┘
         .3+--------+.3                                  .5+--------+.5
         e0/1      e0/0                                  e0/0      e0/1

 192.168.23.0/24   192.168.123.0/24          192.168.145.0/24   192.168.45.0/24

 R2 Loopback0     R3 Loopback0     R1 Loopback0     R4 Loopback0     R5 Loopback0
 10.2.2.2/32      10.3.3.3/32      10.1.1.1/32      10.4.4.4/32      10.5.5.5/32
 [R1]
router ospf 1
 network 10.1.1.1 0.0.0.0 area 0
 network 192.168.123.1 0.0.0.0 area 0
 network 192.168.145.1 0.0.0.0 area 0

 [R2]
router ospf 1
 network 10.2.2.2 0.0.0.0 area 0
 network 192.168.23.2 0.0.0.0 area 23
 network 192.168.123.2 0.0.0.0 area 0

 [R3]
router ospf 1
 network 10.3.3.3 0.0.0.0 area 0
 network 192.168.23.3 0.0.0.0 area 23
 network 192.168.123.3 0.0.0.0 area 0

 [R4]
router ospf 1
 area 45 stub
 network 10.4.4.4 0.0.0.0 area 0
 network 192.168.45.4 0.0.0.0 area 45
 network 192.168.145.4 0.0.0.0 area 0

 [R5]
router ospf 1
 area 45 stub
 network 10.5.5.5 0.0.0.0 area 0
 network 192.168.45.5 0.0.0.0 area 45
 network 192.168.145.5 0.0.0.0 area 0

設定全文は下記ファイルです。詳細設定は下記を参照ください。

R1
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R1
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
 ip address 10.1.1.1 255.255.255.255
!
interface Ethernet0/0
 ip address 192.168.123.1 255.255.255.0
 half-duplex
!
interface Ethernet0/1
 ip address 192.168.145.1 255.255.255.0
 half-duplex
!
interface Ethernet0/2
 no ip address
 shutdown
 half-duplex
!
interface Ethernet0/3
 no ip address
 shutdown
 half-duplex
!
!
router ospf 1
 log-adjacency-changes
 network 10.1.1.1 0.0.0.0 area 0
 network 192.168.123.1 0.0.0.0 area 0
 network 192.168.145.1 0.0.0.0 area 0
!
ip http server
ip forward-protocol nd
!
!
!
!
!
!
control-plane
!
!
!
!
mgcp behavior g729-variants static-pt
!
!
!
!
!
line con 0
line aux 0
line vty 0 4
 login
!
!
end
R2
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R2
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
 ip address 10.2.2.2 255.255.255.255
!
interface Ethernet0/0
 ip address 192.168.123.2 255.255.255.0
 half-duplex
!
interface Ethernet0/1
 ip address 192.168.23.2 255.255.255.0
 half-duplex
!
interface Ethernet0/2
 no ip address
 shutdown
 half-duplex
!
interface Ethernet0/3
 no ip address
 shutdown
 half-duplex
!
!
router ospf 1
 log-adjacency-changes
 network 10.2.2.2 0.0.0.0 area 0
 network 192.168.23.2 0.0.0.0 area 23
 network 192.168.123.2 0.0.0.0 area 0
!
ip http server
ip forward-protocol nd
!
!
!
!
!
!
control-plane
!
!
!
!
mgcp behavior g729-variants static-pt
!
!
!
!
!
line con 0
line aux 0
line vty 0 4
 login
!
!
end
R3
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R3
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
 ip address 10.3.3.3 255.255.255.255
!
interface Ethernet0/0
 ip address 192.168.123.3 255.255.255.0
 half-duplex
!
interface Ethernet0/1
 ip address 192.168.23.3 255.255.255.0
 half-duplex
!
interface Ethernet0/2
 no ip address
 shutdown
 half-duplex
!
interface Ethernet0/3
 no ip address
 shutdown
 half-duplex
!
!
router ospf 1
 log-adjacency-changes
 network 10.3.3.3 0.0.0.0 area 0
 network 192.168.23.3 0.0.0.0 area 23
 network 192.168.123.3 0.0.0.0 area 0
!
ip http server
ip forward-protocol nd
!
!
!
!
!
!
control-plane
!
!
!
!
mgcp behavior g729-variants static-pt
!
!
!
!
!
line con 0
line aux 0
line vty 0 4
 login
!
!
end
R4
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R4
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
 ip address 10.4.4.4 255.255.255.255
!
interface Ethernet0/0
 ip address 192.168.145.4 255.255.255.0
 half-duplex
!
interface Ethernet0/1
 ip address 192.168.45.4 255.255.255.0
 half-duplex
!
interface Ethernet0/2
 no ip address
 shutdown
 half-duplex
!
interface Ethernet0/3
 no ip address
 shutdown
 half-duplex
!
!
router ospf 1
 log-adjacency-changes
 area 45 stub
 network 10.4.4.4 0.0.0.0 area 0
 network 192.168.45.4 0.0.0.0 area 45
 network 192.168.145.4 0.0.0.0 area 0
!
ip http server
ip forward-protocol nd
!
!
!
!
!
!
control-plane
!
!
!
!
mgcp behavior g729-variants static-pt
!
!
!
!
!
line con 0
line aux 0
line vty 0 4
 login
!
!
end
R5
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R5
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
 ip address 10.5.5.5 255.255.255.255
!
interface Ethernet0/0
 ip address 192.168.145.5 255.255.255.0
 half-duplex
!
interface Ethernet0/1
 ip address 192.168.45.5 255.255.255.0
 half-duplex
!
interface Ethernet0/2
 no ip address
 shutdown
 half-duplex
!
interface Ethernet0/3
 no ip address
 shutdown
 half-duplex
!
!
router ospf 1
 log-adjacency-changes
 area 45 stub
 network 10.5.5.5 0.0.0.0 area 0
 network 192.168.45.5 0.0.0.0 area 45
 network 192.168.145.5 0.0.0.0 area 0
!
ip http server
ip forward-protocol nd
!
!
!
!
!
!
control-plane
!
!
!
!
mgcp behavior g729-variants static-pt
!
!
!
!
!
line con 0
line aux 0
line vty 0 4
 login
!
!
end

virtual link

仕様説明

以下コマンドでvirtual linkを定義します。

Router(config)# router ospf <proc>
Router(config-router)# area <num> virtual-link <remote_router_id>

virtual link 設定

R2 e0/0に障害が発生した場合、OSPFの仕様上area 0を跨ぐ事はできないのでR2 Lo0への疎通が不能となってしまいます。このような障害に備えるためにはvirtual linkを定義する必要があります。

まず、R2 e0/0をshutdown させます。

 [R2]
interface Ethernet 0/0
 shutdown

以下のようなvirtual linkを作成し、R2 lo0への疎通を確保します。

 [R2]
router ospf 1
 area 23 virtual-link 10.3.3.3

 [R3]
router ospf 1
 area 23 virtual-link 10.2.2.2

virtual linkkが確立された事を確認します。

 [R3]
R3#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
10.2.2.2          0   FULL/  -           -        192.168.23.2    OSPF_VL0
10.1.1.1          1   FULL/DR         00:00:35    192.168.123.1   Ethernet0/0
10.2.2.2          1   FULL/DR         00:00:38    192.168.23.2    Ethernet0/1
R3#

R2 lo0(10.2.2.2)への疎通を確認します。

 [R1]
R1#traceroute 10.2.2.2

Type escape sequence to abort.
Tracing the route to 10.2.2.2

  1 192.168.123.3 36 msec 44 msec 20 msec
  2 192.168.23.2 40 msec *  60 msec
R1#

tunnleの代用

R4 e0/0の障害について考察します。

 [R4]
interface Ethernet 0/0
 shutdown

先程と同様にvirtual linkによる設定を試みますが、stub, nssaに対してはvirtual linkを設定できないようです。このようにvirtual linkの設定が使えない場合は、tunnelを作成する事を考えます。

 [R4]
R4(config)#router ospf 1
R4(config-router)#area 45 virtual-link 10.5.5.5
% OSPF: Area 45 is a stub or nssa so virtual links are not allowed
R4(config-router)#

以下のようなtunnelを作成し、area 0を仮想的に接続します。tunnel間は、OSPFのマルチキャストパケットのみを疎通可能にすればよいので、IPアドレスの設定は必要ありません。

仕様理解のために、ここではやや複雑なip unnumbered Loopback 0を使用した設定例を紹介します。(これは仕様理解を目的とした複雑な設定です。実務では「分かりやすさ」を重視する事が多いと思いますので、実務では複雑な設定は避けるようにしましょう。)

 [R4]
interface Tunnel0
 ip unnumbered Loopback0
 tunnel source Ethernet0/1
 tunnel destination 192.168.45.5

 [R5]
interface Tunnel0
 ip unnumbered Loopback0
 tunnel source Ethernet0/1
 tunnel destination 192.168.45.4

tunnel経由でneighborが確立された事を確認します。

 [R5]
R5#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
10.4.4.4          0   FULL/  -        00:00:34    10.4.4.4        Tunnel0
10.1.1.1          1   FULL/DR         00:00:33    192.168.145.1   Ethernet0/0
10.4.4.4          1   FULL/BDR        00:00:34    192.168.45.4    Ethernet0/1
R5#
R5#
R5#show ip route ospf
O    192.168.123.0/24 [110/20] via 192.168.145.1, 00:00:31, Ethernet0/0
     10.0.0.0/32 is subnetted, 5 subnets
O       10.2.2.2 [110/31] via 192.168.145.1, 00:00:31, Ethernet0/0
O       10.3.3.3 [110/21] via 192.168.145.1, 00:00:31, Ethernet0/0
O       10.1.1.1 [110/11] via 192.168.145.1, 00:00:31, Ethernet0/0
O       10.4.4.4 [110/11112] via 10.4.4.4, 00:00:31, Tunnel0
O IA 192.168.23.0/24 [110/30] via 192.168.145.1, 00:00:31, Ethernet0/0
R5#

R4 lo0(10.4.4.4)への疎通を確認します。

 [R1]
R1#traceroute 10.4.4.4

Type escape sequence to abort.
Tracing the route to 10.4.4.4

  1 192.168.145.5 44 msec 28 msec 20 msec
  2 10.4.4.4 48 msec *  80 msec
R1#
タイトルとURLをコピーしました