OSPFにはLSAというデータを交換するパケットがあります。このデータ交換に関するチューニング設定についてまとめます。高遅延・低帯域環境や高速な切替が求めれる現場など特殊な環境で必要になる技術です。
コマンド一覧
このシナリオで重要なコマンド一覧は以下の通りです。
Router(config)#router ospf <proc> Router(config-router)#timers pacing lsa-group <sec> Router(config)# interface <interface> Router(config-if)# ip ospf flood-reduction Router(config-if)# ip ospf demand-circuit Router(config-if)# ip ospf transmit-delay <sec> Router(config-if)# ip ospf retransmit-interval <sec>
構成図
動作確認の都合上、R1でVRFを設定し複数のOSPF processを動作させます。
192.168.12.0/24 (area 12)
s0/0 s0/0
+--------+.1 .2+--------+s0/2
| +----------+ | .2
| R1 | | R2 +------
| +----------+ | 192.168.2.0/24 (area 0)
+--------+.1 .2+--------+
s0/0 s0/0
VPN
192.168.21.0/24 (area 21)
[R1] ip vrf VPN rd 100:1 ! interface Serial0/0 ip address 192.168.12.1 255.255.255.0 ! interface Serial0/1 ip vrf forwarding VPN ip address 192.168.21.1 255.255.255.0 ! router ospf 21 vrf VPN capability vrf-lite network 192.168.21.1 0.0.0.0 area 21 ! router ospf 12 network 192.168.12.1 0.0.0.0 area 12 [R2] interface Loopback0 ip address 10.2.2.2 255.255.255.255 ! interface Serial0/0 ip address 192.168.12.2 255.255.255.0 ! interface Serial0/1 ip address 192.168.21.2 255.255.255.0 ! interface Serial0/2 ip address 192.168.2.2 255.255.255.0 no keepalive ! router ospf 1 network 10.2.2.2 0.0.0.0 area 0 network 192.168.2.2 0.0.0.0 area 0 network 192.168.12.2 0.0.0.0 area 12 network 192.168.21.2 0.0.0.0 area 21
設定全文は下記ファイルです。詳細設定は下記を参照ください。
仕様説明
LSA reflesh
LSAにはtimerという概念があります。何らかの拍子にLSAがうまく伝播しなかった事に備え、LSAは30分間隔で再送(reflesh)されます。
LSA timerは”show ip ospf database”コマンドにより確認する事ができます。
R1#show ip ospf 12 database summary 192.168.2.0
OSPF Router with ID (192.168.12.1) (Process ID 12)
Summary Net Link States (Area 12)
Routing Bit Set on this LSA
LS age: 1912
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 192.168.2.0 (summary Network Number)
Advertising Router: 10.2.2.2
LS Seq Number: 80000001
Checksum: 0xBFC1
Length: 28
Network Mask: /24
TOS: 0 Metric: 64
R1#
refleshされると、”LSA age”が0に戻り”LS Seq Number”が1つ大きくなります。LSAが2重で届いたとしても、ルータはLS Seq Numberを参照することで問題なく世代管理できます。
R1#show ip ospf 12 database summary 192.168.2.0
OSPF Router with ID (192.168.12.1) (Process ID 12)
Summary Net Link States (Area 12)
Routing Bit Set on this LSA
LS age: 157
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 192.168.2.0 (summary Network Number)
Advertising Router: 10.2.2.2
LS Seq Number: 80000002
Checksum: 0xBDC2
Length: 28
Network Mask: /24
TOS: 0 Metric: 64
R1#
lsa-group pacing
OSPFは、lsa-group pacingと呼ばれる一定間隔のLSA処理があります。処理内容は以下の通りです。
- 複数のLSAを1つのグループにまとる事でCPU負荷を軽減します。
- checksumによるLSA破損有無の確認を行います。
- aging timeが30分を過ぎていないかを確認し、30分を過ぎていた場合はそのLSAを再送します。
- aging timeが60分を過ぎていないかを確認し、60分を過ぎていた場合はそのLSAを破棄します。
デフォルトでlsa-group pacingは240秒間隔で行われます。lsa-group pacingが長ければ長い程、一斉に送られるLSAの数が多くなる確立が高くなるので、LSA refleshによる帯域枯渇が問題になる場合は、このパラメータを短めに設定します。lsa-group pacingのチューニングコマンドは以下の通りです。
Router(config)#router ospf <proc> Router(config-router)#timers pacing lsa-group <sec>
lsa-group group-pacingの様子は以下のコマンドで観察する事ができます。
R2#show ip ospf timers lsa-group
OSPF Router with ID (10.2.2.2) (Process ID 1)
Group size 5, Head 3, Search Index 4, Interval 240 sec
Next update due in 00:01:24
Current time 3982
Index 0 Timestamp 4066
Index 1 Timestamp 4319
Index 2 Timestamp 4572
Index 3 Timestamp 4822
Index 4 Timestamp 5079
Failure Head 0, Last 0 LSA group failure logged
R2#
flood reduce / demand circuit
停帯域なリンクではflood reduceまたはdemand circuitという機能を使用します。flood reduceは30分間隔のLSA refleshを抑制します。demand circuitはLSA refleshの抑制に加え、helloの定期送信も停止します。
設定コマンドは以下の通りです。
Router(config-if)# ip ospf flood-reduction Router(config-if)# ip ospf demand-circuit
high latency
遠隔地とOSPF neighborを確立する際は、遅延を考慮してtransmit-delay, retransmit-intervalをチューニングする事ができます。OSPF LSAは他のルータまで伝わる時間を考慮し、LS ageに1秒を加えた値を他のルータに伝播させます。transmit-delayを設定するとLS ageに加える時間を変更する事ができます。
Router(config-if)# ip ospf transmit-delay >sec<
デフォルトの挙動としてLSAの確認応答がない場合は5秒後に再送を行いますが、遠隔地かつ低帯域の場合は5秒以内に応答が返ってこないかもしれません。そのような場合は、以下のコマンドで再送間隔を変更する事ができます。
Router(config-if)# ip ospf retransmit-interval >sec<
flood-reduction
設定投入
R2 s0/0に対してflood-reductionを有効にし、30分間隔のLSA refleshを抑制します。
[R2] interface Serial0/0 ip ospf flood-reduction
動作確認
以下のshowコマンドR2 s0/0を確認すると、”Reduce LSA flooding”との記載がある事が読み取れます。
[R2]
R2#show ip ospf interface Serial 0/0
Serial0/0 is up, line protocol is up
Internet Address 192.168.12.2/24, Area 12
Process ID 1, Router ID 10.2.2.2, Network Type POINT_TO_POINT, Cost: 64
Reduce LSA flooding.
Transmit Delay is 1 sec, State POINT_TO_POINT
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:07
Supports Link-local Signaling (LLS)
Index 1/1, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 3
Last flood scan time is 0 msec, maximum is 4 msec
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 192.168.12.1
Suppress hello for 0 neighbor(s)
R2#
R1のOSPF process再起動後、R1のOSPF databaseを確認します。LS ageに“DoNotAge”と記載され、LS ageの増加が止まった事が読み取れます。
[R1]
R1#clear ip ospf process
Reset ALL OSPF processes? [no]: yes
R1#
R1#show ip ospf 12 database summary 192.168.2.0
OSPF Router with ID (192.168.12.1) (Process ID 12)
Summary Net Link States (Area 12)
Routing Bit Set on this LSA
LS age: 1825 (DoNotAge)
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 192.168.2.0 (summary Network Number)
Advertising Router: 10.2.2.2
LS Seq Number: 80000002
Checksum: 0xBDC2
Length: 28
Network Mask: /24
TOS: 0 Metric: 64
R1#
flood-reduction
設定投入
R2 s0/0に対してdemand-circuitを有効にし、LSA refleshとhelloを抑制します。
[R2] interface Serial0/0 no ip ospf flood-reduction ip ospf demand-circuit
動作確認
以下のshowコマンドR2 s0/0を確認すると”demand circuit”との記載があり、neighborには”Hello suppressed”との記載があります。
[R2]
R2#show ip ospf interface Serial 0/0
Serial0/0 is up, line protocol is up
Internet Address 192.168.12.2/24, Area 12
Process ID 1, Router ID 10.2.2.2, Network Type POINT_TO_POINT, Cost: 64
Configured as demand circuit.
Run as demand circuit.
DoNotAge LSA allowed.
Transmit Delay is 1 sec, State POINT_TO_POINT
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:04
Supports Link-local Signaling (LLS)
Index 1/1, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 3
Last flood scan time is 0 msec, maximum is 4 msec
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 192.168.12.1 (Hello suppressed)
Suppress hello for 1 neighbor(s)
R2#
R1のOSPF process再起動後、R1のOSPF databaseを確認します。flood-reductionと同様に、LS ageに“DoNotAge”と記載され、LS ageの増加が止まった事が読み取れます。
[R1]
R1#clear ip ospf process
Reset ALL OSPF processes? [no]: yes
R1#
R1#show ip ospf 12 database summary 192.168.2.0
OSPF Router with ID (192.168.12.1) (Process ID 12)
Summary Net Link States (Area 12)
Routing Bit Set on this LSA
LS age: 1967 (DoNotAge)
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 192.168.2.0 (summary Network Number)
Advertising Router: 10.2.2.2
LS Seq Number: 80000002
Checksum: 0xBDC2
Length: 28
Network Mask: /24
TOS: 0 Metric: 64
R1#
high latency
設定投入
R2 s0/0が高遅延のリンクであると仮定し、以下のような遅延対策の設定を投入します。
[R2] interface Serial0/0 ip ospf retransmit-interval 30 ip ospf transmit-delay 5
動作確認
transmit-delayが設定されたリンク経由と通常のリンク経由で受信したLSAを比較します。デフォルトでは1秒がLSAに加算され、transmit-delayが設定されたリンクでは5秒がLSAに加算されるはずです。両者のLSAを比較すると、想定通り4秒の差になっている事が読み取れます。
[R2]
R1#show ip ospf database summary 192.168.2.0
OSPF Router with ID (192.168.12.1) (Process ID 12)
Summary Net Link States (Area 12)
Routing Bit Set on this LSA
LS age: 113
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 192.168.2.0 (summary Network Number)
Advertising Router: 10.2.2.2
LS Seq Number: 80000003
Checksum: 0xBBC3
Length: 28
Network Mask: /24
TOS: 0 Metric: 64
OSPF Router with ID (192.168.21.1) (Process ID 21)
Summary Net Link States (Area 21)
Routing Bit Set on this LSA
LS age: 109
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 192.168.2.0 (summary Network Number)
Advertising Router: 10.2.2.2
LS Seq Number: 80000003
Checksum: 0xBBC3
Length: 28
Network Mask: /24
TOS: 0 Metric: 64
R1#
