一、簡介:bash
在OSPF網絡中,並非每一個路由器都須要外部網絡的信息,爲了減小LSA泛洪量和路由表條目,就建立了末梢區域(stub),位於Stub邊界的ABR將宣告一條默認路由到全部的Stub區域內的內部路由器,不接受自治系統外部信息,同時也拒絕4類LSA,Stub區域不能包含ASBR(除非ABR也是ASBR)網絡
在末節區域的基礎上,若是不接受自治系統外部路由和自治系統內其餘區域彙總路由,則該區域將會成爲徹底末節區域。ide
二、拓撲規劃:oop
三、IP地址規劃測試
設備ui |
接口spa |
IP地址及子網掩碼3d |
R1(Quidway2600serial)router |
E0blog |
192.168.1.1/24 |
Loopback 1 |
192.168.5.1/24 |
|
R2(QuidwayS3526) |
E0/1 |
192.168.1.2/24 |
E0/9 |
192.168.2.1/24 |
|
E0/2 |
192.168.6.1/24 |
|
R3(QuidwayS3526) |
E0/9 |
192.168.2.2/24 |
E0/17 |
192.168.3.1/24 |
|
R4(Quidway2600serial) |
E1 |
192.168.3.2/24 |
Loopback 1 |
192.168.4.1/24 |
|
R5(Quidway-AR-28) |
E1 |
192.168.6.2/24 |
Loopback |
192.168.7.1/24 |
四、案例實現:
1)、配置IP地址,並啓用ospf和rip,將各個接口添加到相應的區域中:
R1配置:
local-user admin service-type administratorpassword cipher /P.G'J<G@HG-JEXJQ<%DJQ!! #添加telnet用戶,方便管理和後期維護 sysname R1 #配置設備名稱 router id 1.1.1.1 #手工添加router id interface Ethernet0 ip address 192.168.1.1 255.255.255.0 ospf enable area 0.0.0.1 #在ethernet0上配置爲ospf區域1 interface LoopBack1 ip address 192.168.5.1 255.255.255.0 ospf enable area0.0.0.1 #在loopback上配置ospf區域1
R2配置:
local-user admin password cipher %K/T]3SXOF$[FR9&2:*aF1!! service-type telnet level 3 user-interface vty 0 4 authentication-mode scheme sysname R2 router id 2.2.2.2 vlan 10 vlan 20 vlan 30 # interface Vlan-interface10 ipaddress 192.168.1.2 255.255.255.0 # interface Vlan-interface20 ipaddress 192.168.2.1 255.255.255.0 # interface Vlan-interface30 ipaddress 192.168.6.1 255.255.255.0 interface NULL0 #啓用null接口配置默認路由 ospf import-route direct cost 10 #將R2的直連路由重分發到ospf中 import-route rip cost 15 #將rip重分發到ospf中 area0.0.0.1 network 192.168.1.2 0.0.0.0 # area0.0.0.0 network 192.168.2.1 0.0.0.0 rip network 192.168.6.0 import-route static cost 10 #將默認路由重分發到rip中 # iproute-static 0.0.0.0 0.0.0.0 NULL 0 preference 60 #配置rip網絡到ospf的默認路由
R3配置:
sysname R3 router id 3.3.3.3 local-user admin password cipherQ_E4WOL3a+&AYP51,NO;"A!! service-typetelnet level 3 user-interface vty 0 4 authentication-mode scheme vlan 10 vlan 20 interface Vlan-interface10 ipaddress 192.168.2.2 255.255.255.0 # interface Vlan-interface20 ipaddress 192.168.3.1 255.255.255.0 ospf area0.0.0.2 network 192.168.3.1 0.0.0.0 # area0.0.0.0 network 192.168.2.2 0.0.0.0
R4配置:
local-user admin service-type administratorpassword cipher /P.G'J<G@HG-JEXJQ<%DJQ!! sysname R4 router id4.4.4.4 interface Ethernet1 ip address 192.168.3.2 255.255.255.0 ospf enable area 0.0.0.2interface Ethernet1 ip address 192.168.3.2 255.255.255.0 ospf enable area0.0.0.2 interface LoopBack1 ip address 192.168.4.1 255.255.255.0 ospf enable area0.0.0.2
R5配置:
sysname R5 router id 5.5.5.5 local-user admin password cipher.]@USE=B,53Q=^Q`MAF4<<"TX$_S#6.NM(0=0\)*5WWQ=^Q`MAF4<<"TX$_S#6.N service-type telnet terminal level 3 user-interface vty 0 4 authentication-mode scheme interface Ethernet0/1 ipaddress 192.168.6.2 255.255.255.0 interface LoopBack1 ipaddress 192.168.7.1 255.255.255.0 rip network 192.168.6.0 network 192.168.7.0
2)、查看當前拓撲的歌路由表及其連通性
R1:
R2:
R3:
R4:
R5:
3)、配置區域1爲末節區域,屏蔽學到的外部路由,取代爲一條默認路由:
R1配置:
ospf enable stub cost 10area 0.0.0.1
R2配置:
ospf import-route direct cost 10 import-route rip cost 15 area0.0.0.1 network 192.168.1.2 0.0.0.0 stub #將區域1配置爲末節區域
配置完成後查看新生成的路由表,能夠發現原來學到的外部路由沒有了,被一條默認路由取代了,可是rip區域的192.168.6.0/24和192.168.7.0/24仍然能ping通
通信測試:
4)、配置區域1爲徹底末節區域:
在區域1倍配置爲末節區域的同時,關閉ospf類型3和類型4的路由通告,即成爲徹底末節區域,能夠更大程度的減小路由條目
R1配置:
ospf enable stub cost 10area 0.0.0.1
R2配置:
ospf import-route direct cost 10 import-route rip cost 15 area0.0.0.1 network 192.168.1.2 0.0.0.0 stub no-summary #配置爲末節區域,同時關閉域間路由通告
查看R1路由表:
測試通信: