需求
将区域12设置为Stub区域,使区域12的路由设备不受外部链路影响(不接收4/5类LSA)降低区域12(末梢区域)设备压力,还能让区域12的PC1与外部PC3通信
配置步骤
1)配置接口信息
- 配置PC的IP地址
- 配置路由器的接口
2)配置OSPF单区域
- 创建ospf进程,定义router-id
- 指定相应区域
- 宣告网段进入ospf
3)配置OSPF多区域
4) R6配置去往PC3的静态路由
5)R7上配置去往PC1、PC2的静态路由
6)R6上在OSPF进程下引入外部路由
7)将区域12设置为stub区域
8) 验证stub区域特性,验证业务连通性
- pc1 ping pc3进行连通性测试
配置命令
第一步:配置PC接口IP地址
第二步:配置路由器接口IP地址
第三步:配置OSPF:
R1配置:
interface GigabitEthernet0/0/0
ip address 192.168.12.1 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 192.168.1.254 255.255.255.0
#
ospf 1 router-id 1.1.1.1
area 0.0.0.12
network 192.168.1.0 0.0.0.255
network 192.168.12.0 0.0.0.255
R2配置:
interface GigabitEthernet0/0/0
ip address 192.168.23.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 192.168.12.2 255.255.255.0
#
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 192.168.23.0 0.0.0.255
area 0.0.0.12
network 192.168.12.0 0.0.0.255
R3配置:
#
interface GigabitEthernet0/0/0
ip address 192.168.34.3 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 192.168.23.3 255.255.255.0
#
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 192.168.23.0 0.0.0.255
network 192.168.34.0 0.0.0.255
R4配置:
#
interface GigabitEthernet0/0/0
ip address 192.168.45.4 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 192.168.34.4 255.255.255.0
#
ospf 1 router-id 4.4.4.4
area 0.0.0.0
network 192.168.34.0 0.0.0.255
network 192.168.45.0 0.0.0.255
R5配置:
interface GigabitEthernet0/0/0
ip address 192.168.56.5 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 192.168.45.5 255.255.255.0
#
ospf 1 router-id 5.5.5.5
area 0.0.0.0
network 192.168.45.0 0.0.0.255
area 0.0.0.56
network 192.168.56.0 0.0.0.255
R6配置
#
interface GigabitEthernet0/0/1
ip address 192.168.56.6 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 192.168.2.254 255.255.255.0
#
ospf 1 router-id 6.6.6.6
area 0.0.0.56
network 192.168.2.0 0.0.0.255
network 192.168.56.0 0.0.0.255
第四步:R6配置去往PC3的静态路由
R6配置
#
interface GigabitEthernet0/0/0
ip address 192.168.67.6 255.255.255.0
#
ip route-static 192.168.3.0 24 192.168.67.7
第五步:R7配置去往PC1/PC2的静态路由
R7配置
interface GigabitEthernet0/0/0
ip address 192.168.67.7 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 192.168.3.254 255.255.255.0
#
ip route-static 192.168.0.0 16 192.168.67.6
第六步:R6上在OSPF进程下引入静态路由
R6配置
ospf 1 router-id 6.6.6.6
import-route static
第七步:stub区域的配置命令
[R1]ospf 1
[R1-ospf-1]area 12
[R1-ospf-1-area 0.0.0.12]stub
[R2]ospf 1
[R2-ospf-1]area 12
[R2-ospf-1-area 0.0.0.12]stub
备注:区域12没有配置stub区域前,数据库是这样的
<R1>dis ospf lsdb
OSPF Process 1 with Router ID 1.1.1.1
Link State Database
Area: 0.0.0.12
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 2.2.2.2 2.2.2.2 1644 36 80000025 1
Router 1.1.1.1 1.1.1.1 1651 36 80000022 1
Network 192.168.12.2 2.2.2.2 1644 32 80000010 0
Sum-Net 192.168.45.0 2.2.2.2 442 28 80000013 3
Sum-Net 192.168.23.0 2.2.2.2 700 28 80000013 1
Sum-Net 192.168.56.0 2.2.2.2 298 28 80000013 4
Sum-Net 192.168.34.0 2.2.2.2 533 28 80000013 2
Sum-Net 192.168.2.0 2.2.2.2 1758 28 80000015 5
Sum-Asbr 6.6.6.6 2.2.2.2 1769 28 80000008 4
AS External Database
Type LinkState ID AdvRouter Age Len Sequence Metric
External 192.168.3.0 6.6.6.6 1773 36 80000008 1
第八步:测试与验证:验证stub区域的特点
备注:区域12配置stub区域后,数据库是这样的
备注:没有4类的LSA了,没有5类LSA了,但是多了一个默认的3类的LSA
[R1]dis ospf lsdb
OSPF Process 1 with Router ID 1.1.1.1
Link State Database
Area: 0.0.0.12
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 2.2.2.2 2.2.2.2 6 36 80000005 1
Router 1.1.1.1 1.1.1.1 7 36 80000004 1
Network 192.168.12.2 2.2.2.2 7 32 80000002 0
** Sum-Net 0.0.0.0 2.2.2.2 49 28 80000001 1**
Sum-Net 192.168.45.0 2.2.2.2 49 28 80000001 3
Sum-Net 192.168.23.0 2.2.2.2 49 28 80000001 1
Sum-Net 192.168.56.0 2.2.2.2 49 28 80000001 4
Sum-Net 192.168.34.0 2.2.2.2 49 28 80000001 2
[R1]dis ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
Destinations : 5 Routes : 5
OSPF routing table status : <Active>
Destinations : 5 Routes : 5
Destination/Mask Proto Pre Cost NextHop Interface
0.0.0.0/0 OSPF 10 2 192.168.12.2 GigabitEthernet0/0/0**
192.168.23.0/24 OSPF 10 2 192.168.12.2 GigabitEthernet0/0/0
192.168.34.0/24 OSPF 10 3 192.168.12.2 GigabitEthernet0/0/0
192.168.45.0/24 OSPF 10 4 192.168.12.2 GigabitEthernet0/0/0
192.168.56.0/24 OSPF 10 5 192.168.12.2 GigabitEthernet0/0/0
第八步:验证与测试,stub区域的PC1 和外部PC3 可以互通
PC1可以访问PC3