Cisco IOS ルーティング – OSPF network typeの設定まとめ

スポンサーリンク

Hub & Spoke 環境におけるOSPF設定について考察します。この環境では、OSPF network type, DLCI mapping, DR(指定ルータ)などを考慮しなければ、互いに疎通可能な状態になりません。

概要

OSPF network typeについてまとめます。OSPF network tyepは以下6種類です。

network DR/BDR neighbor
自動検出
hello/dead 補足
broadcast 10/40
non-broadcast × 30/120
point-to-point × 10/40
point-to-multipoint × 30/120 neighbor単位のcost, database-filter設定可能
point-to-multipoint
non-broadcast
× 30/120 neighbor単位のcost, database-filter設定可能
loopback サブネットマスクを/32として通知します

network typeが明示指定されない場合は、デフォルトのnetwork typeが使用されます。network tyepはencapsulationの種類によって異なる事に注意して下さい。

interface network tyep
ethernet broadcast
HDLC point-to-point
frame relay main interface non-broadcast
fram relay sub interface point-to-point point-to-point
fram relay sub interface multipoint non-broadcast
loopback loopback

ここではstar型における、non broadcastとpoint-to-multipointの違いについて考察します。

構成図

以下の環境で動作確認を行います。R1をHubとするhub and Spoke(star topology)の構成です。

[ip address]
      +--------+                                              +--------+
      |   R2   +------┐                              ┌------+   R4   |
      +--------+.2   2│        s0/0      s0/1       2│    .4+--------+
              s0/0+---+----+1   .1+--------+.1   1+---+----+s0/0
                  |  FRSW1 +------+   R1   +------+  FRSW2 |
              s0/0+---+----+      +--------+      +---+----+s0/0
      +--------+.3   3│                             3│    .5+--------+
      |   R3   +------┘                              └------+   R5   |
      +--------+                                              +--------+
                      192.168.123.0/24        192.168.145.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

[frame relay mapping FRSW1]
 1:102 = 2:201
 1:103 = 3:301

[frame relay mapping FRSW1]
 1:104 = 2:401
 1:105 = 3:501
 [R1]
interface Serial0/0
 ip address 192.168.123.1 255.255.255.0
 encapsulation frame-relay
 frame-relay map ip 192.168.123.2 102 broadcast
 frame-relay map ip 192.168.123.3 103 broadcast
 no frame-relay inverse-arp
!
interface Serial0/1
 ip address 192.168.145.1 255.255.255.0
 encapsulation frame-relay
 frame-relay map ip 192.168.145.4 104 broadcast
 frame-relay map ip 192.168.145.5 105 broadcast
 no frame-relay inverse-arp

 [R2]
interface Serial0/0
 ip address 192.168.123.2 255.255.255.0
 encapsulation frame-relay
 frame-relay map ip 192.168.123.1 201 broadcast
 no frame-relay inverse-arp

 [R3]
interface Serial0/0
 ip address 192.168.123.3 255.255.255.0
 encapsulation frame-relay
 frame-relay map ip 192.168.123.1 301 broadcast
 no frame-relay inverse-arp

 [R4]
interface Serial0/0
 ip address 192.168.123.4 255.255.255.0
 encapsulation frame-relay
 frame-relay map ip 192.168.123.1 401 broadcast
 no frame-relay inverse-arp

 [R5]
interface Serial0/0
 ip address 192.168.123.5 255.255.255.0
 encapsulation frame-relay
 frame-relay map ip 192.168.123.5 501 broadcast
 no frame-relay inverse-arp

設定全文は下記ファイルです。ルーティングなどの詳細設定は下記を参照ください。

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 Serial0/0
 ip address 192.168.123.1 255.255.255.0
 encapsulation frame-relay
 serial restart-delay 0
 frame-relay map ip 192.168.123.2 102 broadcast
 frame-relay map ip 192.168.123.3 103 broadcast
 no frame-relay inverse-arp
