DynagenでCCIEを目指す
20100422 OSPF 経路集約
最終更新:
it_certification
-
view
目的
- OSPFの経路集約の方法を確認します。
構成
- 設定概要
- OSPFによってルーティングします。
- 構成図

- netファイル
ghostios = True sparsemem = True model = 3620 [localhost] [[3620]] image = C:\Program Files\Dynamips\images\c3620-j1s3-mz.123-18.bin ram = 256 [[ROUTER R1]] e0/0 = R2 e0/1 [[ROUTER R2]] e0/0 = R3 e0/1 [[ROUTER R3]]
- 初期設定 R1
! version 12.3 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 ip subnet-zero ! ! ! ip cef ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! interface Loopback0 ip address 1.1.1.1 255.255.255.255 ! interface Ethernet0/0 ip address 192.168.12.1 255.255.255.0 full-duplex ! interface Ethernet0/1 ip address 192.168.10.1 255.255.255.0 full-duplex no keepalive ! interface Ethernet0/2 no ip address shutdown half-duplex ! interface Ethernet0/3 no ip address shutdown half-duplex ! router ospf 1 log-adjacency-changes redistribute connected network 192.168.10.0 0.0.0.255 area 0 network 192.168.12.0 0.0.0.255 area 0 ! ip http server ip classless ! ! ! ! ! ! ! ! line con 0 line aux 0 line vty 0 4 login ! ! end
- 初期設定 R2
! version 12.3 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 ip subnet-zero ! ! ! ip cef ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! interface Loopback0 ip address 2.2.2.2 255.255.255.255 ! interface Ethernet0/0 ip address 192.168.23.2 255.255.255.0 full-duplex ! interface Ethernet0/1 ip address 192.168.12.2 255.255.255.0 full-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 redistribute connected network 192.168.12.0 0.0.0.255 area 0 network 192.168.23.0 0.0.0.255 area 1 ! ip http server ip classless ! ! ! ! ! ! ! ! line con 0 line aux 0 line vty 0 4 login ! ! end
- 初期設定 R3
! version 12.3 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 ip subnet-zero ! ! ! ip cef ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! interface Loopback0 ip address 3.3.3.3 255.255.255.255 ! interface Ethernet0/0 ip address 10.0.10.3 255.255.255.0 full-duplex no keepalive ! interface Ethernet0/1 ip address 192.168.23.3 255.255.255.0 full-duplex ! interface Ethernet0/2 ip address 10.0.12.3 255.255.255.0 full-duplex no keepalive ! interface Ethernet0/3 ip address 10.0.13.3 255.255.255.0 full-duplex no keepalive ! router ospf 1 log-adjacency-changes redistribute connected network 10.0.10.0 0.0.0.255 area 1 network 10.0.12.0 0.0.0.255 area 1 network 10.0.13.0 0.0.0.255 area 1 network 192.168.23.0 0.0.0.255 area 1 ! ip http server ip classless ! ! ! ! ! ! ! ! line con 0 line aux 0 line vty 0 4 login ! ! end
検証1 事前設定の確認
- ルーティングテーブル, LSDBの確認
R1のルーティングテーブルとLSDBを確認します。
R1#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route Gateway of last resort is not set C 192.168.12.0/24 is directly connected, Ethernet0/0 1.0.0.0/32 is subnetted, 1 subnets C 1.1.1.1 is directly connected, Loopback0 C 192.168.10.0/24 is directly connected, Ethernet0/1 10.0.0.0/24 is subnetted, 3 subnets O IA 10.0.10.0 [110/30] via 192.168.12.2, 00:00:45, Ethernet0/0 O IA 10.0.12.0 [110/30] via 192.168.12.2, 00:00:26, Ethernet0/0 O IA 10.0.13.0 [110/30] via 192.168.12.2, 00:00:06, Ethernet0/0 O IA 192.168.23.0/24 [110/20] via 192.168.12.2, 00:03:59, Ethernet0/0 R1# R1#show ip ospf database OSPF Router with ID (1.1.1.1) (Process ID 1) Router Link States (Area 0) Link ID ADV Router Age Seq# Checksum Link count 1.1.1.1 1.1.1.1 568 0x80000003 0x00C6DB 2 2.2.2.2 2.2.2.2 623 0x80000002 0x00F036 1 Net Link States (Area 0) Link ID ADV Router Age Seq# Checksum 192.168.12.2 2.2.2.2 624 0x80000001 0x008F1F Summary Net Link States (Area 0) Link ID ADV Router Age Seq# Checksum 10.0.10.0 2.2.2.2 370 0x80000001 0x0025E7 10.0.12.0 2.2.2.2 351 0x80000001 0x000FFB 10.0.13.0 2.2.2.2 331 0x80000001 0x000406 192.168.23.0 2.2.2.2 604 0x80000003 0x00FDAA Summary ASB Link States (Area 0) Link ID ADV Router Age Seq# Checksum 3.3.3.3 2.2.2.2 609 0x80000001 0x001905
検証2 経路集約の設定
- 経路集約の設定
R2に以下の設定を投入し、経路集約を定義します。
R2(config)#router ospf 1 R2(config-router)#area 1 range 10.0.0.0 255.255.0.0
- ルーティングテーブル, LSDBの確認
R1のルーティングテーブルとLSDBを確認します。10.0.0.0/16の経路が集約されている事を確認します。
R1#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route Gateway of last resort is not set C 192.168.12.0/24 is directly connected, Ethernet0/0 1.0.0.0/32 is subnetted, 1 subnets C 1.1.1.1 is directly connected, Loopback0 C 192.168.10.0/24 is directly connected, Ethernet0/1 10.0.0.0/16 is subnetted, 1 subnets O IA 10.0.0.0 [110/30] via 192.168.12.2, 00:00:18, Ethernet0/0 <- 集約された経路 O IA 192.168.23.0/24 [110/20] via 192.168.12.2, 00:11:18, Ethernet0/0 R1#show ip ospf database OSPF Router with ID (1.1.1.1) (Process ID 1) Router Link States (Area 0) Link ID ADV Router Age Seq# Checksum Link count 1.1.1.1 1.1.1.1 689 0x80000003 0x00C6DB 2 2.2.2.2 2.2.2.2 744 0x80000002 0x00F036 1 Net Link States (Area 0) Link ID ADV Router Age Seq# Checksum 192.168.12.2 2.2.2.2 745 0x80000001 0x008F1F Summary Net Link States (Area 0) Link ID ADV Router Age Seq# Checksum 10.0.0.0 2.2.2.2 25 0x80000001 0x009383 <- 集約された経路 192.168.23.0 2.2.2.2 725 0x80000003 0x00FDAA Summary ASB Link States (Area 0) Link ID ADV Router Age Seq# Checksum 3.3.3.3 2.2.2.2 730 0x80000001 0x001905
- Null 0への経路を確認
ルーティングループ防止用のNull 0 への経路を確認します。R2のルーティングテーブルを確認すると、ループ防止用のNull 0への経路が自動的に付加されているのが確認できます。
R2#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route Gateway of last resort is not set C 192.168.12.0/24 is directly connected, Ethernet0/1 2.0.0.0/32 is subnetted, 1 subnets C 2.2.2.2 is directly connected, Loopback0 O 192.168.10.0/24 [110/20] via 192.168.12.1, 00:02:25, Ethernet0/1 10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks O 10.0.10.0/24 [110/20] via 192.168.23.3, 00:02:25, Ethernet0/0 O 10.0.12.0/24 [110/20] via 192.168.23.3, 00:02:25, Ethernet0/0 O 10.0.13.0/24 [110/20] via 192.168.23.3, 00:02:25, Ethernet0/0 O 10.0.0.0/16 is a summary, 00:02:25, Null0 <- Null0への経路 C 192.168.23.0/24 is directly connected, Ethernet0/0
一方configを確認すると、Null 0への設定は見当たりません。configにNull 0 への経路が自動的に加筆される仕様ではないようです。
R2#show running-config | include ip route <- 何も出力されない R2#
検証3 discard-route
- discard-routeの設定
Null 0への経路を自動的に付加しないようにする事もできます。no discard-routeを投入する事で、Null 0への経路が付加されないようになります。
R2(config)#router ospf 1 R2(config-router)#no discard-route internal R2(config-router)#do show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route Gateway of last resort is not set C 192.168.12.0/24 is directly connected, Ethernet0/1 2.0.0.0/32 is subnetted, 1 subnets C 2.2.2.2 is directly connected, Loopback0 O 192.168.10.0/24 [110/20] via 192.168.12.1, 00:00:09, Ethernet0/1 10.0.0.0/24 is subnetted, 3 subnets <- Null 0への経路が見当たらない O 10.0.10.0 [110/20] via 192.168.23.3, 00:00:09, Ethernet0/0 O 10.0.12.0 [110/20] via 192.168.23.3, 00:00:09, Ethernet0/0 O 10.0.13.0 [110/20] via 192.168.23.3, 00:00:09, Ethernet0/0 C 192.168.23.0/24 is directly connected, Ethernet0/0 R2(config-router)#
検証4 not-advertise
- not-advertise
ABR限定の話ですが、通知したくないルートを設定する事もできます。以下のようにnot-advertiseを設定すると、192.168.23.0/24の経路がarea 0に通知されないようになります。
R2(config)#router ospf 1 R2(config-router)#area 1 range 192.168.23.0 255.255.255.0 not-advertise
- ルーティングテーブルの確認
R1のルーティングテーブルを確認すると、確かに192.168.23.0/24が通知されていない事が確認できます。
R1#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route Gateway of last resort is not set C 192.168.12.0/24 is directly connected, Ethernet0/0 1.0.0.0/32 is subnetted, 1 subnets C 1.1.1.1 is directly connected, Loopback0 C 192.168.10.0/24 is directly connected, Ethernet0/1 10.0.0.0/16 is subnetted, 1 subnets O IA 10.0.0.0 [110/30] via 192.168.12.2, 00:07:27, Ethernet0/0 R1#
添付ファイル