今回はOSPFのTable Mapについて解説します。
座学
Table Map
Table Mapを使用することで、ルーティングテーブルに投入されるOSPFルートのメトリックを変更可能です。
また、Table Mapでは、In方向でDistribute Listと同様に、ルーティングテーブルに投入されるOSPFルートをフィルタリング可能です。
実機での動作確認1
検証内容
R1のg2、R2のg2とg3、R3のg2~g4でOSPF Area 0を有効にします。
Network TypeにはPoint-to-Pointを使用します。
R2でTable Mapを設定した場合の動作を確認します。
初期設定
interface GigabitEthernet2
ip address 10.1.1.1 255.255.255.0
ip ospf network point-to-point
!
router ospf 1
router-id 1.1.1.1
network 10.1.1.0 0.0.0.255 area 0
interface GigabitEthernet2
ip address 10.1.1.2 255.255.255.0
ip ospf network point-to-point
!
interface GigabitEthernet3
ip address 10.2.2.2 255.255.255.0
ip ospf network point-to-point
!
router ospf 1
router-id 2.2.2.2
network 10.1.1.0 0.0.0.255 area 0
network 10.2.2.0 0.0.0.255 area 0
interface GigabitEthernet2
ip address 10.2.2.3 255.255.255.0
ip ospf network point-to-point
!
interface GigabitEthernet3
ip address 10.3.3.3 255.255.255.0
!
interface GigabitEthernet4
ip address 10.4.4.3 255.255.255.0
!
router ospf 1
router-id 3.3.3.3
network 10.2.2.0 0.0.0.255 area 0
network 10.3.3.0 0.0.0.255 area 0
network 10.4.4.0 0.0.0.255 area 0
Table Map設定前
OSPFプロセスの状態確認
R2において、Table Mapが設定されていないことが確認できます。
R2#show ip protocols
*** IP Routing is NSF aware ***
Routing Protocol is "application"
Sending updates every 0 seconds
Invalid after 0 seconds, hold down 0, flushed after 0
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Maximum path: 32
Routing for Networks:
Routing Information Sources:
Gateway Distance Last Update
Distance: (default is 4)
Routing Protocol is "ospf 1"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 2.2.2.2
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
10.1.1.0 0.0.0.255 area 0
10.2.2.0 0.0.0.255 area 0
Routing Information Sources:
Gateway Distance Last Update
3.3.3.3 110 00:00:18
Distance: (default is 110)
LSDBの状態確認
R2が保有するR3のLSA Type 1には10.3.3.0/24と10.4.4.0/24のプレフィックス情報が存在することが確認できます。また、10.3.3.0/24と10.4.4.0/24のCostが1なことが確認できます。
R2#show ip ospf database router adv-router 3.3.3.3
OSPF Router with ID (2.2.2.2) (Process ID 1)
Router Link States (Area 0)
LS age: 233
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 3.3.3.3
Advertising Router: 3.3.3.3
LS Seq Number: 8000000E
Checksum: 0x771B
Length: 72
Number of Links: 4
Link connected to: a Stub Network
(Link ID) Network/subnet number: 10.4.4.0
(Link Data) Network Mask: 255.255.255.0
Number of MTID metrics: 0
TOS 0 Metrics: 1
Link connected to: a Stub Network
(Link ID) Network/subnet number: 10.3.3.0
(Link Data) Network Mask: 255.255.255.0
Number of MTID metrics: 0
TOS 0 Metrics: 1
Link connected to: another Router (point-to-point)
(Link ID) Neighboring Router ID: 2.2.2.2
(Link Data) Router Interface address: 10.2.2.3
Number of MTID metrics: 0
TOS 0 Metrics: 1
Link connected to: a Stub Network
(Link ID) Network/subnet number: 10.2.2.0
(Link Data) Network Mask: 255.255.255.0
Number of MTID metrics: 0
TOS 0 Metrics: 1
R1が保有するR3のLSA Type 1には10.3.3.0/24と10.4.4.0/24のプレフィックス情報が存在することが確認できます。また、10.3.3.0/24と10.4.4.0/24のCostが1なことが確認できます。
R2#show ip ospf database router adv-router 3.3.3.3
OSPF Router with ID (2.2.2.2) (Process ID 1)
Router Link States (Area 0)
LS age: 295
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 3.3.3.3
Advertising Router: 3.3.3.3
LS Seq Number: 8000000E
Checksum: 0x771B
Length: 72
Number of Links: 4
Link connected to: a Stub Network
(Link ID) Network/subnet number: 10.4.4.0
(Link Data) Network Mask: 255.255.255.0
Number of MTID metrics: 0
TOS 0 Metrics: 1
Link connected to: a Stub Network
(Link ID) Network/subnet number: 10.3.3.0
(Link Data) Network Mask: 255.255.255.0
Number of MTID metrics: 0
TOS 0 Metrics: 1
Link connected to: another Router (point-to-point)
(Link ID) Neighboring Router ID: 2.2.2.2
(Link Data) Router Interface address: 10.2.2.3
Number of MTID metrics: 0
TOS 0 Metrics: 1
Link connected to: a Stub Network
(Link ID) Network/subnet number: 10.2.2.0
(Link Data) Network Mask: 255.255.255.0
Number of MTID metrics: 0
TOS 0 Metrics: 1
SPFの計算結果の確認
R2はOSPF経由で10.3.3.0/24と10.4.4.0を学習しており、かつ、10.3.3.0/24と10.4.4.0/24の両方をルーティングテーブルに投入していることが確認できます。
R2#show ip ospf rib
OSPF Router with ID (2.2.2.2) (Process ID 1)
Base Topology (MTID 0)
OSPF local RIB
Codes: * - Best, > - Installed in global RIB
* 10.1.1.0/24, Intra, cost 1, area 0, Connected
via 10.1.1.2, GigabitEthernet2
* 10.2.2.0/24, Intra, cost 1, area 0, Connected
via 10.2.2.2, GigabitEthernet3
*> 10.3.3.0/24, Intra, cost 2, area 0
via 10.2.2.3, GigabitEthernet3
*> 10.4.4.0/24, Intra, cost 2, area 0
via 10.2.2.3, GigabitEthernet3
ルーティングテーブルの確認
R2のルーティングテーブルに10.3.3.0/24と10.4.4.0/24が投入されていることが確認できます。また、メトリックが2であることが確認できます。
R2#show ip route ospf
10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks
O 10.3.3.0/24 [110/2] via 10.2.2.3, 00:05:19, GigabitEthernet3
O 10.4.4.0/24 [110/2] via 10.2.2.3, 00:05:12, GigabitEthernet3
R1のルーティングテーブルに10.3.3.0/24と10.4.4.0/24が投入されていることが確認できます。また、メトリックが3であることが確認できます。
R1#show ip route ospf
10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
O 10.2.2.0/24 [110/2] via 10.1.1.2, 00:06:32, GigabitEthernet2
O 10.3.3.0/24 [110/3] via 10.1.1.2, 00:05:59, GigabitEthernet2
O 10.4.4.0/24 [110/3] via 10.1.1.2, 00:05:52, GigabitEthernet2
疎通確認
R1の10.1.1.1からR3の10.3.3.3と10.4.4.3へのPingが成功することが確認できます。
R1#ping 10.3.3.3 source 10.1.1.1
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.1.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
R1#ping 10.4.4.3 source 10.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.4.4.3, timeout is 2 seconds:
Packet sent with a source address of 10.1.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
Table Map設定後(filterオプション無し)
R2においてTable Mapを設定し、OSPFで学習したルート情報をルーティングテーブルに投入する際、10.3.3.0/24のメトリックを50に変更します。
追加した設定
Table Mapはtable-map <route-map-name>コマンドで設定可能です。
router ospf 1
table-map OSPF_ROUTE_MAP
!
ip prefix-list OSPF_PREFIX_LIST seq 5 permit 10.3.3.0/24
!
route-map OSPF_ROUTE_MAP permit 10
match ip address prefix-list OSPF_PREFIX_LIST
set metric 50
OSPFプロセスの状態確認
R2において、Table Mapが設定されていることが確認できます。
R2#show ip protocols
*** IP Routing is NSF aware ***
Routing Protocol is "application"
Sending updates every 0 seconds
Invalid after 0 seconds, hold down 0, flushed after 0
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Maximum path: 32
Routing for Networks:
Routing Information Sources:
Gateway Distance Last Update
Distance: (default is 4)
Routing Protocol is "ospf 1"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Mapping external information into routing table via 'OSPF_ROUTE_MAP'
Router ID 2.2.2.2
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
10.1.1.0 0.0.0.255 area 0
10.2.2.0 0.0.0.255 area 0
Routing Information Sources:
Gateway Distance Last Update
3.3.3.3 110 00:03:04
Distance: (default is 110)
LSDBの状態確認
R2が保有するR3のLSA Type 1の10.3.3.0/24のCostは1から変化がないことが確認できます。
R2#show ip ospf database router adv-router 3.3.3.3
OSPF Router with ID (2.2.2.2) (Process ID 1)
Router Link States (Area 0)
LS age: 233
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 3.3.3.3
Advertising Router: 3.3.3.3
LS Seq Number: 8000000E
Checksum: 0x771B
Length: 72
Number of Links: 4
Link connected to: a Stub Network
(Link ID) Network/subnet number: 10.4.4.0
(Link Data) Network Mask: 255.255.255.0
Number of MTID metrics: 0
TOS 0 Metrics: 1
Link connected to: a Stub Network
(Link ID) Network/subnet number: 10.3.3.0
(Link Data) Network Mask: 255.255.255.0
Number of MTID metrics: 0
TOS 0 Metrics: 1
Link connected to: another Router (point-to-point)
(Link ID) Neighboring Router ID: 2.2.2.2
(Link Data) Router Interface address: 10.2.2.3
Number of MTID metrics: 0
TOS 0 Metrics: 1
Link connected to: a Stub Network
(Link ID) Network/subnet number: 10.2.2.0
(Link Data) Network Mask: 255.255.255.0
Number of MTID metrics: 0
TOS 0 Metrics: 1
R1が保有するR3のLSA Type 1の10.3.3.0/24のCostは1から変化がないことが確認できます。
R1#show ip ospf database router adv-router 3.3.3.3
OSPF Router with ID (2.2.2.2) (Process ID 1)
Router Link States (Area 0)
LS age: 295
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 3.3.3.3
Advertising Router: 3.3.3.3
LS Seq Number: 8000000E
Checksum: 0x771B
Length: 72
Number of Links: 4
Link connected to: a Stub Network
(Link ID) Network/subnet number: 10.4.4.0
(Link Data) Network Mask: 255.255.255.0
Number of MTID metrics: 0
TOS 0 Metrics: 1
Link connected to: a Stub Network
(Link ID) Network/subnet number: 10.3.3.0
(Link Data) Network Mask: 255.255.255.0
Number of MTID metrics: 0
TOS 0 Metrics: 1
Link connected to: another Router (point-to-point)
(Link ID) Neighboring Router ID: 2.2.2.2
(Link Data) Router Interface address: 10.2.2.3
Number of MTID metrics: 0
TOS 0 Metrics: 1
Link connected to: a Stub Network
(Link ID) Network/subnet number: 10.2.2.0
(Link Data) Network Mask: 255.255.255.0
Number of MTID metrics: 0
TOS 0 Metrics: 1
SPFの計算結果の確認
R2はSPFの計算結果から、10.3.3.0/24のCostが2であることが確認できます。
R2#show ip ospf rib
OSPF Router with ID (2.2.2.2) (Process ID 1)
Base Topology (MTID 0)
OSPF local RIB
Codes: * - Best, > - Installed in global RIB
* 10.1.1.0/24, Intra, cost 1, area 0, Connected
via 10.1.1.2, GigabitEthernet2
* 10.2.2.0/24, Intra, cost 1, area 0, Connected
via 10.2.2.2, GigabitEthernet3
*> 10.3.3.0/24, Intra, cost 2, area 0
via 10.2.2.3, GigabitEthernet3
*> 10.4.4.0/24, Intra, cost 2, area 0
via 10.2.2.3, GigabitEthernet3
ルーティングテーブルの確認
R2のルーティングテーブル内の10.3.3.0/24のメトリックが50に変化したことが確認できます。
R2#show ip route ospf
10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks
O 10.3.3.0/24 [110/50] via 10.2.2.3, 00:10:11, GigabitEthernet3
O 10.4.4.0/24 [110/2] via 10.2.2.3, 00:10:11, GigabitEthernet3
R1のルーティングテーブル内の10.3.3.0/24のメトリックは3から変化していないことが確認できます。
R1#show ip route ospf
10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
O 10.2.2.0/24 [110/2] via 10.1.1.2, 00:06:32, GigabitEthernet2
O 10.3.3.0/24 [110/3] via 10.1.1.2, 00:05:59, GigabitEthernet2
O 10.4.4.0/24 [110/3] via 10.1.1.2, 00:05:52, GigabitEthernet2
Table Map設定後(filterオプション無し)
R2においてTable Mapを設定し、OSPFで学習したルート情報の中で10.3.3.0/24のみルーティングテーブルに投入します。
追加した設定
Table Mapでルート情報をフィルタリングするにはtable-map <route-map-name>コマンドのfilterオプションを使用します。
router ospf 1
table-map OSPF_ROUTE_MAP filter
!
ip prefix-list OSPF_PREFIX_LIST seq 5 permit 10.3.3.0/24
!
route-map OSPF_ROUTE_MAP permit 10
match ip address prefix-list OSPF_PREFIX_LIST
OSPFプロセスの状態確認
showコマンドの出力からは、filterオプションが有効なことは確認できません。
R2#show ip protocols
*** IP Routing is NSF aware ***
Routing Protocol is "application"
Sending updates every 0 seconds
Invalid after 0 seconds, hold down 0, flushed after 0
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Maximum path: 32
Routing for Networks:
Routing Information Sources:
Gateway Distance Last Update
Distance: (default is 4)
Routing Protocol is "ospf 1"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is (prefix-list) OSPF_PREFIX_LIST
Router ID 2.2.2.2
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
10.1.1.0 0.0.0.255 area 0
10.2.2.0 0.0.0.255 area 0
Routing Information Sources:
Gateway Distance Last Update
3.3.3.3 110 00:00:18
Distance: (default is 110)
LSDBの状態確認
R2が保有するR3のLSA Type 1には10.3.3.0/24と10.4.4.0/24のプレフィックス情報が存在することが確認できます。
R2#show ip ospf database router adv-router 3.3.3.3
OSPF Router with ID (2.2.2.2) (Process ID 1)
Router Link States (Area 0)
LS age: 233
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 3.3.3.3
Advertising Router: 3.3.3.3
LS Seq Number: 8000000E
Checksum: 0x771B
Length: 72
Number of Links: 4
Link connected to: a Stub Network
(Link ID) Network/subnet number: 10.4.4.0
(Link Data) Network Mask: 255.255.255.0
Number of MTID metrics: 0
TOS 0 Metrics: 1
Link connected to: a Stub Network
(Link ID) Network/subnet number: 10.3.3.0
(Link Data) Network Mask: 255.255.255.0
Number of MTID metrics: 0
TOS 0 Metrics: 1
Link connected to: another Router (point-to-point)
(Link ID) Neighboring Router ID: 2.2.2.2
(Link Data) Router Interface address: 10.2.2.3
Number of MTID metrics: 0
TOS 0 Metrics: 1
Link connected to: a Stub Network
(Link ID) Network/subnet number: 10.2.2.0
(Link Data) Network Mask: 255.255.255.0
Number of MTID metrics: 0
TOS 0 Metrics: 1
R1が保有するR3のLSA Type 1には10.3.3.0/24と10.4.4.0/24のプレフィックス情報が存在することが確認できます。これより、In方向のDistribute Listと同様にTable Map、LSAからプレフィックス情報が削除されないことが確認できます。
R1#show ip ospf database router adv-router 3.3.3.3
OSPF Router with ID (2.2.2.2) (Process ID 1)
Router Link States (Area 0)
LS age: 295
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 3.3.3.3
Advertising Router: 3.3.3.3
LS Seq Number: 8000000E
Checksum: 0x771B
Length: 72
Number of Links: 4
Link connected to: a Stub Network
(Link ID) Network/subnet number: 10.4.4.0
(Link Data) Network Mask: 255.255.255.0
Number of MTID metrics: 0
TOS 0 Metrics: 1
Link connected to: a Stub Network
(Link ID) Network/subnet number: 10.3.3.0
(Link Data) Network Mask: 255.255.255.0
Number of MTID metrics: 0
TOS 0 Metrics: 1
Link connected to: another Router (point-to-point)
(Link ID) Neighboring Router ID: 2.2.2.2
(Link Data) Router Interface address: 10.2.2.3
Number of MTID metrics: 0
TOS 0 Metrics: 1
Link connected to: a Stub Network
(Link ID) Network/subnet number: 10.2.2.0
(Link Data) Network Mask: 255.255.255.0
Number of MTID metrics: 0
TOS 0 Metrics: 1
SPFの計算結果の確認
R2はOSPF経由で10.3.3.0/24と10.4.4.0を学習していますが、10.3.3.0/24のみルーティングテーブルに投入していることが確認できます。
R2#show ip ospf rib
OSPF Router with ID (2.2.2.2) (Process ID 1)
Base Topology (MTID 0)
OSPF local RIB
Codes: * - Best, > - Installed in global RIB
* 10.1.1.0/24, Intra, cost 1, area 0, Connected
via 10.1.1.2, GigabitEthernet2
* 10.2.2.0/24, Intra, cost 1, area 0, Connected
via 10.2.2.2, GigabitEthernet3
*> 10.3.3.0/24, Intra, cost 2, area 0
via 10.2.2.3, GigabitEthernet3
* 10.4.4.0/24, Intra, cost 2, area 0
via 10.2.2.3, GigabitEthernet3
ルーティングテーブルの確認
R2のルーティングテーブルに10.3.3.0/24のみ投入され、10.4.4.0/24は投入されてないことが確認できます。
R2#show ip route ospf
10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
O 10.3.3.0/24 [110/2] via 10.2.2.3, 00:05:19, GigabitEthernet3
R1のルーティングテーブルに10.3.3.0/24と10.4.4.0/24が投入されていることが確認できます。
R1#show ip route ospf
10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
O 10.2.2.0/24 [110/2] via 10.1.1.2, 00:06:32, GigabitEthernet2
O 10.3.3.0/24 [110/3] via 10.1.1.2, 00:05:59, GigabitEthernet2
O 10.4.4.0/24 [110/3] via 10.1.1.2, 00:05:52, GigabitEthernet2
疎通確認
R1の10.1.1.1からR3の10.3.3.3へのPingは成功し、10.4.4.3へのPingが失敗することが確認できます。
R1#ping 10.3.3.3 source 10.1.1.1
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.1.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
R1#ping 10.4.4.3 source 10.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.4.4.3, timeout is 2 seconds:
Packet sent with a source address of 10.1.1.1
U.U.U
Success rate is 0 percent (0/5)
コメント