OSPF综合实验

在这里插入图片描述
实验要求:

R4为ISP,直连设备间使用公网网段
R3、R5、R6、R7为MGRE环境,R3为NHS
合理划分172.16.0.0/16网段
做NAT配置使私网能够访问R4环回
做ospf优化,减少计时器时间加快收敛,设备之间做认证保证更新安全
除ISP外,其余设备运行ospf,使得全网可达
配置实验:
1.地址划分

172.16.0.0/16(子网划分)

172.16.1.0/19
172.16.0.0/24
	172.16.1.0/29(Tunnel)
172.16.1.0/24
172.16.2.0/24(R5环回)
172.16.3.0/24(R6环回)
172.16.4.0/24(R7环回)

172.16.32.0/19
172.16.32.0/24
172.16.33.0/24
	172.16.33.0/29(R1-R2-R3)
172.16.34.0/24(R1环回)
172.16.35.0/24(R2环回)
172.16.36.0/24(R3环回)

172.16.64.0/19
172.16.64.0/24
172.16.65.0/24
	172.16.65.0/29(R6-R11)
	172.16.65.8/29(R11-R12)
172.16.66.0/24(R11环回)

172.16.96.0/19
172.16.96.0/24
172.16.97.0/24
	172.16.97.0/29(R7-R8)
	172.16.97.8/29(R8-R9)
172.16.98.0/24(R8环回)

172.16.128.0/19
172.16.128.0/24
172.16.129.0/24
	172.16.129.0/29(R9-R10)
172.16.130.0/24(R9环回)
172.16.131.0/24(R10环回)

172.16.160.0/19
172.16.160.0/24
172.16.161.0/24
172.16.162.0/24(rip)
172.16.163.0/24(rip)

172.16.192.0/19(保留)
172.16.224.0/19(保留)

2.配置地址及环回

[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]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]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]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]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]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]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]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]int g 0/0/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]int g 0/0/0
[R10-GigabitEthernet0/0/0]ip add 172.16.129.2 29
[R10-GigabitEthernet0/0/0]int l 0
[R10-LoopBack0]ip add 172.16.131.1 24
 
[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] 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

3.配置缺省路由,公网可达

[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

4.运行OSPF

[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]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]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]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]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]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]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]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]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]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]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 1
[R12-rip-1]v 2
[R12-rip-1]network 172.16.0.0

5.搭建MGRE环境

隧道网段:172.16.1.0/24
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接口类型(默认为P2P),改为p2mp
[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

6.重发布

1.将rip的路由导入ospf
[R12-ospf-1]import-route rip 1
2.将area 4的路由导入area 3
无需将area 3的路由导入area 4,只需要使用缺省路由
[R9-ospf-1]import-route ospf 2 
[R10]ip route-static 0.0.0.0 0 172.16.129.2

7.优化

在ABR和ASBR设备上做汇总
[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 可以做成完全末梢区域
[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 和 area 3 可以做成完全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

[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.做认证

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

8.空接口放环

[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

9.NAT

[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

[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

[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

测试:
在这里插入图片描述
试验结束

  • 9
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值