【HCIP】OSPF综合实验报告

一、分析要求

  1. R4为ISP,直连设备间使用公网网段
  2. R3、R5、R6、R7为MGRE环境,R3为NHS
  3. 合理划分172.16.0.0/16网段
  4. 做NAT配置使私网能够访问R4环回
  5. ospf优化(汇总和特殊区域),减少计时器时间加快收敛,设备之间做认证保证更新安全。
  6. 除ISP,其余设备运行ospf,使得全网可达

二、操作过程

1. 划分IP地址

2. 配置IP地址及环回地址

R1

[R1]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip add 172.16.33.1 29
[R1-GigabitEthernet0/0/0]int l 0
[R1-LoopBack0]ip add 172.16.34.1 24

R2

[R2]int g 0/0/0
[R2-GigabitEthernet0/0/0]ip add 172.16.33.2 29
[R2-GigabitEthernet0/0/0]int l 0
[R2-LoopBack0]ip add 172.16.35.1 24

R3

[R3]int g 0/0/0
[R3-GigabitEthernet0/0/0]ip add 172.16.33.3 29
[R3-GigabitEthernet0/0/0]int l 0 
[R3-LoopBack0]ip add 172.16.36.1 24
[R3-LoopBack0]int s 4/0/0
[R3-Serial4/0/0]ip add 34.0.0.1 24

R4

[R4]int s 4/0/0
[R4-Serial4/0/0]ip add 34.0.0.2 24
[R4-Serial4/0/0]int s 4/0/1 
[R4-Serial4/0/1]ip add 45.0.0.2 24
[R4-Serial4/0/1]int s 3/0/0
[R4-Serial3/0/0]ip add 46.0.0.2 24
[R4-Serial3/0/0]int g 0/0/0
[R4-GigabitEthernet0/0/0]ip add 47.0.0.2 24
[R4-GigabitEthernet0/0/0]int l 0
[R4-LoopBack0]ip add 4.4.4.4 24

R5

[R5]int s 4/0/0
[R5-Serial4/0/0]ip add 45.0.0.1 24
[R5-Serial4/0/0]int l 0
[R5-LoopBack0]ip add 172.16.2.1 24

R6

[R6]int s 4/0/0
[R6-Serial4/0/0]ip add 46.0.0.1 24
[R6-Serial4/0/0]int g 0/0/0
[R6-GigabitEthernet0/0/0]ip add 172.16.65.1 29
[R6-GigabitEthernet0/0/0]int l 0
[R6-LoopBack0]ip add 172.16.3.1 24

R7

[R7]int g 0/0/0
[R7-GigabitEthernet0/0/0]ip add 47.0.0.1 24
[R7-GigabitEthernet0/0/0]int g 0/0/1
[R7-GigabitEthernet0/0/1]ip add 172.16.97.1 29
[R7-GigabitEthernet0/0/1]int l 0
[R7-LoopBack0]ip add 172.16.4.1 24

R8

[R8]int g 0/0/0
[R8-GigabitEthernet0/0/0]ip add 172.16.97.2 29
[R8-GigabitEthernet0/0/0]int g 0/0/1
[R8-GigabitEthernet0/0/1]ip add 172.16.97.9 29
[R8-GigabitEthernet0/0/1]int l 0
[R8-LoopBack0]ip add 172.16.98.1 24

R9

[R9]int g 0/00/0
[R9-GigabitEthernet0/0/0]ip add 172.16.97.10 29
[R9-GigabitEthernet0/0/0]int g 0/0/1
[R9-GigabitEthernet0/0/1]ip add 172.16.129.1 29
[R9-GigabitEthernet0/0/1]int l 0
[R9-LoopBack0]ip add 172.16.130.1 24

R10

[R10]int g 0/0/0
[R10-GigabitEthernet0/0/0]ip add 172.16.129.2 29
[R10-GigabitEthernet0/0/0]int l0
[R10-LoopBack0]ip add 172.16.131.1 24

R11

[R11]int g 0/0/0
[R11-GigabitEthernet0/0/0]ip add 172.16.65.2 29
[R11-GigabitEthernet0/0/0]int g 0/0/1
[R11-GigabitEthernet0/0/1]ip add 172.16.65.9 29
[R11-GigabitEthernet0/0/1]int l 0
[R11-LoopBack0]ip add 172.16.66.1 24