!
interface Serial0/1
 ip address 192.168.145.1 255.255.255.0
 encapsulation frame-relay
 serial restart-delay 0
 frame-relay map ip 192.168.145.4 104 broadcast
 frame-relay map ip 192.168.145.5 105 broadcast
 no frame-relay inverse-arp
!
interface Serial0/2
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial0/3
 no ip address
 shutdown
 serial restart-delay 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 Serial0/0
 ip address 192.168.123.2 255.255.255.0
 encapsulation frame-relay
 serial restart-delay 0
 frame-relay map ip 192.168.123.1 201 broadcast
 no frame-relay inverse-arp
!
interface Serial0/1
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial0/2
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial0/3
 no ip address
 shutdown
 serial restart-delay 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 Serial0/0
 ip address 192.168.123.3 255.255.255.0
 encapsulation frame-relay
 serial restart-delay 0
 frame-relay map ip 192.168.123.1 301 broadcast
 no frame-relay inverse-arp
!
interface Serial0/1
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial0/2
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial0/3
 no ip address
 shutdown
 serial restart-delay 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 Serial0/0
 ip address 192.168.145.4 255.255.255.0
 encapsulation frame-relay
 serial restart-delay 0
 frame-relay map ip 192.168.145.1 401 broadcast
 no frame-relay inverse-arp
!
interface Serial0/1
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial0/2
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial0/3
 no ip address
 shutdown
 serial restart-delay 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 Serial0/0
 ip address 192.168.145.5 255.255.255.0
 encapsulation frame-relay
 serial restart-delay 0
 frame-relay map ip 192.168.145.1 501 broadcast
 no frame-relay inverse-arp
!
interface Serial0/1
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial0/2
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial0/3
 no ip address
 shutdown
 serial restart-delay 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

non broadcast

DR考慮漏れによる不具合

R1, R2, R3間でOSPF neighborを確立するよう設定します。OSPF network typeはデフォルトのnon broadcastとします。

 [R1]
router ospf 1
 network 0.0.0.0 255.255.255.255 area 0
 neighbor 192.168.123.2
 neighbor 192.168.123.3

 [R2]
router ospf 1
 network 0.0.0.0 255.255.255.255 area 0
 neighbor 192.168.123.1

 [R3]
router ospf 1
 network 0.0.0.0 255.255.255.255 area 0
 neighbor 192.168.123.1

star topologyの場合はDRルータの位置を考慮しないと、type 2 Network LSAが想定通りに交換されません。

DRルータの位置を考慮しないとどのような不具合が起きるのかを確認します。コマンドの投入順によっては不具合が起きない可能性もありますので、R1, R2, R3でclear ip ospf processを入力して下さい。

 [R1]
# clear ip ospf process

 [R2]
# clear ip ospf process

 [R3]
# clear ip ospf process

R1, R2, R3間はneighborを確立できています。しかし、R3との疎通はうまくいかないようです。

R1#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
10.2.2.2          1   FULL/DR         00:01:57    192.168.123.2   Serial0/0
10.3.3.3          1   FULL/DROTHER    00:01:42    192.168.123.3   Serial0/0
R1#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
10.2.2.2          1   FULL/DR         00:01:55    192.168.123.2   Serial0/0
10.3.3.3          1   FULL/DROTHER    00:01:40    192.168.123.3   Serial0/0
R1#
R1#
R1#show ip route ospf
     10.0.0.0/32 is subnetted, 2 subnets
O       10.2.2.2 [110/65] via 192.168.123.2, 00:01:55, Serial0/0
R1#

これはR2がDRルータになっているためです。DRルータは各ルータのRouter LSAを収集してNetwork LSAをadvertiseする役割がありますので、HubルータがDRルータになるよう設定しなければなりません。

DRを意識した設定

以下のコマンドでDRルータとしてpriorityを設定できます。
“ip ospf priority 0″とするとDRとして選ばれないようになり、
0以外の場合は数字が小さいほど優先的にDRとして選ばれます。

Router(config-if)# ip ospf priority <num>

R2, R3に以下コマンドを投入し、R1が必ずDRになるように設定します。

 [R2]
interface Serial0/0
 ip ospf priority 0

 [R3]
