一、OSPF多区域
(一)实验介绍
1、学习目标
实现手动指定OSPF Router ID
实现OSPF多区域配置
阐明OSPF区域之间路由汇总的配置方法
阐明OSPF参考带宽的配置方法
阐明OSPF引入外部路由的配置方法
阐明OSPF引入的外部路由时进行路由汇总的方法
阐明向OSPF引入缺省路由的方法
阐明对OSPF中各类路由优先级的修改方法
2、实验组网介绍
免费视频链接:【实战课】华为HCIA-Datacom认证实验教学-学习视频教程-腾讯课堂
-
-
-
-
-
-
-
- OSPF多区域
-
-
-
-
-
-
互联接口、IP地址如上图所示,所有设备均创建Loopback0,其IP地址为10.0.x.x/24,其中x为设备编号。
R1、R3的所有接口以及R2的GE0/0/4接口属于OSPF区域2,R2、R4的Loopback0接口及互联接口属于OSPF区域0,R4、R5的互联接口、R5的Loopback0、1、2接口属于OSPF区域1。
R2上创建Loopback1、2接口用于模拟外部网段。
3、实验背景
你是公司的网络管理员。现在公司的网络中有五台AR路由器,其中R2和R4在公司总部,R1、R3、R5在公司分部。由于网络规模较大,为了控制LSA的洪泛,你设计了多区域的OSPF。
为了明确设备的Router-ID,你配置设备使用固定的地址作为Router ID。
为了使路由器进行路由转发时效率更高,你在区域的边界配置了自动汇总。
R1路由器连接到Internet,你需要配置一条缺省路由,引入到OSPF区域,以便于OSPF区域的所有路由器都知道如何访问Internet。
同时OSPF路由信息中区分了内部路由和外部路由,你修改了OSPF路由信息的优先级信息,以避免潜在的风险。
OSPF中特定路由信息的度量值是将到达目的网络经过的所有链路的代价值进行累加得到的。而链路的代价值是路由器将接口带宽与参考带宽进行对比得到。参考带宽值为100Mbps,实际接口带宽可能为1000Mbps,而度量值都是整数,所以快速以太网接口和千兆以太网接口的OSPF代价值均为1。为了能够相互区分这些链路,你定义参考带宽值为10Gbps。
(二)实验任务
1、任务思路
- 设备IP地址配置。
- 按照规划配置OSPF区域。
- 检查OSPF配置结果,检查OSPF邻居关系状态,在ABR上查看OSPF LSDB。
- 在ABR、ASBR上配置路由汇总,减少区域间、外部路由数量。
- 修改OSPF的参考带宽值。
- 在OSPF中引入缺省路由。
- 修改OSPF域内、域间路由和域外路由的缺省路由优先级。
2、任务步骤
-
-
-
-
-
- 2 互联接口、环回口IP地址配置
-
-
-
-
#设备命名
略。
#关闭本实验中未使用的接口
略
#配置R1的GE0/0/3接口、环回口IP地址
[R1]interface GigabitEthernet0/0/3
[R1-GigabitEthernet0/0/3] ip address 10.0.123.1 24
[R1-GigabitEthernet0/0/3] quit
[R1]interface LoopBack 0
[R1-LoopBack0] ip address 10.0.1.1 24
[R1-LoopBack0] quit
#配置R2的GE0/0/4、GE0/0/2接口、环回口IP地址
[R2]interface GigabitEthernet0/0/4
[R2-GigabitEthernet0/0/4] ip address 10.0.123.2 24
[R2-GigabitEthernet0/0/4] quit
[R2] interface GigabitEthernet0/0/2
[R2-GigabitEthernet0/0/2] ip address 10.0.24.2 24
[R2-GigabitEthernet0/0/2] quit
[R2]interface LoopBack 0
[R2-LoopBack0] ip address 10.0.2.2 24
[R2-LoopBack0] quit
[R2]interface LoopBack1
[R2-LoopBack1] ip address 10.2.0.1 255.255.255.0
[R2-LoopBack1] quit
[R2]interface LoopBack2
[R2-LoopBack2] ip address 10.2.1.1 255.255.255.0
[R2-LoopBack2] quit
#配置R3的GE0/0/4接口、环回口IP地址
[R3]interface GigabitEthernet0/0/4
[R3-GigabitEthernet0/0/4] ip address 10.0.123.3 24
[R3-GigabitEthernet0/0/4] quit
[R3]interface LoopBack 0
[R3-LoopBack0] ip address 10.0.3.3 24
[R3-LoopBack0] quit
[R3]interface LoopBack 1
[R3-LoopBack1] ip address 10.3.0.1 24
[R3-LoopBack1] quit
[R3]interface LoopBack 2
[R3-LoopBack2] ip address 10.3.1.1 24
[R3-LoopBack2] quit
#配置R4的GE0/0/3、GE0/0/2接口以及环回口IP地址
[R4]interface GigabitEthernet0/0/3
[R4-GigabitEthernet0/0/3] ip address 10.0.24.4 24
[R4-GigabitEthernet0/0/3] quit
[R4]interface GigabitEthernet0/0/2
[R4-GigabitEthernet0/0/2] ip address 10.0.45.4 24
[R4-GigabitEthernet0/0/2] quit
[R4]interface LoopBack 0
[R4-LoopBack0] ip address 10.0.4.4 24
[R4-LoopBack0] quit
#配置R5的GE0/0/3接口、环回口IP地址
[R5]interface GigabitEthernet0/0/3
[R5-GigabitEthernet0/0/3] ip address 10.0.45.5 24
[R5-GigabitEthernet0/0/3] quit
[R5]interface LoopBack 0
[R5-LoopBack0] ip address 10.0.5.5 24
[R5-LoopBack0] quit
[R5]interface LoopBack 1
[R5-LoopBack1] ip address 10.5.0.1 24
[R5-LoopBack1] quit
[R5]int LoopBack 2
[R5-LoopBack2] ip address 10.5.1.1 24
[R5-LoopBack2] quit
#在R2上检测与R1、R3、R4的互联地址连通性
<R2>ping -c 1 10.0.123.1
PING 10.0.123.1: 56 data bytes, press CTRL_C to break
Reply from 10.0.123.1: bytes=56 Sequence=1 ttl=255 time=70 ms
--- 10.0.123.1 ping statistics ---
1 packet(s) transmitted
1 packet(s) received
0.00% packet loss
round-trip min/avg/max = 70/70/70 ms
<R2>ping -c 1 10.0.123.3
PING 10.0.123.3: 56 data bytes, press CTRL_C to break
Reply from 10.0.123.3: bytes=56 Sequence=1 ttl=255 time=110 ms
--- 10.0.123.3 ping statistics ---
1 packet(s) transmitted
1 packet(s) received
0.00% packet loss
round-trip min/avg/max = 110/110/110 ms
<R2>ping -c 1 10.0.24.4
PING 10.0.24.4: 56 data bytes, press CTRL_C to break
Reply from 10.0.24.4: bytes=56 Sequence=1 ttl=255 time=40 ms
--- 10.0.24.4 ping statistics ---
1 packet(s) transmitted
1 packet(s) received
0.00% packet loss
round-trip min/avg/max = 40/40/40 ms
#在R4上检测与R5的互联地址连通性
<R4>ping -c 1 10.0.45.5
PING 10.0.45.5: 56 data bytes, press CTRL_C to break
Reply from 10.0.45.5: bytes=56 Sequence=1 ttl=255 time=80 ms
--- 10.0.45.5 ping statistics ---
1 packet(s) transmitted
1 packet(s) received
0.00% packet loss
round-trip min/avg/max = 80/80/80 ms
-
-
-
-
-
- 3 配置多区域OSPF
-
-
-
-
#在R1上配置OSPF,在GE0/0/3接口、Loopback0接口激活OSPF,同时修改Loopback0接口的网络类型为Broadcast
[R1]ospf 1 router-id 10.0.1.1
[R1-ospf-1]area 2
[R1-ospf-1-area-0.0.0.2] network 10.0.123.1 0.0.0.0
[R1-ospf-1-area-0.0.0.2] network 10.0.1.1 0.0.0.0
[R1-ospf-1-area-0.0.0.2] quit
[R1-ospf-1]quit
[R1]interface LoopBack 0
[R1-LoopBack0] ospf network-type broadcast
[R1-LoopBack0] quit
#在R2上配置OSPF,在GE0/0/2、GE0/0/4、Loopback0接口上激活OSPF,同时修改Loopback0接口的网络类型为Broadcast
[R2]ospf 1 router-id 10.0.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0] network 10.0.24.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0] network 10.0.2.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0] quit
[R2-ospf-1]area 2
[R2-ospf-1-area-0.0.0.2] network 10.0.123.2 0.0.0.0
[R2-ospf-1-area-0.0.0.2] quit
[R2-ospf-1]quit
[R2]interface LoopBack 0
[R2-LoopBack0] ospf network-type broadcast
[R2-LoopBack0] quit
#在R3上配置OSPF,在GE0/0/4、Loopback0、Loopback1、Loopback2接口上激活OSPF,同时修改Loopback0、1、2接口的网络类型为Broadcast
[R3]ospf 1 router-id 10.0.3.3
[R3-ospf-1]area 2
[R3-ospf-1-area-0.0.0.2] network 10.0.123.3 0.0.0.0
[R3-ospf-1-area-0.0.0.2] network 10.0.3.3 0.0.0.0
[R3-ospf-1-area-0.0.0.2] network 10.3.0.1 0.0.0.0
[R3-ospf-1-area-0.0.0.2] network 10.3.1.1 0.0.0.0
[R3-ospf-1-area-0.0.0.2] quit
[R3-ospf-1]quit
[R3]interface LoopBack 0
[R3-LoopBack0] ospf network-type broadcast
[R3-LoopBack0] quit
[R3]interface LoopBack 1
[R3-LoopBack1] ospf network-type broadcast
[R3-LoopBack1] quit
[R3]interface LoopBack 2
[R3-LoopBack2] ospf network-type broadcast
[R3-LoopBack2] quit
#在R4上配置OSPF,在GE0/0/2、GE0/0/3、Loopback0接口上激活OSPF,同时修改Loopback0接口的网络类型为Broadcast
[R4]ospf 1 router-id 10.0.4.4
[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0] network 10.0.24.4 0.0.0.0
[R4-ospf-1-area-0.0.0.0] network 10.0.4.4 0.0.0.0
[R4-ospf-1-area-0.0.0.0] quit
[R4-ospf-1]area 1
[R4-ospf-1-area-0.0.0.1] network 10.0.45.4 0.0.0.0
[R4-ospf-1-area-0.0.0.1] quit
[R4-ospf-1]quit
[R4]interface LoopBack 0
[R4-LoopBack0] ospf network-type broadcast
[R4-LoopBack0] quit
#在R5上配置OSPF,在GE0/0/3、Loopback0、Loopback1、Loopback2接口上激活OSPF,同时修改Loopback0、1、2接口的网络类型为Broadcast
[R5]ospf 1 router-id 10.0.5.5
[R5-ospf-1]area 1
[R5-ospf-1-area-0.0.0.1] network 10.0.5.5 0.0.0.0
[R5-ospf-1-area-0.0.0.1] network 10.5.0.1 0.0.0.0
[R5-ospf-1-area-0.0.0.1] network 10.5.1.1 0.0.0.0
[R5-ospf-1-area-0.0.0.1] network 10.0.45.5 0.0.0.0
[R5-ospf-1-area-0.0.0.1] quit
[R5-ospf-1]quit
[R5]interface LoopBack 0
[R5-LoopBack0] ospf network-type broadcast
[R5-LoopBack0] quit
[R5]interface LoopBack 1
[R5-LoopBack1] ospf network-type broadcast
[R5-LoopBack1] quit
[R5]interface LoopBack 2
[R5-LoopBack2] ospf network-type broadcast
[R5-LoopBack2] quit
-
-
-
-
-
- 4 检查OSPF配置结果
-
-
-
-
#在R2上检查OSPF邻居关系的概要信息
<R2>display ospf peer brief
OSPF Process 1 with Router ID 10.0.2.2
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 GigabitEthernet0/0/2 10.0.4.4 Full
0.0.0.2 GigabitEthernet0/0/4 10.0.1.1 Full
0.0.0.2 GigabitEthernet0/0/4 10.0.3.3 Full
----------------------------------------------------------------------------
#在R5上检查邻居关系的概要信息和OSPF路由表
<R5>display ospf peer brief
OSPF Process 1 with Router ID 10.0.5.5
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.1 GigabitEthernet0/0/3 10.0.4.4 Full
----------------------------------------------------------------------------
<R5>display ospf routing
OSPF Process 1 with Router ID 10.0.5.5
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
10.0.5.0/24 0 Stub 10.0.5.5 10.0.5.5 0.0.0.1
10.0.45.0/24 1 Transit 10.0.45.5 10.0.5.5 0.0.0.1
10.5.0.0/24 0 Stub 10.5.0.1 10.0.5.5 0.0.0.1
10.5.1.0/24 0 Stub 10.5.1.1 10.0.5.5 0.0.0.1
10.0.1.0/24 3 Inter-area 10.0.45.4 10.0.4.4 0.0.0.1
10.0.2.0/24 2 Inter-area 10.0.45.4 10.0.4.4 0.0.0.1
10.0.3.0/24 3 Inter-area 10.0.45.4 10.0.4.4 0.0.0.1
10.0.4.0/24 1 Inter-area 10.0.45.4 10.0.4.4 0.0.0.1
10.0.24.0/24 2 Inter-area 10.0.45.4 10.0.4.4 0.0.0.1
10.0.123.0/24 3 Inter-area 10.0.45.4 10.0.4.4 0.0.0.1
10.3.0.0/24 3 Inter-area 10.0.45.4 10.0.4.4 0.0.0.1
10.3.1.0/24 3 Inter-area 10.0.45.4 10.0.4.4 0.0.0.1
Total Nets: 12
Intra Area: 4 Inter Area: 8 ASE: 0 NSSA: 0
#在R2上查看OSPF LSDB
<R2>display ospf lsdb
OSPF Process 1 with Router ID 10.0.2.2
Link State Database
Area: 0.0.0.0
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 10.0.4.4 10.0.4.4 54 48 8000000B 0
Router 10.0.2.2 10.0.2.2 54 48 80000008 0
Network 10.0.24.4 10.0.4.4 54 32 80000003 0
Sum-Net 10.3.1.0 10.0.2.2 1332 28 80000001 1
Sum-Net 10.3.0.0 10.0.2.2 1332 28 80000001 1
Sum-Net 10.5.1.0 10.0.4.4 259 28 80000002 1
Sum-Net 10.0.3.0 10.0.2.2 1332 28 80000001 1
Sum-Net 10.5.0.0 10.0.4.4 268 28 80000002 1
Sum-Net 10.0.1.0 10.0.2.2 244 28 80000001 1
Sum-Net 10.0.5.0 10.0.4.4 278 28 80000002 1
Sum-Net 10.0.45.0 10.0.4.4 500 28 80000002 1
Sum-Net 10.0.123.0 10.0.2.2 45 28 80000002 1
Area: 0.0.0.2
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 10.0.3.3 10.0.3.3 247 72 80000017 0
Router 10.0.2.2 10.0.2.2 247 36 80000008 1
Router 10.0.1.1 10.0.1.1 246 48 80000008 1
Network 10.0.123.3 10.0.3.3 247 36 80000006 0
Sum-Net 10.0.24.0 10.0.2.2 45 28 80000002 1
Sum-Net 10.5.1.0 10.0.2.2 45 28 80000002 2
Sum-Net 10.5.0.0 10.0.2.2 45 28 80000002 2
Sum-Net 10.0.2.0 10.0.2.2 45 28 80000002 0
Sum-Net 10.0.5.0 10.0.2.2 45 28 80000002 2
Sum-Net 10.0.4.0 10.0.2.2 45 28 80000002 1
Sum-Net 10.0.45.0 10.0.2.2 45 28 80000002 2
R2作为ABR,维护两个区域的LSDB,分别用来描述区域0和区域2的路由。
-
-
-
-
-
- 5 配置OSPF区域间、外部路由汇总
-
-
-
-
#在R2、R4上查看OSPF路由表
<R2>display ospf routing
OSPF Process 1 with Router ID 10.0.2.2
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
10.0.2.0/24 0 Stub 10.0.2.2 10.0.2.2 0.0.0.0
10.0.24.0/24 1 Transit 10.0.24.2 10.0.2.2 0.0.0.0
10.0.123.0/24 1 Transit 10.0.123.2 10.0.2.2 0.0.0.2
10.0.1.0/24 1 Stub 10.0.123.1 10.0.1.1 0.0.0.2
10.0.3.0/24 1 Stub 10.0.123.3 10.0.3.3 0.0.0.2
10.0.4.0/24 1 Stub 10.0.24.4 10.0.4.4 0.0.0.0
10.0.5.0/24 2 Inter-area 10.0.24.4 10.0.4.4 0.0.0.0
10.0.45.0/24 2 Inter-area 10.0.24.4 10.0.4.4 0.0.0.0
10.3.0.0/24 1 Stub 10.0.123.3 10.0.3.3 0.0.0.2
10.3.1.0/24 1 Stub 10.0.123.3 10.0.3.3 0.0.0.2
10.5.0.0/24 2 Inter-area 10.0.24.4 10.0.4.4 0.0.0.0
10.5.1.0/24 2 Inter-area 10.0.24.4 10.0.4.4 0.0.0.0
Total Nets: 12
<R4>display ospf routing
OSPF Process 1 with Router ID 10.0.4.4
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
10.0.4.0/24 0 Stub 10.0.4.4 10.0.4.4 0.0.0.0
10.0.24.0/24 1 Transit 10.0.24.4 10.0.4.4 0.0.0.0
10.0.45.0/24 1 Transit 10.0.45.4 10.0.4.4 0.0.0.1
10.0.1.0/24 2 Inter-area 10.0.24.2 10.0.2.2 0.0.0.0
10.0.2.0/24 1 Stub 10.0.24.2 10.0.2.2 0.0.0.0
10.0.3.0/24 2 Inter-area 10.0.24.2 10.0.2.2 0.0.0.0
10.0.5.0/24 1 Stub 10.0.45.5 10.0.5.5 0.0.0.1
10.0.123.0/24 2 Inter-area 10.0.24.2 10.0.2.2 0.0.0.0
10.3.0.0/24 2 Inter-area 10.0.24.2 10.0.2.2 0.0.0.0
10.3.1.0/24 2 Inter-area 10.0.24.2 10.0.2.2 0.0.0.0
10.5.0.0/24 1 Stub 10.0.45.5 10.0.5.5 0.0.0.1
10.5.1.0/24 1 Stub 10.0.45.5 10.0.5.5 0.0.0.1
Total Nets: 12
Intra Area: 7 Inter Area: 5 ASE: 0 NSSA: 0
R2 OSPF路由表中的R5 Loopback1、2接口的OSPF区域间路由,R4 OSPF路由表中的R3 Loopback1、2接口的OSPF区域间路由都可以进行区域间汇总,之后再向其他区域发送。一方面减少其他区域的路由条目,另外一方面还可以减少路由振荡的发生。
#R4上对R5的Loopback1、Loopback2接口路由进行汇总
[R4]ospf 1
[R4-ospf-1]area 1
[R4-ospf-1-area-0.0.0.1] abr-summary 10.5.0.0 255.255.254.0
[R4-ospf-1-area-0.0.0.1] quit
#在R2上查看OSPF路由表
<R2>display ospf routing
OSPF Process 1 with Router ID 10.0.2.2
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
10.0.2.0/24 0 Stub 10.0.2.2 10.0.2.2 0.0.0.0
10.0.24.0/24 1 Transit 10.0.24.2 10.0.2.2 0.0.0.0
10.0.123.0/24 1 Transit 10.0.123.2 10.0.2.2 0.0.0.2
10.0.1.0/24 1 Stub 10.0.123.1 10.0.1.1 0.0.0.2
10.0.3.0/24 1 Stub 10.0.123.3 10.0.3.3 0.0.0.2
10.0.4.0/24 1 Stub 10.0.24.4 10.0.4.4 0.0.0.0
10.0.5.0/24 2 Inter-area 10.0.24.4 10.0.4.4 0.0.0.0
10.0.45.0/24 2 Inter-area 10.0.24.4 10.0.4.4 0.0.0.0
10.3.0.0/24 1 Stub 10.0.123.3 10.0.3.3 0.0.0.2
10.3.1.0/24 1 Stub 10.0.123.3 10.0.3.3 0.0.0.2
10.5.0.0/23 2 Inter-area 10.0.24.4 10.0.4.4 0.0.0.0
Total Nets: 11
Intra Area: 8 Inter Area: 3 ASE: 0 NSSA: 0
R5上的Loopback1、Loopback2接口路由被汇总成了一条区域间路由。
#R2上对R3的Loopback1、Loopback2接口路由进行汇总
[R2]ospf 1
[R2-ospf-1]area 2
[R2-ospf-1-area-0.0.0.2] abr-summary 10.3.0.0 255.255.254.0
#在R4上查看OSPF路由表
<R4>display ospf routing
OSPF Process 1 with Router ID 10.0.4.4
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
10.0.4.0/24 0 Stub 10.0.4.4 10.0.4.4 0.0.0.0
10.0.24.0/24 1 Transit 10.0.24.4 10.0.4.4 0.0.0.0
10.0.45.0/24 1 Transit 10.0.45.4 10.0.4.4 0.0.0.1
10.0.1.0/24 2 Inter-area 10.0.24.2 10.0.2.2 0.0.0.0
10.0.2.0/24 1 Stub 10.0.24.2 10.0.2.2 0.0.0.0
10.0.3.0/24 2 Inter-area 10.0.24.2 10.0.2.2 0.0.0.0
10.0.5.0/24 1 Stub 10.0.45.5 10.0.5.5 0.0.0.1
10.0.123.0/24 2 Inter-area 10.0.24.2 10.0.2.2 0.0.0.0
10.3.0.0/23 2 Inter-area 10.0.24.2 10.0.2.2 0.0.0.0
10.5.0.0/24 1 Stub 10.0.45.5 10.0.5.5 0.0.0.1
10.5.1.0/24 1 Stub 10.0.45.5 10.0.5.5 0.0.0.1
Total Nets: 11
Intra Area: 7 Inter Area: 4 ASE: 0 NSSA: 0
R3上的Loopback1、Loopback2接口路由被汇总成了一条区域间路由。
#在R2上将Loopback1、Loopback2接口路由引入到OSPF中
[R2]ospf 1
[R2-ospf-1] import-route direct
#在R4上查看OSPF路由表
<R4>display ospf routing
OSPF Process 1 with Router ID 10.0.4.4
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
10.0.4.0/24 0 Stub 10.0.4.4 10.0.4.4 0.0.0.0
10.0.24.0/24 1 Transit 10.0.24.4 10.0.4.4 0.0.0.0
10.0.45.0/24 1 Transit 10.0.45.4 10.0.4.4 0.0.0.1
10.0.1.0/24 2 Inter-area 10.0.24.2 10.0.2.2 0.0.0.0
10.0.2.0/24 1 Stub 10.0.24.2 10.0.2.2 0.0.0.0
10.0.3.0/24 2 Inter-area 10.0.24.2 10.0.2.2 0.0.0.0
10.0.5.0/24 1 Stub 10.0.45.5 10.0.5.5 0.0.0.1
10.0.123.0/24 2 Inter-area 10.0.24.2 10.0.2.2 0.0.0.0
10.3.0.0/23 2 Inter-area 10.0.24.2 10.0.2.2 0.0.0.0
10.5.0.0/24 1 Stub 10.0.45.5 10.0.5.5 0.0.0.1
10.5.1.0/24 1 Stub 10.0.45.5 10.0.5.5 0.0.0.1
Routing for ASEs
Destination Cost Type Tag NextHop AdvRouter
10.2.0.0/24 1 Type2 1 10.0.24.2 10.0.2.2
10.2.1.0/24 1 Type2 1 10.0.24.2 10.0.2.2
Total Nets: 13
Intra Area: 7 Inter Area: 4 ASE: 2 NSSA: 0
在R4的OSPF路由表中可以看到R2的Loopback1、2接口路由。
#在R2上执行外部路由汇总
[R2]ospf 1
[R2-ospf-1] asbr-summary 10.2.0.0 255.255.254.0
#再次在R4上查看OSPF路由表
<R4>display ospf routing
OSPF Process 1 with Router ID 10.0.4.4
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
10.0.4.0/24 0 Stub 10.0.4.4 10.0.4.4 0.0.0.0
10.0.24.0/24 1 Transit 10.0.24.4 10.0.4.4 0.0.0.0
10.0.45.0/24 1 Transit 10.0.45.4 10.0.4.4 0.0.0.1
10.0.1.0/24 2 Inter-area 10.0.24.2 10.0.2.2 0.0.0.0
10.0.2.0/24 1 Stub 10.0.24.2 10.0.2.2 0.0.0.0
10.0.3.0/24 2 Inter-area 10.0.24.2 10.0.2.2 0.0.0.0
10.0.5.0/24 1 Stub 10.0.45.5 10.0.5.5 0.0.0.1
10.0.123.0/24 2 Inter-area 10.0.24.2 10.0.2.2 0.0.0.0
10.3.0.0/23 2 Inter-area 10.0.24.2 10.0.2.2 0.0.0.0
10.5.0.0/24 1 Stub 10.0.45.5 10.0.5.5 0.0.0.1
10.5.1.0/24 1 Stub 10.0.45.5 10.0.5.5 0.0.0.1
Routing for ASEs
Destination Cost Type Tag NextHop AdvRouter
10.2.0.0/23 2 Type2 1 10.0.24.2 10.0.2.2
Total Nets: 12
Intra Area: 7 Inter Area: 4 ASE: 1 NSSA: 0
R2上的Loopback1、Loopback2接口路由被汇总成了一条外部路由。
-
-
-
-
-
- 6 修改OSPF的参考带宽值
-
-
-
-
在实际网络可能使用了千兆甚至万兆以太网。但是由于OSPF的默认参考带宽值为100Mbps,并且接口代价值仅为整数,所以OSPF无法在带宽上区分百兆以太网和千兆以太网。
在运行OSPF的多个区域内,OSPF的参考带宽值必须一致,否则OSPF无法正常工作。
#修改所有路由器的OSPF参考带宽值为10Gbps
[R1]ospf 1
[R1-ospf-1] bandwidth-reference 10000
[R1-ospf-1] quit
[R2]ospf 1
[R2-ospf-1] bandwidth-reference 10000
[R2-ospf-1] quit
[R3]ospf 1
[R3-ospf-1] bandwidth-reference 10000
[R3-ospf-1] quit
[R4]ospf 1
[R4-ospf-1] bandwidth-reference 10000
[R4-ospf-1] quit
[R5]ospf 1
[R5-ospf-1] bandwidth-reference 10000
[R5-ospf-1] quit
#以R2为例查看OSPF路由表
[R2]display ospf routing
OSPF Process 1 with Router ID 10.0.2.2
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
10.0.2.0/24 0 Stub 10.0.2.2 10.0.2.2 0.0.0.0
10.0.24.0/24 10 Transit 10.0.24.2 10.0.2.2 0.0.0.0
10.0.123.0/24 10 Transit 10.0.123.2 10.0.2.2 0.0.0.2
10.0.1.0/24 10 Stub 10.0.123.1 10.0.1.1 0.0.0.2
10.0.3.0/24 10 Stub 10.0.123.3 10.0.3.3 0.0.0.2
10.0.4.0/24 10 Stub 10.0.24.4 10.0.4.4 0.0.0.0
10.0.5.0/24 20 Inter-area 10.0.24.4 10.0.4.4 0.0.0.0
10.0.45.0/24 20 Inter-area 10.0.24.4 10.0.4.4 0.0.0.0
10.3.0.0/24 10 Stub 10.0.123.3 10.0.3.3 0.0.0.2
10.3.1.0/24 10 Stub 10.0.123.3 10.0.3.3 0.0.0.2
10.5.0.0/23 20 Inter-area 10.0.24.4 10.0.4.4 0.0.0.0
Total Nets: 11
Intra Area: 8 Inter Area: 3 ASE: 0 NSSA: 0
可以看到路由的Cost值已经发生了变化。
-
-
-
-
-
- 7 OSPF引入缺省路由
-
-
-
-
#使用R1的Loopback0接口模拟Internet接入,在R1上配置缺省路由,且出接口指定为Loopback0
[R1]ip route-static 0.0.0.0 0.0.0.0 LoopBack 0
#将缺省路由引入到OSPF,指定外部路由类型为1
[R1]ospf 1
[R1-ospf-1] default-route-advertise always type 1
[R1-ospf-1] quit
#在R2上查看OSPF路由表
[R2]display ospf routing
OSPF Process 1 with Router ID 10.0.2.2
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
10.0.2.0/24 0 Stub 10.0.2.2 10.0.2.2 0.0.0.0
10.0.24.0/24 10 Transit 10.0.24.2 10.0.2.2 0.0.0.0
10.0.123.0/24 10 Transit 10.0.123.2 10.0.2.2 0.0.0.2
10.0.1.0/24 10 Stub 10.0.123.1 10.0.1.1 0.0.0.2
10.0.3.0/24 10 Stub 10.0.123.3 10.0.3.3 0.0.0.2
10.0.4.0/24 10 Stub 10.0.24.4 10.0.4.4 0.0.0.0
10.0.5.0/24 20 Inter-area 10.0.24.4 10.0.4.4 0.0.0.0
10.0.45.0/24 20 Inter-area 10.0.24.4 10.0.4.4 0.0.0.0
10.3.0.0/24 10 Stub 10.0.123.3 10.0.3.3 0.0.0.2
10.3.1.0/24 10 Stub 10.0.123.3 10.0.3.3 0.0.0.2
10.5.0.0/23 20 Inter-area 10.0.24.4 10.0.4.4 0.0.0.0
Routing for ASEs
Destination Cost Type Tag NextHop AdvRouter
0.0.0.0/0 11 Type1 1 10.0.123.1 10.0.1.1
Total Nets: 12
Intra Area: 8 Inter Area: 3 ASE: 1 NSSA: 0
可以看到R2已经通过Type-5 LSA学习到默认路由,下一跳为R1。
-
-
-
-
-
- 8 修改OSPF中两类路由的优先级
-
-
-
-
默认情况下,OSPF区域内和区域之间的路由,优先级为10。OSPF外部路由,优先级为150。
#修改R1、R3设备上的OSPF区域内和区域之间的路由优先级为20,修改OSPF外部路由的优先级为50
[R1]ospf 1
[R1-ospf-1] preference 20
[R1-ospf-1] preference ase 50
[R1-ospf-1] quit
[R3]ospf 1
[R3-ospf-1] preference 20
[R3-ospf-1] preference ase 50
[R3-ospf-1] quit
本步骤的相关配置只是向读者介绍如何在OSPF中修改内、外部路由优先级,但是本步骤的操作在本实验中并不具备实际意义。
#在R3上查看IP路由表中的OSPF路由
<R3>display ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
Destinations : 9 Routes : 9
OSPF routing table status : <Active>
Destinations : 9 Routes : 9
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 O_ASE 50 11 D 10.0.123.1 GigabitEthernet0/0/3
10.0.1.0/24 OSPF 20 10 D 10.0.123.1 GigabitEthernet0/0/3
10.0.2.0/24 OSPF 20 10 D 10.0.123.2 GigabitEthernet0/0/3
10.0.4.0/24 OSPF 20 20 D 10.0.123.2 GigabitEthernet0/0/3
10.0.5.0/24 OSPF 20 30 D 10.0.123.2 GigabitEthernet0/0/3
10.0.24.0/24 OSPF 20 20 D 10.0.123.2 GigabitEthernet0/0/3
10.0.45.0/24 OSPF 20 30 D 10.0.123.2 GigabitEthernet0/0/3
10.2.0.0/23 O_ASE 50 2 D 10.0.123.2 GigabitEthernet0/0/3
10.5.0.0/23 OSPF 20 30 D 10.0.123.2 GigabitEthernet0/0/3
OSPF routing table status : <Inactive>
Destinations : 0 Routes : 0
可以看到OSPF路由的优先级已经改变。
思考题
OSPF引入外部路由时存在两种类型:类型1与类型2,这两种不同的类型有什么区别?
(四)配置参考
R1设备配置
#文章来源:https://www.toymoban.com/news/detail-714333.html
sysname R1
#
interface GigabitEthernet0/0/3
ip address 10.0.123.1 255.255.255.0
#
interface LoopBack0
ip address 10.0.1.1 255.255.255.0
ospf network-type broadcast
#
ospf 1 router-id 10.0.1.1
default-route-advertise always type 1
preference 20
preference ase 50
bandwidth-reference 10000
area 0.0.0.2
network 10.0.1.1 0.0.0.0
network 10.0.123.1 0.0.0.0
#
ip route-static 0.0.0.0 0.0.0.0 LoopBack0
#
R2设备配置
#
sysname R2
#
interface GigabitEthernet0/0/2
ip address 10.0.24.2 255.255.255.0
#
interface GigabitEthernet0/0/4
ip address 10.0.123.2 255.255.255.0
#
interface LoopBack0
ip address 10.0.2.2 255.255.255.0
ospf network-type broadcast
#
interface LoopBack1
ip address 10.2.0.1 255.255.255.0
#
interface LoopBack2
ip address 10.2.1.1 255.255.255.0
#
ospf 1 router-id 10.0.2.2
asbr-summary 10.2.0.0 255.255.254.0
import-route direct
bandwidth-reference 10000
area 0.0.0.0
network 10.0.2.2 0.0.0.0
network 10.0.24.2 0.0.0.0
area 0.0.0.2
abr-summary 10.3.0.0 255.255.254.0
network 10.0.123.2 0.0.0.0
#
R3设备配置
#
sysname R3
#
interface GigabitEthernet0/0/4
ip address 10.0.123.3 255.255.255.0
#
interface LoopBack0
ip address 10.0.3.3 255.255.255.0
ospf network-type broadcast
#
interface LoopBack1
ip address 10.3.0.1 255.255.255.0
ospf network-type broadcast
#
interface LoopBack2
ip address 10.3.1.1 255.255.255.0
ospf network-type broadcast
#
ospf 1 router-id 10.0.3.3
preference 20
preference ase 50
bandwidth-reference 10000
area 0.0.0.2
network 10.0.123.3 0.0.0.0
network 10.0.3.3 0.0.0.0
network 10.3.0.1 0.0.0.0
network 10.3.1.1 0.0.0.0
#
R4设备配置
#
sysname R4
#
interface GigabitEthernet0/0/2
ip address 10.0.45.4 255.255.255.0
#
interface GigabitEthernet0/0/3
ip address 10.0.24.4 255.255.255.0
#
interface LoopBack0
ip address 10.0.4.4 255.255.255.0
ospf network-type broadcast
#
ospf 1 router-id 10.0.4.4
bandwidth-reference 10000
area 0.0.0.0
network 10.0.24.4 0.0.0.0
network 10.0.4.4 0.0.0.0
area 0.0.0.1
abr-summary 10.5.0.0 255.255.254.0
network 10.0.45.4 0.0.0.0
#
R5设备配置
#
sysname R5
#
interface GigabitEthernet0/0/3
ip address 10.0.45.5 255.255.255.0
#
interface LoopBack0
ip address 10.0.5.5 255.255.255.0
ospf network-type broadcast
#
interface LoopBack1
ip address 10.5.0.1 255.255.255.0
ospf network-type broadcast
#
interface LoopBack2
ip address 10.5.1.1 255.255.255.0
ospf network-type broadcast
#
ospf 1 router-id 10.0.5.5
bandwidth-reference 10000
area 0.0.0.0
area 0.0.0.1
network 10.0.5.5 0.0.0.0
network 10.5.0.1 0.0.0.0
network 10.5.1.1 0.0.0.0
network 10.0.45.5 0.0.0.0
#
文章来源地址https://www.toymoban.com/news/detail-714333.html
到了这里,关于OSPF多区域实验的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!