2017年5月11日木曜日

OSPF 外部経路集約

◾️OSPF 外部経路集約

 【課題】
  ・以下の構成図のようなOSPFマルチエリアを構築し他ルーティングドメインの経路
  を集約する。
   [集約経路]
    172.16.1.0/24~172.16.5.0/24を172.16.0.0/21に集約する。


◾️検証環境図












①検証環境 事前設定確認

(1)OSPFネイバー確認
 OSPFネイバーが正常に張れている事を確認する。
R1#show ip ospf neighbor 

Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.2           1   FULL/BDR        00:00:35    192.168.12.2    Ethernet0/0


R2#show ip ospf neighbor 

Neighbor ID     Pri   State           Dead Time   Address         Interface
192.168.12.2      1   FULL/DR         00:00:32    192.168.12.1    Ethernet0/0
172.16.5.3        1   FULL/BDR        00:00:36    192.168.23.3    Ethernet0/1


R3#show ip ospf neighbor 

Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.2           1   FULL/DR         00:00:31    192.168.23.2    Ethernet0/1

(2)OSPFインターフェース確認
 エリア設定が正しい事を確認する。
R1#show ip ospf interface brief 
Interface    PID   Area            IP Address/Mask    Cost  State Nbrs F/C
Lo0          1     0               1.1.1.1/32         1     LOOP  0/0
Et0/0        1     0               192.168.12.1/24    10    DR    1/1


R2#show ip ospf interface brief 
Interface    PID   Area            IP Address/Mask    Cost  State Nbrs F/C
Lo0          1     0               2.2.2.2/32         1     LOOP  0/0
Et0/0        1     0               192.168.12.2/24    10    BDR   1/1
Et0/1        1     10              192.168.23.2/24    10    DR    1/1


R3#show ip ospf interface brief 
Interface    PID   Area            IP Address/Mask    Cost  State Nbrs F/C
Lo0          1     10              3.3.3.3/32         1     LOOP  0/0
Et0/1        1     10              192.168.23.3/24    10    BDR   1/1

R3#show ip interface brief | include Loopback
Interface                  IP-Address      OK? Method Status                Protocol
Loopback0                  3.3.3.3         YES manual up                    up      
Loopback1                  172.16.1.3      YES manual up                    up      
Loopback2                  172.16.2.3      YES manual up                    up      
Loopback3                  172.16.3.3      YES manual up                    up      
Loopback4                  172.16.4.3      YES manual up                    up      
Loopback5                  172.16.5.3      YES manual up                    up    

(3)ルーティング確認

172.16.x.x経路を集約します。
R1#sh ip route ospf

Gateway of last resort is not set

      2.0.0.0/32 is subnetted, 1 subnets
O        2.2.2.2 [110/11] via 192.168.12.2, 01:28:56, Ethernet0/0
      3.0.0.0/32 is subnetted, 1 subnets
O IA     3.3.3.3 [110/21] via 192.168.12.2, 01:27:06, Ethernet0/0
      172.16.0.0/24 is subnetted, 5 subnets
O E2     172.16.1.0 [110/20] via 192.168.12.2, 00:00:17, Ethernet0/0 //この経路を集約する
O E2     172.16.2.0 [110/20] via 192.168.12.2, 00:00:17, Ethernet0/0 //この経路を集約する
O E2     172.16.3.0 [110/20] via 192.168.12.2, 00:00:17, Ethernet0/0 //この経路を集約する
O E2     172.16.4.0 [110/20] via 192.168.12.2, 00:00:17, Ethernet0/0 //この経路を集約する
O E2     172.16.5.0 [110/20] via 192.168.12.2, 00:00:17, Ethernet0/0 //この経路を集約する
O IA  192.168.23.0/24 [110/20] via 192.168.12.2, 01:28:56, Ethernet0/0



R1#show ip ospf database | be Type-5 AS External
Type-5 AS External Link States

Link ID         ADV Router      Age         Seq#       Checksum Tag
172.16.1.0      172.16.5.3      151         0x80000001 0x008F8E 0 //この経路を集約する
172.16.2.0      172.16.5.3      151         0x80000001 0x008498 0 //この経路を集約する
172.16.3.0      172.16.5.3      151         0x80000001 0x0079A2 0 //この経路を集約する
172.16.4.0      172.16.5.3      151         0x80000001 0x006EAC 0 //この経路を集約する
172.16.5.0      172.16.5.3      151         0x80000001 0x0063B6 0 //この経路を集約する


②設定変更1(集約の設定)


(1)R3にて172.16.1.0/24~172.16.5.0/24を172.16.0.0/21に集約する。
R3(config)#route-map loopback-to-ospf permit 10
R3(config-route-map)#match interface loopback 1
R3(config-route-map)#match interface loopback 2
R3(config-route-map)#match interface loopback 3
R3(config-route-map)#match interface loopback 4
R3(config-route-map)#match interface loopback 5




R3(config)#router ospf 1
R3(config-router)#redistribute connected subnets route-map loopback-to-ospf
R3(config-router)#summary-address 172.16.0.0 255.255.248.0


(2)R1.R2にてルーティングテーブルを確認する。

個別経路(172.16.1.0/24~172.16.5.0/24)がない事、左記経路が集約されている事を確認する。
R1#sh ip route ospf

Gateway of last resort is not set

      2.0.0.0/32 is subnetted, 1 subnets
O        2.2.2.2 [110/11] via 192.168.12.2, 01:35:52, Ethernet0/0
      3.0.0.0/32 is subnetted, 1 subnets
O IA     3.3.3.3 [110/21] via 192.168.12.2, 01:34:02, Ethernet0/0
      172.16.0.0/21 is subnetted, 1 subnets
O E2     172.16.0.0 [110/20] via 192.168.12.2, 00:01:26, Ethernet0/0 //経路されている事を確認

O IA  192.168.23.0/24 [110/20] via 192.168.12.2, 01:35:52, Ethernet0/0


R2#sh ip route ospf

Gateway of last resort is not set

      1.0.0.0/32 is subnetted, 1 subnets
O        1.1.1.1 [110/11] via 192.168.12.1, 00:09:42, Ethernet0/0
      3.0.0.0/32 is subnetted, 1 subnets
O        3.3.3.3 [110/11] via 192.168.23.3, 00:09:42, Ethernet0/1
      172.16.0.0/21 is subnetted, 1 subnets
O E2     172.16.0.0 [110/20] via 192.168.23.3, 00:01:43, Ethernet0/1 //経路されている事を確認

(3)R3にてルーティングテーブルを確認する。
集約した経路に対するNull0が自動でルーティングテーブルへインストールされてる事を

確認する。※ループ防止の為
R3#sh ip route ospf

Gateway of last resort is not set

      1.0.0.0/32 is subnetted, 1 subnets
O IA     1.1.1.1 [110/21] via 192.168.23.2, 01:37:29, Ethernet0/1
      2.0.0.0/32 is subnetted, 1 subnets
O IA     2.2.2.2 [110/11] via 192.168.23.2, 01:37:29, Ethernet0/1
      172.16.0.0/16 is variably subnetted, 11 subnets, 3 masks
O        172.16.0.0/21 is a summary, 00:04:56, Null0   //ループ防止の為、自動的にNull経路が入る
O IA  192.168.12.0/24 [110/20] via 192.168.23.2, 01:37:29, Ethernet0/1

(4)R3のルーティングテーブル上のNull0経路を削除する。
R3(config)#router ospf 1
R3(config-router)#no discard-route external 

(5)R3のルーティングテーブルする。
 Null0経路が削除されている事を確認する。
R3#sh ip route ospf

Gateway of last resort is not set

      1.0.0.0/32 is subnetted, 1 subnets
O IA     1.1.1.1 [110/21] via 192.168.23.2, 00:00:04, Ethernet0/1
      2.0.0.0/32 is subnetted, 1 subnets
O IA     2.2.2.2 [110/11] via 192.168.23.2, 00:00:04, Ethernet0/1
O IA  192.168.12.0/24 [110/20] via 192.168.23.2, 00:00:04, Ethernet0/1