interface Serial0/0
 ip ospf priority 0

R1がDRとして選出された事を確認します。

R1#show ip ospf interface brief
Interface    PID   Area            IP Address/Mask    Cost  State Nbrs F/C
Lo0          1     0               10.1.1.1/32        1     LOOP  0/0
Se0/1        1     0               192.168.145.1/24   64    DR    0/0
Se0/0        1     0               192.168.123.1/24   64    DR    2/2
R1#

疎通確認

R2, R3間の疎通確認を行います。まずはR2のルーティングテーブルを確認します。10.3.3.3のnext-hopは192.168.123.3になっており、R1を経由せず直接R3へ転送されます。(後述のpoint-to-multipointの場合と挙動が異なるので、注意深く挙動の違いを追いかけて下さい)

R2#show ip route ospf
O    192.168.145.0/24 [110/128] via 192.168.123.1, 00:06:04, Serial0/0
     10.0.0.0/32 is subnetted, 3 subnets
O       10.3.3.3 [110/65] via 192.168.123.3, 00:06:04, Serial0/0
O       10.1.1.1 [110/65] via 192.168.123.1, 00:06:04, Serial0/0
R2#

R2において192.168.123.3に対するDLCIが定義されていないので、R2, R3で互いに疎通可能になるようにするには以下設定が必要です。

 [R2]
interface Serial0/0
 frame-relay map ip 192.168.123.3 201

 [R3]
interface Serial0/0
 frame-relay map ip 192.168.123.2 301

R2, R3間で疎通可能な事を確認します。

R2#ping 10.3.3.3 source 10.2.2.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.3.3.3, timeout is 2 seconds:
Packet sent with a source address of 10.2.2.2
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 28/52/76 ms
R2#

point-to-multipoint

設定投入

R1, R4, R5間でOSPF neighborを確立します。OSPF network typeはpoint-to-multipointとします。

 [R1]
router ospf 1
 network 0.0.0.0 255.255.255.255 area 0
!
interface Serial0/1
 ip ospf network point-to-multipoint

 [R2]
router ospf 1
 network 0.0.0.0 255.255.255.255 area 0
!
interface Serial0/0
 ip ospf network point-to-multipoint

 [R3]
router ospf 1
 network 0.0.0.0 255.255.255.255 area 0
!
interface Serial0/0
 ip ospf network point-to-multipoint

疎通確認

R4, R5間の疎通確認を行います。まずはR4のルーティングテーブルを確認します。10.5.5.5へのnext-hopは192.168.145.1となっており、一度HubルータであるR1を経由している事が分かります。

point-to-multi-pointはtype 2Netowrk LSAを交換せず、tyep 1 Router LSAにリンク情報を付与してadvertiseします。従って、DRルータを意識する必要がなく、また、Hub間のframe relay mapを定義する必要もありません

R4#show ip route ospf
O    192.168.123.0/24 [110/128] via 192.168.145.1, 00:01:44, Serial0/0
     192.168.145.0/24 is variably subnetted, 3 subnets, 2 masks
O       192.168.145.1/32 [110/64] via 192.168.145.1, 00:01:44, Serial0/0
O       192.168.145.5/32 [110/128] via 192.168.145.1, 00:01:44, Serial0/0
     10.0.0.0/32 is subnetted, 3 subnets
O       10.1.1.1 [110/65] via 192.168.145.1, 00:01:44, Serial0/0
O       10.5.5.5 [110/129] via 192.168.145.1, 00:01:44, Serial0/0
R4#

R4, R5間の疎通確認を行います。R4, R5間のframe relay mapの定義なしで、互いに疎通可能な事を確認します。

R4#show frame-relay map
Serial0/0 (up): ip 192.168.145.1 dlci 401(0x191,0x6410), static,
              broadcast,
              CISCO, status defined, active
R4#
R4#
R4#ping 10.5.5.5 source 10.4.4.4

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.5.5.5, timeout is 2 seconds:
Packet sent with a source address of 10.4.4.4
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 36/47/68 ms
R4#
タイトルとURLをコピーしました