第四章综合实验报告
一.实验拓扑图

二.实验要求
1、R4为ISP,其上只配置IP地址;R4与其他所直连设备间均使用公有IP;
2、R3-R5、R6、R7为MGRE环境,R3为中心站点;
3、整个OSPF环境IP基于172.16.0.0/16划分;除了R12有两个环回,其他路由器均有一个环回IP
4、所有设备均可访问R4的环回;
5、减少LSA的更新量,加快收敛,保障更新安全;
6、全网可达;
三.实验思路
1.划分IP
2.配置IP
3.使公网互通
4.公网ping通检测
5.为R3、R5、R6、R7配置MGRE环境
6.使内网互通
7.解决基于ospf的Mgre的两个问题
8.处理area4内的网段
9.处理R12上的两环回
10.配置nat
11.Ospf的路由聚合
12.加快收敛
13.保证更新安全
四.实验步骤
1.划分IP
具体划分过程:
先将172.16.0.0/16这个大网段划分成两个小网段,如:172.16.0.0/17、172.16.128.0/17.其中的172.16.0.0/17网段给整个ospf,另一个172.16.128.0/17网段给环回;此时,看172.16.0.0/17这个网段,由于ospf有5个区域,但area0的网段是给了的,因此,就将172.16.0.0/17在划分成4个小的网段,如:172.16.0.0/19、172.16.32.0/19、172.16.64.0/19、172.16.96.0/19。
Area1à172.16.0.0/19
R1、R2与R3属于同一网段,所以这儿就不需要在分了!!!
R1:172.16.0.1/19
R2:172.16.0.2/19
R3:172.16.0.3/19
Area2à172.16.32.0/19
需要在划出2个小网段;如:172.16.32.0/20、172.16.48.0/20
R6:172.16.32.6/20
R11:172.16.32.11/20、172.16.48.11/20
R12:172.16.48.12/20
Area3à172.16.64.0/19
需要在划出2个小网段;如:172.16.64.0/20、172.16.80.0/20
R7:172.16.64.7/20
R8:172.16.64.8/20、172.16.80.8/20
R9:172.16.80.9/20
Area4à172.16.96.0/19
R9与R10属于同一网段,所以这儿就不需要在分了!!!
R9:172.16.96.9/19
R10:172.16.96.10/19
然后,看172.16.128.0/17这个网段,由于一共有13个环回,所以需要13个网段。
1.172.16.128.0/21
2. 172.16.136.0/21
3. 172.16.144.0/21
4.172.16.152.0/21
5.172.16.160.0/21
6.172.16.168.0/21
7.172.16.176.0/21
8.172.16.184.0/21
9.172.16.192.0/21
10.172.16.200.0/21
11.172.16.208.0/21
12.172.16.216.0/21
13.172.16.224.0/21
由于后面需要隧道IP,所以我决定将在配环回时没用到的网段之中借1个网段
172.16.240.0/21
2.配置 IP
R1:

R2:

R3:

R4:

R5:

R6:

R7:

R8:

R9:

R10:

R11:

R12:

3.使公网互通
使公网通可以用静态、rip,但这里最好不要用ospf;
这里我用的是静态:
[R3]ip route-static 0.0.0.0 0 34.0.0.4
[R5]ip route-static 0.0.0.0 0 45.0.0.4
[R6]ip route-static 0.0.0.0 0 46.0.0.4
[R7]ip route-static 0.0.0.0 0 47.0.0.4
4.公网ping通检测
R3 ping R5:
[图片上传中...(image-2cf54f-1765182764111-11)]
R7 ping R4的环回:

5. 为R3、R5、R6、R7配置MGRE环境
R3:
[R3]int Tunnel 0/0/3
[R3-Tunnel0/0/3]tunnel-protocol gre p2mp
[R3-Tunnel0/0/3]ip address 172.16.240.3 21
[R3-Tunnel0/0/3]source 34.0.0.3
[R3-Tunnel0/0/3]nhrp network-id 100
R5:
[R5]int Tunnel 0/0/5
[R5-Tunnel0/0/5]tunnel-protocol gre p2mp
[R5-Tunnel0/0/5]ip address 172.16.240.5 21
[R5-Tunnel0/0/5]source Serial 4/0/0
[R5-Tunnel0/0/5]nhrp network-id 100
[R5-Tunnel0/0/5]nhrp entry 172.16.240.3 34.0.0.3 register
R6:
[R6]int Tunnel 0/0/6
[R6-Tunnel0/0/6]tunnel-protocol gre p2mp
[R6-Tunnel0/0/6]ip address 172.16.240.6 21
[R6-Tunnel0/0/6]source Serial 4/0/0
[R6-Tunnel0/0/6]nhrp network-id 100
[R6-Tunnel0/0/6]nhrp entry 172.16.240.3 34.0.0.3 register
R7:
[R7]int Tunnel 0/0/7
[R7-Tunnel0/0/7]tunnel-protocol gre p2mp
[R7-Tunnel0/0/7]ip address 172.16.240.7 21
[R7-Tunnel0/0/7]source GigabitEthernet 0/0/0
[R7-Tunnel0/0/7]nhrp network-id 100
[R7-Tunnel0/0/7]nhrp entry 172.16.240.3 34.0.0.3 register
6.使内网互通
整个拓扑的都是用的ospf,所以呢我们还是用ospf进行配置
Area1:
R1:ospf 1 router-id 1.1.1.1
area 0.0.0.1
network 172.16.0.0 0.0.31.255
network 172.16.128.1 0.0.0.0
R2:ospf 1 router-id 2.2.2.2
area 0.0.0.1
network 172.16.0.0 0.0.31.255
network 172.16.136.2 0.0.0.0
R3:ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 172.16.240.0 0.0.7.255
network 172.16.144.3 0.0.0.0
area 0.0.0.1
network 172.16.0.0 0.0.31.255
Area2:
R6:ospf 1 router-id 6.6.6.6
area 0.0.0.0
network 172.16.240.0 0.0.7.255
network 172.16.168.6 0.0.0.0
area 0.0.0.2
network 172.16.32.0 0.0.15.255
R5:
area 0.0.0.0
network 172.16.240.0 0.0.7.255
R11:
ospf 1 area 0.0.0.2
network 172.16.32.0 0.0.15.255
network 172.16.48.0 0.0.15.255
network 172.16.208.11 0.0.0.0
R12:
ospf 1 router-id 12.12.12.12
area 0.0.0.2
network 172.16.48.0 0.0.15.255
R12右边用到了RIP协议,我们就一起在这儿配了
[R12]rip 1
[R12-rip-1]undo summary
[R12-rip-1]version 2
[R12-rip-1]network 172.16.0.0
Area3:
R7:ospf 1 router-id 7.7.7.7
area 0.0.0.0
network 172.16.240.0 0.0.7.255
network 172.16.176.7 0.0.0.0
area 0.0.0.3
network 172.16.64.0 0.0.15.255
R8:ospf 1 router-id 8.8.8.8
area 0.0.0.3
network 172.16.64.0 0.0.15.255
network 172.16.80.0 0.0.15.255
network 172.16.184.8 0.0.0.0
Area4:
R9:ospf 1 router-id 9.9.9.9
area 0.0.0.3
network 172.16.80.0 0.0.15.255
network 172.16.176.9 0.0.0.0
ospf 2 router-id 9.9.9.10
area 0.0.0.4
network 172.16.96.0 0.0.31.255
R10:ospf 2 router-id 10.10.10.10
area 0.0.0.4
network 172.16.96.0 0.0.31.255
network 172.16.200.10 0.0.0.0
7.解决基于ospf的Mgre的问题
1.由于NBMA不支持广播,这也是不能建邻的原因之一;所以这里要在中心站点开启伪广播开其伪广播
[R3-Tunnel0/0/3]nhrp entry multicast dynamic
2.由于tunnel接口的类型为P2P,不进行DR
BDR的选举,因此要将其类型改为broadcast类型或者p2mp类型
R3:
这是它原本的类型:

通过命令:
[R3]int Tunnel 0/0/3
[R3-Tunnel0/0/3]ospf network-type p2mp
改后的网络类型:

R5,R6:,R7也进行同样的操作即可!!!
做完这些操作后,我们观察邻居表和路由表
邻居表:


路由表:

[图片上传中...(image-8eeede-1765182764111-4)]
8.处理area4内的网段
由于area4不与骨干相连,所以它是无法和其它区域通信,因此
我们要解决这个问题
解决方法:路由引入
[R9-ospf-1]import-route ospf 2
[R9-ospf-2]import-route ospf 1
9.处理R12上的两环回
由于R12的两个环回之间用的是RIP,那么想要与其它区域通信,也要进行路由引入
[R12-ospf-1]import-route rip
[R12-rip-1]import-route ospf
10.配置nat
R3:
[R3]acl 2000
[R3-acl-basic-2000]rule permit source 172.16.0.0 0.0.31.255
[R3-acl-basic-2000]rule permit source 172.16.128.0 0.0.7.255
[R3-acl-basic-2000]rule permit source 172.16.136.0 0.0.7.255
[R3]int Serial 4/0/0
[R3-Serial4/0/0]nat outbound 2000
R5:
[R5]acl 2000
[R5-acl-basic-2000]rule permit source 172.16.160.0 0.0.7.255
[R5-acl-basic-2000]quit
[R5]int Serial 4/0/0
[R5-Serial4/0/0]nat outbound 2000
R6:
[R6]acl 2000
[R6-acl-basic-2000]rule permit source 172.16.32.0 0.0.15.255
[R6-acl-basic-2000]rule permit source 172.16.48.0 0.0.15.255
[R6-acl-basic-2000]rule permit source 172.16.168.0 0.0.7.255
[R6-acl-basic-2000]rule permit source 172.16.208.0 0.0.7.255
[R6-acl-basic-2000]rule permit source 172.16.216.0 0.0.7.255
[R6-acl-basic-2000]rule permit source 172.16.224.0 0.0.7.255
[R6]int Serial 4/0/0
[R6-Serial4/0/0]nat outbound 2000
R7:
[R7]acl 2000
[R7-acl-basic-2000]rule permit source 172.16.64.0 0.0.15.255
[R7-acl-basic-2000]rule permit source 172.16.80.0 0.0.15.255
[R7-acl-basic-2000]rule permit source 172.16.96.0 0.0.31.255
[R7-acl-basic-2000]rule permit source 172.16.184.0 0.0.7.255
[R7-acl-basic-2000]rule permit source 172.16.192.0 0.0.7.255
[R7-acl-basic-2000]rule permit source 172.16.200.0 0.0.7.255
[R7]int GigabitEthernet 0/0/0
[R7-GigabitEthernet0/0/0]nat outbound 2000
配置缺省
[R3-ospf-1]undo default-route-advertise
[R6-ospf-1]default-route-advertise
[R7-ospf-1]default-route-advertise
检测是否可以与公网的环回通信:
[图片上传中...(image-69eea6-1765182764111-3)]
[图片上传中...(image-800614-1765182764111-2)]
11.Ospf的路由聚合和特殊区域
1.[R3-ospf-1]asbr-summary 172.16.0.0 255.255.224.0
[R3]ip route-static 172.16.0.0 19 NULL 0
[R6-ospf-1]asbr-summary 172.16.32.0 255.255.224.0
[R6]ip route-static 172.16.32.0 19 NULL 0
[R7-ospf-1]asbr-summary 172.16.64.0 255.255.224.0
[R7]ip route-static 172.16.64.0 19 NULL 0
[R9-ospf-1]asbr-summary 172.16.96.0 255.255.224.0
[R9]ip route-static 172.16.96.0 19 NULL 0
2.(1)****在area1配置totally stub
[R1]ospf 1
[R1-ospf-1]area 1
[R1-ospf-1-area-0.0.0.1]stub no-summary
[R2]ospf 1
[R2-ospf-1]area 1
[R2-ospf-1-area-0.0.0.1]stub no-summary
[R3]ospf 1
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]stub no-summary
(2)****在area2和area3上做totally NSSA
[R12]ospf 1
[R12-ospf-1]area 2
[R12-ospf-1-area-0.0.0.2]nssa no-summary
[R11]ospf 1
[R11-ospf-1]area 2
[R11-ospf-1-area-0.0.0.2]nssa no-summary
[R6]ospf 1
[R6-ospf-1]area 2
[R6-ospf-1-area-0.0.0.2]nssa no-summary
[R9]ospf 1
[R9-ospf-1]area 3
[R9-ospf-1-area-0.0.0.3]nssa no-summary
[R8]ospf 1
[R8-ospf-1]area 3
[R8-ospf-1-area-0.0.0.3]nssa no-summary
[R7]ospf 1
[R7-ospf-1]area 3
[R7-ospf-1-area-0.0.0.3]nssa no-summary
Ping****检测
[图片上传中...(image-b26a5-1765182764111-0)]
[图片上传中...(image-b2863a-1765182764111-1)]
12.加快收敛
以区域1为例à修改其hello时间
[R1-GigabitEthernet0/0/0]ospf timer hello 5
[R2-GigabitEthernet0/0/0]ospf timer hello 5
[R3-GigabitEthernet0/0/0]ospf timer hello 5
其它区域先加快收敛,进行相同的操作即可
13.保证更新安全
以区域1为例à进行接口认证
[R1]int GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher way12345
[R2]int GigabitEthernet 0/0/0
[R2-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher way12345
[R3]int GigabitEthernet 0/0/0
[R3-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher way12345