R12

[R12] int g 0/0/0
[R12-GigabitEthernet0/0/0]ip add 172.16.65.10 29
[R12-GigabitEthernet0/0/0]int l 0
[R12-LoopBack0]ip add 172.16.162.1 24
[R12-LoopBack0]int l 1
[R12-LoopBack1]ip add 172.16.163.1 24

缺省路由

[R3]ip route-static 0.0.0.0 0 34.0.0.2
[R5]ip route-static 0.0.0.0 0 45.0.0.2
[R6]ip route-static 0.0.0.0 0 46.0.0.2
[R7]ip route-static 0.0.0.0 0 47.0.0.2

测试

3. 运行OSPF

R1

[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]a 1
[R1-ospf-1-area-0.0.0.1]network 172.16.33.1 0.0.0.0
[R1-ospf-1-area-0.0.0.1]network 172.16.34.1 0.0.0.0

R2

[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]a 1
[R2-ospf-1-area-0.0.0.1]network 172.16.33.2 0.0.0.0
[R2-ospf-1-area-0.0.0.1]network 172.16.35.1 0.0.0.0

R3

[R3]ospf 1 router-id 3.3.3.3 
[R3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1]network 172.16.33.3 0.0.0.0
[R3-ospf-1-area-0.0.0.1]network 172.16.36.1 0.0.0.0

R5

[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1]a 0
[R5-ospf-1-area-0.0.0.0]network 172.16.2.1 0.0.0.0

R6

[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]a 0
[R6-ospf-1-area-0.0.0.0]network 172.16.3.1 0.0.0.0
[R6-ospf-1-area-0.0.0.0]a 2
[R6-ospf-1-area-0.0.0.2]network 172.16.65.1 0.0.0.0

R7

[R7]ospf 1 router-id 7.7.7.7
[R7-ospf-1]a 0
[R7-ospf-1-area-0.0.0.0]network 172.16.4.1 0.0.0.0
[R7-ospf-1-area-0.0.0.0]a 3
[R7-ospf-1-area-0.0.0.3]network 172.16.97.1 0.0.0.0

R8

[R8]ospf 1 router-id 8.8.8.8
[R8-ospf-1-area-0.0.0.1]a 3
[R8-ospf-1-area-0.0.0.3]network 172.16.97.2 0.0.0.0
[R8-ospf-1-area-0.0.0.3]network 172.16.97.9 0.0.0.0
[R8-ospf-1-area-0.0.0.3]network 172.16.98.1 0.0.0.0

R9

[R9]ospf 1 router-id 9.9.9.9
[R9-ospf-1]a 3
[R9-ospf-1-area-0.0.0.3]network 172.16.97.10 0.0.0.0
[R9]ospf 2 router-id 9.9.9.9
[R9-ospf-2]a 4
[R9-ospf-2-area-0.0.0.4]network 172.16.129.1 0.0.0.0
[R9-ospf-2-area-0.0.0.4]network 172.16.130.1 0.0.0.0

R10

[R10]ospf 1 router-id 10.10.10.10
[R10-ospf-1]a 4
[R10-ospf-1-area-0.0.0.4]network 172.16.129.2 0.0.0.0
[R10-ospf-1-area-0.0.0.4]network 172.16.131.1 0.0.0.0

R11

[R11]ospf 1 router-id 11.11.11.11
[R11-ospf-1]a 2
[R11-ospf-1-area-0.0.0.2]network 172.16.65.2 0.0.0.0
[R11-ospf-1-area-0.0.0.2]network 172.16.65.9 0.0.0.0
[R11-ospf-1-area-0.0.0.2]network 172.16.66.1 0.0.0.0

R12

[R12]ospf 1 router-id 12.12.12.12
[R12-ospf-1]a 2
[R12-ospf-1-area-0.0.0.2]network 172.16.65.10 0.0.0.0
[R12]rip 
[R12-rip-1]v 2
[R12-rip-1]undo summary 
[R12-rip-1]network 172.16.0.0

4. 搭建MGRE环境

