一.实验拓扑
二、实验需求
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、根据要求做出拓扑图
2、划分IP
3、公网通
4、
四、实验步骤
1.根据要求做出拓扑图
2.划分IP
Area0
总地址:172.16.0.0/19
用户地址:
172.16.0.0/24--P2P
172.16.1.0/24--MA
172.16.2.0/24--R4(环回)
172.16.3.0/24--R5(环回)
172.16.4.0/24--R6(环回)
172.16.5.0/24--R7(环回)
172.16.6.0/24--隧道
Area1
总地址:172.16.32.0/19
用户地址:
172.16.32.0/24--P2P
172.16.33.0/24--MA
172.16.34.0/24--R1(环回)
172.16.35.0/24--R2(环回)
172.16.36.0/24--R3(环回)
area 2
总地址:
172.16.64.0/19用户地址:
172.16.64.0/24--P2P
172.16.65.0/24--MA
172.16.65.0/30
172.16.65.4/30
172.16.66.0/24--R11(环回)
area 3
总地址:172.16.96.0/19
用户地址:
172.16.96.0/24--P2P
172.16.97.0/24--MA
172.16.97.0/30
172.16.97.4/30
172.16.98.0/24--R8(环回)
3.公网通(配置静态缺省)
[R3]ip route-static 0.0.0.0 0 44.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.私网通(配置ospf,宣告与它直连的网段)
区域1:
(1)R1
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]a 1
[R1-ospf-1-area-0.0.0.1]ne
[R1-ospf-1-area-0.0.0.1]network 0.0.0.0 255.255.255.255
(2)R2
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]a 1
[R2-ospf-1-area-0.0.0.1]ne
[R2-ospf-1-area-0.0.0.1]network 0.0.0.0 255.255.255.255
(3)R3
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1]n
[R3-ospf-1-area-0.0.0.1]network 172.16.33.0 0.0.0.255
[R3-ospf-1-area-0.0.0.1]network 172.16.36.0 0.0.0.255
区域2:
(1)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.4.0 0.0.0.255
[R6-ospf-1]a 2
[R6-ospf-1-area-0.0.0.2]network 172.16.65.1 0.0.0.0
(2)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.5 0.0.0.0
[R11-ospf-1-area-0.0.0.2]network 172.16.66.0 0.0.0.255
(3)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.6 0.0.0.0
[R12]rip 1
[R12-rip-1]v 2
[R12-rip-1]undo summary
[R12-rip-1]net
[R12-rip-1]network 172.16.0.0
进入R12的ospf来引入RIP(因为R6无法学习到RIP的路由信息)
[R12]ospf 1
[R12-ospf-1]import-route rip
区域3:
(1)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.5.0 0.0.0.255
[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
(2)R8
[R8]ospf 1 router-id 8.8.8.8
[R8-ospf-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.5 0.0.0.0
[R8-ospf-1-area-0.0.0.3]network 172.16.98.0 0.0.0.255
(3)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.6 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.128.0 0.0.31.255
由于R7(域外)无法获取区域4的网段,因此需要将进程1引入进程2,将进程2引入进程1
[R9]ospf 1
[R9-ospf-1]import-route ospf 2
[R9]ospf 2
[R9-ospf-2]import-route ospf 1
区域4:
(1)R10
[R10]ospf 2 router-id 10.10.10.10
[R10-ospf-2]a 4
[R10-ospf-2-area-0.0.0.4]network 172.16.128.0 0.0.31.255
5.配置MGRE环境
(1)R3配置
[R3]int Tunnel 0/0/0
[R3-Tunnel0/0/0]ip add 172.16.6.3 24
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp
[R3-Tunnel0/0/0]
[R3-Tunnel0/0/0]nhrp network-id 100
[R3-Tunnel0/0/0]nhrp entry multicast dynamic
(2)R5配置
[R5]int Tunnel 0/0/0
[R5-Tunnel0/0/0]ip add 172.16.6.5 24
[R5]int t0/0/0
[R5-Tunnel0/0/0]tunnel-protocol gre p2mp
[R5-Tunnel0/0/0]source Serial 2/0/0
[R5-Tunnel0/0/0]nhrp entry 172.16.6.3 44.0.0.3 register
[R5-Tunnel0/0/0]nhrp network-id 100
(3)R6配置
[R6]int Tunnel 0/0/0
[R6-Tunnel0/0/0]ip add 172.16.6.6 24
[R6]int t0/0/0
[R6-Tunnel0/0/0]tunnel-protocol gre p2mp
[R6-Tunnel0/0/0]source Serial 2/0/0
[R6-Tunnel0/0/0]nhrp network-id 100
[R6-Tunnel0/0/0]nhrp entry 172.16.6.3 44.0.0.3 register
(4)R7配置
[R7]int Tunnel 0/0/0
[R7-Tunnel0/0/0]ip add 172.16.6.7 24
[R7]int t0/0/0
[R7-Tunnel0/0/0]tunnel-protocol gre p2mp
[R7-Tunnel0/0/0]source GigabitEthernet 0/0/0
[R7-Tunnel0/0/0]nhrp network-id 100
[R7-Tunnel0/0/0]nhrp entry 172.16.6.3 44.0.0.3 register
5.配置路由协议,传递私网路由
(1)R3配置<宣告通道路由>
[R3]ospf 1
[R3-ospf-1]a 0
[R3-ospf-1-area-0.0.0.0]network 172.16.6.0 0.0.0.255
(2)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.6.0 0.0.0.255
[R5-ospf-1-area-0.0.0.0]network 172.16.3.0 0.0.0.255
(3)R6配置
[R6]ospf 1
[R6-ospf-1]a 0
[R6-ospf-1-area-0.0.0.0]network 172.16.6.0 0.0.0.255
[R6-ospf-1-area-0.0.0.0]network 172.16.4.0 0.0.0.255
(4)R7配置
[R7]ospf 1
[R7-ospf-1]a 0
[R7-ospf-1-area-0.0.0.0]network 172.16.6.0 0.0.0.255
基于ospf协议配置MGRE环境时,中心站点可以学习到路由信息,而分支站点无法学习全
因此需要更改接口类型
[R3]int t0/0/0
[R3-Tunnel0/0/0]ospf network-type broadcast
[R5]int t0/0/0
[R5-Tunnel0/0/0]ospf network-type broadcast
[R6]int t0/0/0
[R6-Tunnel0/0/0]ospf network-type broadcast
[R7]int t0/0/0
[R7-Tunnel0/0/0]ospf network-type broadcast
虽然看起来full了,但是还是存在DR和BDR选举混乱
因此关闭R5、R6、R7对于DR和BDR的选举<将优先级改为0>
[R5]int t0/0/0
[R5-Tunnel0/0/0]ospf dr-priority 0
[R6]int t0/0/0
[R6-Tunnel0/0/0]ospf dr-priority 0
[R7]int t0/0/0
[R7-Tunnel0/0/0]ospf dr-priority 0
6.配置nat使得私网可以访问ISP的环回口<acl抓取流量>
(1)R3配置
[R3]acl 2000
[R3-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R3]int s2/0/0
[R3-Serial2/0/0]nat outbound 2000
(2)R6配置
[R6]acl 2000
[R6-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R6]int s2/0/0
[R6-Serial2/0/0]nat outbound 2000
(3)R7配置
[R7]acl 2000
[R7-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R7]int g0/0/0
[R7-GigabitEthernet0/0/0]nat outbound 2000
但是还是无法访问,因为在R3上没有通往公网的路由因此需要下发默认缺省
由于需要优化,且配置特殊区域是会自动下发缺省路由
7.减少LSA的更新量<更改ospf时间、路由聚合、区域汇总>
配路由汇总<将非骨干链路路由聚合发向骨干链路>
区域间聚合
[R3]ospf 1
[R3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1]abr-summary 172.16.32.0 255.255.224.0
[R6]ospf 1
[R6-ospf-1]a 2
[R6-ospf-1-area-0.0.0.2]abr-summary 172.16.64.0 255.255.224.0
[R7]ospf 1
[R7-ospf-1]a 3
[R7-ospf-1-area-0.0.0.3]abr-summary 172.16.96.0 255.255.224.0
域外聚合
[R9]ospf 1
[R9-ospf-1]asbr-summary 172.16.128.0 255.255.224.0
[R12]ospf 1
[R12-ospf-1]asbr-summary 172.16.160.0 255.255.224.0
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
[R12]ip route-static 172.16.160.0 19 NULL 0
[R9]ip route-static 172.16.128.0 19 NULL 0
9.配置特殊区域
由于做汇总只是让区域0的路由表和lsdb表减少了,其他区域只能通过特殊区域
[R1]ospf 1
[R1-ospf-1]a 1
[R1-ospf-1-area-0.0.0.1]stub no-summary
[R2]ospf 1
[R2-ospf-1]a 1
[R2-ospf-1-area-0.0.0.1]stub no-summary
[R3]ospf 1
[R3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1]stub no-summary
[R6]ospf 1
[R6-ospf-1]a 2
[R6-ospf-1-area-0.0.0.2]nssa no-summary
[R11]ospf 1
[R11-ospf-1]a 2
[R11-ospf-1-area-0.0.0.2]nssa no-summary
[R12]ospf 1
[R12-ospf-1]a 2
[R12-ospf-1-area-0.0.0.2]nssa no-summary
[R7]ospf 1
[R7-ospf-1]a 3
[R7-ospf-1-area-0.0.0.3]nssa no-summary
[R8]ospf 1
[R8-ospf-1]a 3
[R8-ospf-1-area-0.0.0.3]nssa no-summary
[R9]ospf 1
[R9-ospf-1]a 3
[R9-ospf-1-area-0.0.0.3]nssa no-summary
测试区域1
因为自动下发了默认路由,因此R1可以访问R4-ISP的环回
域外R10无法ping通,没有缺省
[R9]ospf 2
[R9-ospf-2]default-route-advertise
10.加快收敛
区域0
[R3]int s2/0/0
[R3-Serial2/0/0]ospf timer hello 5
[R5]int s2/0/0
[R5-Serial2/0/0]ospf timer hello 5
[R6]int s2/0/0
[R6-Serial2/0/0]ospf timer hello 5
[R7]int g0/0/0
[R7-GigabitEthernet0/0/0]ospf timer hello 5
区域1
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ospf timer hello 5
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ospf timer hello 5
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ospf timer hello 5
区域2
[R6]int g0/0/0
[R6-GigabitEthernet0/0/0]ospf timer hello 5
[R11]int g0/0/0
[R11-GigabitEthernet0/0/0]ospf timer hello 5
[R11-GigabitEthernet0/0/0]int g0/0/1
[R11-GigabitEthernet0/0/1]ospf timer hello 5
[R12]int g0/0/0
[R12-GigabitEthernet0/0/0]ospf timer hello 5
区域3
[R7]int g0/0/1
[R7-GigabitEthernet0/0/0]ospf timer hello 5
[R8]int g0/0/0
[R8-GigabitEthernet0/0/0]ospf timer hello 5
[R8-GigabitEthernet0/0/0]int g0/0/1
[R8-GigabitEthernet0/0/1]ospf timer hello 5
[R9]int g0/0/0
[R9-GigabitEthernet0/0/0]ospf timer hello 5
区域4
[R9]int g0/0/1
[R9-GigabitEthernet0/0/0]ospf timer hello 5
[R10]int g0/0/0
[R10-GigabitEthernet0/0/0]ospf timer hello 5
10.安全认证
区域2
[R6]ospf 1
[R6-ospf-1]a 2
[R6-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher wdy123456
[R11]ospf 1
[R11-ospf-1]a 2
[R11-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher wdy123456
[R12]ospf 1
[R12-ospf-1]a 2
[R12-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher wdy123456
区域1
[R1]ospf 1
[R1-ospf-1]a 1
[R1-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher wdy123456
[R2]ospf 1
[R2-ospf-1]a 1
[R2-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher wdy123456
[R3]ospf 1
[R3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher wdy123456
区域3
[R7]ospf 1
[R7-ospf-1]a 3
[R7-ospf-1-area-0.0.0.3]authentication-mode md5 1 cipher wdy123456
[R8]ospf 1
[R8-ospf-1]a 3
[R8-ospf-1-area-0.0.0.3]authentication-mode md5 1 cipher wdy123456
[R9]ospf 1
[R9-ospf-1]a 3
[R9-ospf-1-area-0.0.0.3]authentication-mode md5 1 cipher wdy123456
区域4
[R9]ospf 2
[R9-ospf-2]a 4
[R9-ospf-2-area-0.0.0.4]authentication-mode md5 1 cipher wdy123456
[R10]ospf 2
[R10-ospf-2]a 4
[R10-ospf-2-area-0.0.0.4]authentication-mode md5 1 cipher wdy123456