OSPF动态路由
文章目录
- OSPF动态路由
- 一、题目要求
- 二、题目分析
- 三、拓扑结构
- 四、基础配置
- 五、测试验证
一、题目要求
1 、 使用172.16.0.0.0/16网段进行子网划分
2 、 用OSPF协议达到全网可达
3 、 保证所有设备均具备最少的 LSDB 以及路由表
二、题目分析
1.网段划分
5个OSPF区域和1个RIP区域,先划分6个网段,然后再分为:area0:8个网段,area1:4个网段,area2:3个网段,RIP:2个网段,area3:3个网段,area4:3个网段,划分详情见拓扑结构;
2.在R7与R11上设置虚链路
3.在R9上做双向重发布
三、拓扑结构
四、基础配置
R1:
#IP配置
<Huawei>sys
[Huawei]un in en
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 172.16.32.1 26
[Huawei-GigabitEthernet0/0/0]int l 0
[Huawei-LoopBack0]ip add 172.16.32.129 26
[Huawei-LoopBack0]q
#OSPF配置
[Huawei]ospf router-id 1.1.1.1
[Huawei-ospf-1]a 1
[Huawei-ospf-1-area-0.0.0.1]network 172.16.32.128 0.0.0.63
[Huawei-ospf-1-area-0.0.0.1]network 172.16.32.0 0.0.0.63
R2:
#IP配置
<Huawei>sys
[Huawei]sys r2
[r2]un in en
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip add 172.16.32.2 26
[r2-GigabitEthernet0/0/0]int l 0
[r2-LoopBack0]ip add 172.16.32.193 26
[r2-LoopBack0]q
#OSPF配置
[r2]ospf router-id 2.2.2.2
[r2-ospf-1]a 1
[r2-ospf-1-area-0.0.0.1]network 172.16.32.192 0.0.0.63
[r2-ospf-1-area-0.0.0.1]network 172.16.32.0 0.0.0.63
R3:
area1(域间路由汇总)
#IP配置
<Huawei>sys
[r3]un in en
[Huawei]sys r3
[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]ip add 172.16.32.3 26
[r3-GigabitEthernet0/0/0]int g0/0/1
[r3-GigabitEthernet0/0/1]ip add 172.16.0.129 27
[r3-GigabitEthernet0/0/1]int l 0
[r3-LoopBack0]ip add 172.16.32.65 26
[r3-LoopBack0]q
#OSPF配置
[r3]ospf router-id 3.3.3.3
[r3-ospf-1]a 1
[r3-ospf-1-area-0.0.0.1]network 172.16.32.0 0.0.0.63
[r3-ospf-1-area-0.0.0.1]network 172.16.32.64 0.0.0.63
[r3-ospf-1-area-0.0.0.1]q
[r3-ospf-1]a 0
[r3-ospf-1-area-0.0.0.0]network 172.16.0.128 0.0.0.31
R4:
area0(172.16.0.128/27~172.16.0.225/27)进行路由汇总
#IP配置
<Huawei>SYS
[Huawei]sys r4
[r4]un in en
[r4]int g0/0/0
[r4-GigabitEthernet0/0/0]ip add 172.16.0.130 27
[r4-GigabitEthernet0/0/0]int g0/0/1
[r4-GigabitEthernet0/0/1]ip add 172.16.0.161 27
[r4-GigabitEthernet0/0/1]int g0/0/2
[r4-GigabitEthernet0/0/2]ip add 172.16.0.193 27
[r4-GigabitEthernet0/0/2]int g2/0/0
[r4-GigabitEthernet2/0/0]ip add 172.16.0.225 27
[r4-GigabitEthernet2/0/0]int l 0
[r4-LoopBack0]ip add 172.16.0.1 27
[r4-LoopBack0]q
#OSPF配置
[r4]ospf router-id 4.4.4.4
[r4-ospf-1]a 0
[r4-ospf-1-area-0.0.0.0]network 172.16.0.128 0.0.0.127
R5:
#IP配置
<Huawei>sys
[Huawei]sys r5
[r5]un in en
[r5]int g0/0/0
[r5-GigabitEthernet0/0/0]ip add 172.16.0.162 27
[r5-GigabitEthernet0/0/0]int l 0
[r5-LoopBack0]ip add 172.16.0.33 27
[r5-LoopBack0]q
#OSPF配置
[r5]ospf router-id 5.5.5.5
[r5-ospf-1]a 0
[r5-ospf-1-area-0.0.0.0]network 172.16.0.32 0.0.0.31
[r5-ospf-1-area-0.0.0.0]network 172.16.0.160 0.0.0.31
R6:
#IP配置
<Huawei>sys
[Huawei]sys r6
[r6]un in en
[r6]int g0/0/0
[r6-GigabitEthernet0/0/0]ip add 172.16.0.194 27
[r6-GigabitEthernet0/0/0]int g0/0/1
[r6-GigabitEthernet0/0/1]ip add 172.16.64.1 26
[r6-GigabitEthernet0/0/1]int l 0
[r6-LoopBack0]ip add 172.16.0.65 27
[r6-LoopBack0]q
#OSPF配置
[r6]ospf router-id 6.6.6.6
[r6-ospf-1]a 0
[r6-ospf-1-area-0.0.0.0]network 172.16.0.192 0.0.0.31
[r6-ospf-1-area-0.0.0.0]a 2
[r6-ospf-1-area-0.0.0.2]network 172.16.64.0 0.0.0.63
R7:
虚链路连接R11:
#IP配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r7
[r7]un in en
[r7]int g0/0/0
[r7-GigabitEthernet0/0/0]ip add 172.16.0.226 27
[r7]int g0/0/1
[r7-GigabitEthernet0/0/1]ip add 172.16.128.1 26
[r7-GigabitEthernet0/0/1]int l 0
[r7-LoopBack0]ip add 172.16.0.97 27
[r7-LoopBack0]q
#OSPF配置
[r7]ospf router-id 7.7.7.7
[r7-ospf-1]a 0
[r7-ospf-1-area-0.0.0.0]network 172.16.0.224 0.0.0.31
[r7-ospf-1-area-0.0.0.0]a 3
[r7-ospf-1-area-0.0.0.3]network 172.16.128.0 0.0.0.63
##虚链路
[r7-ospf-1-area-0.0.0.3]vlink-peer 11.11.11.11
R8:
area2(172.16.64.0/26~172.16.64.128/26)进行路由汇总
#IP配置
<Huawei>sys
[Huawei]sys r8
[r8]un in en
[r8]int g0/0/0
[r8-GigabitEthernet0/0/0]ip add 172.16.64.2 26
[r8-GigabitEthernet0/0/0]int g0/0/1
[r8-GigabitEthernet0/0/1]ip add 172.16.64.129 26
[r8-GigabitEthernet0/0/1]int l 0
[r8-LoopBack0]ip add 172.16.64.65 26
[r8-LoopBack0]q
#OSPF配置
[r8]ospf router-id 8.8.8.8
[r8-ospf-1]a 2
[r8-ospf-1-area-0.0.0.2]network 172.16.64.0 0.0.31.255
R9:
#IP配置
<Huawei>sys
[Huawei]sys r9
[r9]int g0/0/0
[r9]un in en
[r9-GigabitEthernet0/0/0]ip add 172.16.64.130 26
[r9-GigabitEthernet0/0/0]int l 0
[r9-LoopBack0]ip add 172.16.96.1 25
[r9-LoopBack0]int l 1
[r9-LoopBack1]ip add 172.16.96.129 25
[r9-LoopBack1]q
#OSPF配置
[r9]ospf router-id 9.9.9.9
[r9-ospf-1] a 2
[r9-ospf-1-area-0.0.0.2]network 172.16.64.128 0.0.0.63
[r9-ospf-1-area-0.0.0.2]q
[r9-ospf-1]q
#rip配置
[r9]rip
[r9-rip-1]version 2
[r9-rip-1]network 172.16.0.0
#双向重发布
[r9-rip-1]import-route ospf 1
[r9-rip-1]q
[r9]ospf
[r9-ospf-1]import-route rip 1
[r9-ospf-1]q
R10:
area3(172.16.128.0/26~172.16.128.128/26)进行路由汇总
#IP配置
<Huawei>sys
[Huawei]sys r10
[r10]un in en
[r10]int g0/0/0
[r10-GigabitEthernet0/0/0]ip add 172.16.128.2 26
[r10-GigabitEthernet0/0/0]int g0/0/1
[r10-GigabitEthernet0/0/1]ip add 172.16.128.65 26
[r10-GigabitEthernet0/0/1]int l 0
[r10-LoopBack0]ip add 172.16.128.129 26
[r10-LoopBack0]q
#OSPF配置
[r10]ospf router-id 10.10.10.10
[r10-ospf-1]area 3
[r10-ospf-1-area-0.0.0.3]network 172.16.128.0 0.0.31.255
R11:
虚链路连接R7:
#IP配置
<Huawei>sys
[Huawei]un in en
[Huawei]sys r11
[r11]int g0/0/0
[r11-GigabitEthernet0/0/0]ip add 172.16.128.66 26
[r11-GigabitEthernet0/0/0]int g0/0/1
[r11-GigabitEthernet0/0/1]ip add 172.16.160.1 26
[r11-GigabitEthernet0/0/1]int l 0
[r11-LoopBack0]ip add 172.16.160.65 26
[r11-LoopBack0]q
#OSPF配置
[r11]ospf router-id 11.11.11.11
[r11-ospf-1]a 3
[r11-ospf-1-area-0.0.0.3]network 172.16.128.64 0.0.0.63
[r11-ospf-1-area-0.0.0.3]a 4
[r11-ospf-1-area-0.0.0.4]network 172.16.160.0 0.0.0.63
[r11-ospf-1-area-0.0.0.4]network 172.16.160.64 0.0.0.63
[r11-ospf-1-area-0.0.0.3]a 3
##虚链路
[r7-ospf-1-area-0.0.0.3]vlink-peer 7.7.7.7
R12:
#IP配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r12
[r12]un in en
Info: Information center is disabled.
[r12]int g0/0/0
[r12-GigabitEthernet0/0/0]ip add 172.16.160.2 26
[r12-GigabitEthernet0/0/0]int l 0
[r12-LoopBack0]ip add 172.16.160.129 26
[r12-LoopBack0]q
#OSPF配置
[r12]ospf router-id 12.12.12.12
[r12-ospf-1]a 4
[r12-ospf-1-area-0.0.0.4]network 172.16.160.0 0.0.0.63
[r12-ospf-1-area-0.0.0.4]network 172.16.160.128 0.0.0.63
五、测试验证
环回12Ping环回1,环回5,环回9,可以Ping通。
#环回1
<r12>ping 172.16.32.129
PING 172.16.32.129: 56 data bytes, press CTRL_C to break
Reply from 172.16.32.129: bytes=56 Sequence=1 ttl=250 time=80 ms
Reply from 172.16.32.129: bytes=56 Sequence=2 ttl=250 time=80 ms
Reply from 172.16.32.129: bytes=56 Sequence=3 ttl=250 time=70 ms
Reply from 172.16.32.129: bytes=56 Sequence=4 ttl=250 time=80 ms
Reply from 172.16.32.129: bytes=56 Sequence=5 ttl=250 time=60 ms
--- 172.16.32.129 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 60/74/80 ms
#环回5
<r12>ping 172.16.0.33
PING 172.16.0.33: 56 data bytes, press CTRL_C to break
Reply from 172.16.0.33: bytes=56 Sequence=1 ttl=251 time=40 ms
Reply from 172.16.0.33: bytes=56 Sequence=2 ttl=251 time=40 ms
Reply from 172.16.0.33: bytes=56 Sequence=3 ttl=251 time=40 ms
Reply from 172.16.0.33: bytes=56 Sequence=4 ttl=251 time=20 ms
Reply from 172.16.0.33: bytes=56 Sequence=5 ttl=251 time=40 ms
--- 172.16.0.33 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/36/40 ms
#环回9
<r12>ping 172.16.96.129
PING 172.16.96.129: 56 data bytes, press CTRL_C to break
Reply from 172.16.96.129: bytes=56 Sequence=1 ttl=249 time=60 ms
Reply from 172.16.96.129: bytes=56 Sequence=2 ttl=249 time=50 ms
Reply from 172.16.96.129: bytes=56 Sequence=3 ttl=249 time=60 ms
Reply from 172.16.96.129: bytes=56 Sequence=4 ttl=249 time=50 ms
Reply from 172.16.96.129: bytes=56 Sequence=5 ttl=249 time=50 ms
--- 172.16.96.129 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 50/54/60 ms