R3中心配置

[R3]int t 0/0/0
[R3-Tunnel0/0/0]ip add 172.16.1.1 29
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp 	
[R3-Tunnel0/0/0]source 34.0.0.1
[R3-Tunnel0/0/0]nhrp network-id 100
[R3-Tunnel0/0/0]nhrp entry multicast dynamic

R5分支配置

[R5]int t 0/0/0
[R5-Tunnel0/0/0]ip add 172.16.1.2 29
[R5-Tunnel0/0/0]tunnel-protocol gre p2mp 
[R5-Tunnel0/0/0]source Serial 4/0/0
[R5-Tunnel0/0/0]nhrp network-id 100
[R5-Tunnel0/0/0]nhrp entry 172.16.1.1 34.0.0.1 register 

R6分支配置

[R6]int t 0/0/0
[R6-Tunnel0/0/0]ip add 172.16.1.3 29
[R6-Tunnel0/0/0]tunnel-protocol gre p2mp 	
[R6-Tunnel0/0/0]source s 4/0/0
[R6-Tunnel0/0/0]nhrp network-id 100
[R6-Tunnel0/0/0]nhrp entry 172.16.1.1 34.0.0.1 register 

R7分支配置

[R7]int t 0/0/0
[R7-Tunnel0/0/0]ip add 172.16.1.4 29
[R7-Tunnel0/0/0]tunnel-protocol gre p2mp 
[R7-Tunnel0/0/0]source g 0/0/0
[R7-Tunnel0/0/0]nhrp network-id 100
[R7-Tunnel0/0/0]nhrp entry 172.16.1.1 34.0.0.1 register 

将tunnel隧道网段宣告进OSPF

[R3-ospf-1-area-0.0.0.0]network 172.16.1.1 0.0.0.0
[R5-ospf-1-area-0.0.0.0]network 172.16.1.2 0.0.0.0
[R6-ospf-1-area-0.0.0.0]network 172.16.1.3 0.0.0.0
[R7-ospf-1-area-0.0.0.0]network 172.16.1.4 0.0.0.0

修改Tunnel隧道接口网络类型为P2MP,避免DR/BDR选举,加快收敛

[R3-Tunnel0/0/0]ospf network-type p2mp
[R5-Tunnel0/0/0]ospf network-type p2mp
[R6-Tunnel0/0/0]ospf network-type p2mp
[R7-Tunnel0/0/0]ospf network-type p2mp

查看NHRP邻居表及OSPF邻居表

查看区域0的路由表

5. 重发布

将rip的路由导入

[R12-ospf-1]import-route rip 1

将area 4的路由导入

[R9-ospf-1]import-route ospf 2

[R10]ip route-static 0.0.0.0 0 172.16.129.1

查看area 0的路由表

测试

6. 优化

汇总

[R3-ospf-1-area-0.0.0.1]abr-summary 172.16.32.0 255.255.224.0
[R6-ospf-1-area-0.0.0.2]abr-summary 172.16.64.0 255.255.224.0
[R7-ospf-1-area-0.0.0.3]abr-summary 172.16.96.0 255.255.224.0
[R9-ospf-1]asbr-summary 172.16.128.0 255.255.224.0
[R12-ospf-1]asbr-summary 172.16.160.0 255.255.224.0

area 1 --- 完全stub区域

[R1-ospf-1-area-0.0.0.1]stub
[R2-ospf-1-area-0.0.0.1]stub
[R3-ospf-1-area-0.0.0.1]stub no-summary

area 2 --- 完全nssa区域

[R6-ospf-1-area-0.0.0.2]nssa no-summary
[R11-ospf-1-area-0.0.0.2]nssa
[R12-ospf-1-area-0.0.0.2]nssa

area 3 --- 完全的nssa区域

[R7-ospf-1-area-0.0.0.3]nssa no-summary
[R8-ospf-1-area-0.0.0.3]nssa
[R9-ospf-1-area-0.0.0.3]nssa

7. 加快收敛

修改接口类型

[R6-GigabitEthernet0/0/0]ospf network-type p2p

[R7-GigabitEthernet0/0/1]ospf network-type p2p

