說明:練習OSPF summary與OSPF Stub設定,減少routing table內的路由。
聚合時會因狀況不同,用的指令也不同,可分為兩種:一、area X range,二、summary-address
設定Stub也會因狀況不同,設定的方式也不同,必須看當時的Topology
為了減少行數,刪除不必要的設定。
若為Interarea Route 需用 Area X range
若為External Route 需用 Summary-address
設定OSPF Stub是為了減少LSA某些Type在裡面流通的範圍並減少Routing Table內的路由。
在設定Stub會有一些限制:
一、Stub Area內不能有Virtual Link
二、Stub Area內不能有ASBR
三、Stub Area不得為Area 0 (感謝Cater大大提醒)
其它想到再補充,因為我忘了…
在此範例下,wg_ro_2因Redistribute四條loopback進OSPF,故為ASBR
因限制下無法設定為Stub,故設定為NSSA
所以有另一種改良過的,可在裡面有ASBR,稱Not-So-Stub-Area(NSSA)
Stub與NSSA都可在後面加上no-summary,為Totally Stub area與NSSA Totally stubby area
原本只有Type5會變成Default Route,設定後會連Type3也會變Default Route
實作條件:
一、wg_ro_1建立四條loopback,放至OSPF Area 1並Summary 50.1.8.0/22
loopback 10 50.1.8.254/24
loopback 11 50.1.9.254/24
loopback 12 50.1.10.254/24
loopback 13 50.1.11.254/24
二、wg_ro_2建立四條loopback,Redistribute到OSPF且summary 60.1.8.0/22,模擬External Route
loopback 10 60.1.8.254/24
loopback 11 60.1.9.254/24
loopback 12 60.1.10.254/24
loopback 13 60.1.11.254/24
三、Area 1不會有Income Type3、4、5
wg_ro_1設定如下:
Wg_RO_1#sh run
Building configuration...
Current configuration : 1431 bytes
!
hostname Wg_RO_1
!
interface Loopback10
ip address 50.1.8.254 255.255.255.0
!
interface Loopback11
ip address 50.1.9.254 255.255.255.0
!
interface Loopback12
ip address 50.1.10.254 255.255.255.0
!
interface Loopback13
ip address 50.1.11.254 255.255.255.0
!
interface Serial0/0
ip address 10.140.1.2 255.255.255.0
!
interface Serial0/1
ip address 10.12.12.1 255.255.255.0
clock rate 128000
!
router ospf 123
router-id 1.1.1.1
log-adjacency-changes
area 1 nssa no-summary 設定成 NSSA Totally stubby area
area 1 range 50.1.8.0 255.255.252.0 聚合Interarea內的50.1.8.0/22網段
network 10.12.12.1 0.0.0.0 area 1
network 10.140.1.2 0.0.0.0 area 0
network 50.1.8.254 0.0.0.0 area 1
network 50.1.9.254 0.0.0.0 area 1
network 50.1.10.254 0.0.0.0 area 1
network 50.1.11.254 0.0.0.0 area 1
!
end
wg_ro_2設定如下:
Wg_Ro_2(config-router)#do sh run
Building configuration...
Current configuration : 1304 bytes
!
hostname Wg_Ro_2
!
interface Loopback10
ip address 60.2.8.254 255.255.255.0
!
interface Loopback11
ip address 60.2.9.254 255.255.255.0
!
interface Loopback12
ip address 60.2.10.254 255.255.255.0
!
interface Loopback13
ip address 60.2.11.254 255.255.255.0
!
interface FastEthernet0/1
ip address 192.168.102.254 255.255.255.0
duplex auto
speed auto
!
interface Serial0/1
ip address 10.12.12.2 255.255.255.0
!
router ospf 123
router-id 2.2.2.2
log-adjacency-changes
area 1 nssa 設定成 NSSA
summary-address 60.2.8.0 255.255.252.0 聚合External Route的60.2.8.0/22網段
redistribute connected subnets 將直連的Loopback Redistribute進OSPF
network 10.12.12.2 0.0.0.0 area 1
network 192.168.102.254 0.0.0.0 area 1
!
end
設定後截圖:
Wg_RO_1#sh ip rou
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
O IA 192.168.106.0/24 [110/1691] via 10.140.1.1, 00:00:55, Serial0/0
O E1 200.200.4.0/24 [110/74] via 10.140.1.1, 00:00:17, Serial0/0
O E1 200.200.5.0/24 [110/74] via 10.140.1.1, 00:00:17, Serial0/0
50.0.0.0/8 is variably subnetted, 8 subnets, 2 masks
O IA 50.9.8.0/22 [110/1627] via 10.140.1.1, 00:01:04, Serial0/0
C 50.1.11.0/24 is directly connected, Loopback13
O IA 50.3.8.0/22 [110/1627] via 10.140.1.1, 00:00:57, Serial0/0
C 50.1.10.0/24 is directly connected, Loopback12
C 50.1.9.0/24 is directly connected, Loopback11
C 50.1.8.0/24 is directly connected, Loopback10
O 50.1.8.0/22 is a summary, 00:03:50, Null0
O IA 50.5.8.0/22 [110/1627] via 10.140.1.1, 00:01:05, Serial0/0
O IA 192.168.104.0/24 [110/1691] via 10.140.1.1, 00:01:05, Serial0/0
O E1 200.200.6.0/24 [110/74] via 10.140.1.1, 00:00:19, Serial0/0
O E1 200.200.7.0/24 [110/74] via 10.140.1.1, 00:00:19, Serial0/0
O E1 200.200.1.0/24 [110/74] via 10.140.1.1, 00:00:19, Serial0/0
O IA 192.168.108.0/24 [110/1691] via 10.140.1.1, 00:01:06, Serial0/0
O E1 200.200.2.0/24 [110/74] via 10.140.1.1, 00:00:19, Serial0/0
172.16.0.0/32 is subnetted, 1 subnets
O 172.16.31.100 [110/65] via 10.140.1.1, 00:01:06, Serial0/0
O IA 192.168.109.0/24 [110/1691] via 10.140.1.1, 00:01:06, Serial0/0
O E1 200.200.3.0/24 [110/74] via 10.140.1.1, 00:00:19, Serial0/0
O E1 200.200.12.0/24 [110/74] via 10.140.1.1, 00:00:19, Serial0/0
O E1 200.200.13.0/24 [110/74] via 10.140.1.1, 00:00:19, Serial0/0
10.0.0.0/24 is subnetted, 10 subnets
O IA 10.90.90.0 [110/1690] via 10.140.1.1, 00:01:06, Serial0/0
O IA 10.78.78.0 [110/1690] via 10.140.1.1, 00:01:06, Serial0/0
O IA 10.56.56.0 [110/1690] via 10.140.1.1, 00:01:06, Serial0/0
O IA 10.34.34.0 [110/1690] via 10.140.1.1, 00:01:08, Serial0/0
C 10.12.12.0 is directly connected, Serial0/1
O 10.140.7.0 [110/1626] via 10.140.1.1, 00:01:08, Serial0/0
O 10.140.5.0 [110/1626] via 10.140.1.1, 00:01:08, Serial0/0
O 10.140.3.0 [110/1626] via 10.140.1.1, 00:01:08, Serial0/0
C 10.140.1.0 is directly connected, Serial0/0
O 10.140.9.0 [110/1626] via 10.140.1.1, 00:01:08, Serial0/0
O 192.168.102.0/24 [110/65] via 10.12.12.2, 00:03:52, Serial0/1
O E1 200.200.8.0/24 [110/74] via 10.140.1.1, 00:00:21, Serial0/0
O E1 200.200.9.0/24 [110/74] via 10.140.1.1, 00:00:21, Serial0/0
O E1 200.200.10.0/24 [110/74] via 10.140.1.1, 00:00:21, Serial0/0
60.0.0.0/8 is variably subnetted, 10 subnets, 2 masks
O E2 60.6.8.0/22 [110/20] via 10.140.1.1, 00:00:21, Serial0/0
O N2 60.2.8.0/22 [110/20] via 10.12.12.2, 00:00:21, Serial0/1
O IA 60.10.8.254/32 [110/1691] via 10.140.1.1, 00:01:09, Serial0/0
O IA 60.10.9.254/32 [110/1691] via 10.140.1.1, 00:01:09, Serial0/0
O IA 60.10.10.254/32 [110/1691] via 10.140.1.1, 00:01:09, Serial0/0
O IA 60.10.11.254/32 [110/1691] via 10.140.1.1, 00:01:09, Serial0/0
O IA 60.4.10.254/32 [110/1691] via 10.140.1.1, 00:00:26, Serial0/0
O IA 60.4.11.254/32 [110/1691] via 10.140.1.1, 00:00:26, Serial0/0
O IA 60.4.8.254/32 [110/1691] via 10.140.1.1, 00:00:36, Serial0/0
O IA 60.4.9.254/32 [110/1691] via 10.140.1.1, 00:00:26, Serial0/0
O E1 200.200.11.0/24 [110/74] via 10.140.1.1, 00:00:22, Serial0/0
Wg_Ro_2(config-router)#do sh ip ro
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 10.12.12.1 to network 0.0.0.0
50.0.0.0/32 is subnetted, 4 subnets
O 50.1.9.254 [110/65] via 10.12.12.1, 00:04:57, Serial0/1
O 50.1.8.254 [110/65] via 10.12.12.1, 00:04:57, Serial0/1
O 50.1.11.254 [110/65] via 10.12.12.1, 00:04:57, Serial0/1
O 50.1.10.254 [110/65] via 10.12.12.1, 00:04:57, Serial0/1
10.0.0.0/24 is subnetted, 1 subnets
C 10.12.12.0 is directly connected, Serial0/1
C 192.168.102.0/24 is directly connected, FastEthernet0/1
60.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
C 60.2.10.0/24 is directly connected, Loopback12
C 60.2.11.0/24 is directly connected, Loopback13
C 60.2.8.0/24 is directly connected, Loopback10
O 60.2.8.0/22 is a summary, 00:11:25, Null0
C 60.2.9.0/24 is directly connected, Loopback11
O*IA 0.0.0.0/0 [110/65] via 10.12.12.1, 00:04:59, Serial0/1
留言列表