[R8-GigabitEthernet0/0/0]ospf network-type p2p
[R8-GigabitEthernet0/0/1]ospf network-type p2p

[R9-GigabitEthernet0/0/0]ospf network-type p2p
[R9-GigabitEthernet0/0/1]ospf network-type p2p

[R10-GigabitEthernet0/0/0]ospf network-type p2p

[R11-GigabitEthernet0/0/0]ospf network-type p2p
[R11-GigabitEthernet0/0/1]ospf network-type p2p

[R12-GigabitEthernet0/0/0]ospf network-type p2p

修改计时器

[R3-Tunnel0/0/0]ospf timer hello 10 
[R5-Tunnel0/0/0]ospf timer hello 10
[R6-Tunnel0/0/0]ospf timer hello 10
[R7-Tunnel0/0/0]ospf timer hello 10

8. 更新安全

area 1

[R1-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456
[R2-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456
[R3-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456

Tunnel

[R3-Tunnel0/0/0]ospf authentication-mode md5 1 cipher 3567
[R5-Tunnel0/0/0]ospf authentication-mode md5 1 cipher 3567
[R6-Tunnel0/0/0]ospf authentication-mode md5 1 cipher 3567
[R7-Tunnel0/0/0]ospf authentication-mode md5 1 cipher 3567

area 2

[R6-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 61112
[R11-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 61112
[R11-GigabitEthernet0/0/1]ospf authentication-mode md5 1 cipher 61112
[R12-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 61112

area 3

[R7-GigabitEthernet0/0/1]ospf authentication-mode md5 1 cipher 789
[R8-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 789
[R8-GigabitEthernet0/0/1]ospf authentication-mode md5 1 cipher 789
[R9-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 789

area 4

[R9-GigabitEthernet0/0/1]ospf authentication-mode md5 1 cipher 910
[R10-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 910

9. 空接口

[R3]ip route-static 172.16.32.0 19 NULL 0
[R6]ip route-static 172.16.64.0 19 NULL 0
[R7]ip route-static 172.16.96.0 19 NULL 0
[R9]ip route-static 172.16.128.0 19 NULL 0
[R12]ip route-static 172.16.160.0 19 NULL 0

10. NAT配置

R3配置

[R3]acl 2000
[R3-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R3-acl-basic-2000]q
[R3]int s 4/0/0
[R3-Serial4/0/0]nat outbound 2000

私网pingR4环回(R1)

R6配置

[R6]acl 2000
[R6-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R6-acl-basic-2000]q
[R6]int s 4/0/0
[R6-Serial4/0/0]nat outbound 2000

私网pingR4环回(R11)

R7配置

[R7]acl 2000
[R7-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R7-acl-basic-2000]q
[R7]int g 0/0/0
[R7-GigabitEthernet0/0/0]nat outbound 2000

私网pingR4环回(R8)

相关推荐
小wanga4 分钟前
【Linux】网络层、数据链路层、DNS、ICMP协议、NAT技术
linux·运维·网络
违章的王39 分钟前
环路广播风暴演示图
网络·智能路由器
IT成长日记44 分钟前
Ansible运行原理揭秘:如何用YAML脚本掌控数服务器?
运维·服务器·ansible·架构与原理
千羽星弦1 小时前
Jenkins在Windows上的使用(二):自动拉取、打包、部署
运维·windows·jenkins
Ashmcracker1 小时前
Jenkins链接私有仓库Failed to connect to repository,stderr: No ECDSA...的问题
运维·jenkins·devops
嵌入式-老费1 小时前
Linux上位机开发实战(x86和arm自由切换)
linux·运维·arm开发
猪猪侠|ZZXia1 小时前
# linux有哪些显示服务器协议、显示服务器、显示管理器、窗口管理器?有哪些用于开发图形用户界面的工具包?有哪些桌面环境?
linux·服务器
网络安全(king)1 小时前
基于java社交网络安全的知识图谱的构建与实现
开发语言·网络·深度学习·安全·web安全·php
艾希逐月1 小时前
【动手实验】TCP 连接的建立与关闭抓包分析
网络·tcp/ip
人间凡尔赛1 小时前
VSCode-Server 在 Linux 容器中的手动安装指南
linux·运维·服务器·docker