一、实验拓扑
二、实验要求
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.路由规划(基于172.16.0.0/16划分)并配置内外网IP地址
2.在R3-R5-R6-R7上配置缺省指向公网R4
3.配置MGRE R3作为中心站点 R5-R6-R7作为分支站点
(1).查看中心站点和分支站点nhrp配置 dis nhrp peer all
4.在MGRE和内网启用OSPF协议进行宣告
(1).查看邻居关系 在R8-R9-R11上 dis ospf peer
(2).OSPF下的MGRE环境需要更改接口模式和邻居关系(DR和BDR选举)
5.查看路由表 路由不全缺少area4 和rip的路由
(1).将rip重发布到OSPF中
(2).考虑优化选择多进程双向重发布——在R9上删除area4的宣告进入OSPF进程2,将进程1和进程2互相发布到对方的OSPF进程中
6.路由优化——减少路由条目
(1).非骨干区域
特殊区域:
area 0 R2,R1末梢 R3完全末梢
area 2 R11,R12nssa R6完全nssa
area 3 R8,R9nssa R7完全nssa
发缺省:
area 4 进入R9进程2 删掉进程1 发一条缺省给R10
(2).骨干区域
域间路由汇总ABR R3-R6-R7
域外路由向内部汇总ASBR R12-R9
注意:配置汇总后记得配空接口防环
7.更改收敛时间
8.OSPF区域认证
9.R3-R6-R7在公网接口加nat
四、实验配置步骤
1.在R3-R5-R6-R7上配置缺省指向公网R4
[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.1
[R6]ip route-static 0.0.0.0 0 46.0.0.1
[R7]ip route-static 0.0.0.0 0 47.0.0.1
2.配置MGRE R3作为中心站点 R5-R6-R7作为分支站点
中心站点R3:
[R3]interface Tunnel 0/0/0
[R3-Tunnel0/0/0]ip address 172.16.6.1 24
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp
[R3-Tunnel0/0/0]source 34.0.0.1
[R3-Tunnel0/0/0]ospf network-type broadcast
[R3-Tunnel0/0/0]nhrp entry multicast dynamic
[R3-Tunnel0/0/0]nhrp network-id 100
分支站点:
R5
[R5]interface Tunnel 0/0/0
[R5-Tunnel0/0/0]ip address 172.16.6.2 24
[R5-Tunnel0/0/0]tunnel-protocol gre p2mp
[R5-Tunnel0/0/0]source Serial 4/0/0
[R5-Tunnel0/0/0]ospf network-type broadcast
[R5-Tunnel0/0/0]ospf dr-priority 0
[R5-Tunnel0/0/0]nhrp network-id 100
[R5-Tunnel0/0/0]nhrp entry 172.16.6.1 34.0.0.1 register
R6
[R6]interface Tunnel 0/0/0
[R6-Tunnel0/0/0]ip address 172.16.6.3 24
[R6-Tunnel0/0/0]tunnel-protocol gre p2mp
[R6-Tunnel0/0/0]source Serial 4/0/0
[R6-Tunnel0/0/0]ospf network-type broadcast
[R6-Tunnel0/0/0]ospf dr-priority 0
[R6-Tunnel0/0/0]nhrp network-id 100
[R6-Tunnel0/0/0]nhrp entry 172.16.6.1 34.0.0.1 register
R7
[R7]interface Tunnel 0/0/0
[R7-Tunnel0/0/0]ip address 172.16.6.4 24
[R7-Tunnel0/0/0]tunnel-protocol gre p2mp
[R7-Tunnel0/0/0]source G0/0/0
[R7-Tunnel0/0/0]ospf network-type broadcast
[R7-Tunnel0/0/0]ospf dr-priority 0
[R7-Tunnel0/0/0]nhrp network-id 100
[R7-Tunnel0/0/0]nhrp entry 172.16.6.1 34.0.0.1 register
3.启用OSPF协议并优化路由
R1
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]area 0.0.0.1
[R1-ospf-1-area-0.0.0.1]network 172.16.0.0 0.0.255.255
[R1-ospf-1-area-0.0.0.1]stub
R2
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0.0.0.1
[R2-ospf-1-area-0.0.0.1]network 172.16.0.0 0.0.255.255
[R2-ospf-1-area-0.0.0.1]stub
R3
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 172.16.6.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]area 0.0.0.1
[R3-ospf-1-area-0.0.0.1]abr-summary 172.16.32.0 255.255.224.0
[R3-ospf-1-area-0.0.0.1]network 172.16.36.0 0.0.0.255
[R3-ospf-1-area-0.0.0.1]stub no-summary
R5
[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1]area 0.0.0.0
[R5-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.255.255
R6
[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]area 0.0.0.0
[R6-ospf-1-area-0.0.0.0]network 172.16.4.0 0.0.0.255
[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]area 0.0.0.2
[R6-ospf-1-area-0.0.0.2]abr-summary 172.16.64.0 255.255.224.0
[R6-ospf-1-area-0.0.0.2]network 172.16.65.0 0.0.0.3
[R6-ospf-1-area-0.0.0.2]nssa no-summary
R7
[R7]ospf 1 router-id 7.7.7.7
[R7-ospf-1]area 0.0.0.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]network 172.16.6.0 0.0.0.255
[R7-ospf-1-area-0.0.0.0]area 0.0.0.3
[R7-ospf-1-area-0.0.0.3]abr-summary 172.16.96.0 255.255.224.0
[R7-ospf-1-area-0.0.0.3]network 172.16.97.0 0.0.0.3
[R7-ospf-1-area-0.0.0.3]nssa no-summary
R8
[R8]ospf 1 router-id 8.8.8.8
[R8-ospf-1]area 0.0.0.3
[R8-ospf-1-area-0.0.0.3]network 172.16.0.0 0.0.255.255
[R8-ospf-1-area-0.0.0.3]nssa
R9
[R9]ospf 1 router-id 9.9.9.9
[R9-ospf-1]asbr-summary 172.16.128.0 255.255.224.0
[R9-ospf-1]import-route ospf 2
[R9-ospf-1]area 0.0.0.3
[R9-ospf-1-area-0.0.0.3]network 172.16.97.4 0.0.0.3
[R9-ospf-1-area-0.0.0.3]nssa
[R9-ospf-1-area-0.0.0.3]area 0.0.0.4
[R9-ospf-1-area-0.0.0.4]ospf 2 default-route-advertise
[R9-ospf-1-area-0.0.0.4]network 172.16.129.0 0.0.0.3
[R9-ospf-1-area-0.0.0.4]network 172.16.130.0 0.0.0.255
R10
[R10]ospf 1 router-id 10.10.10.10
[R10-ospf-1]area 0.0.0.4
[R10-ospf-1-area-0.0.0.4]network 172.16.0.0 0.0.255.255
R11
[R11]ospf 1 router-id 11.11.11.11
[R11-ospf-1]area 0.0.0.2
[R11-ospf-1-area-0.0.0.2]network 172.16.0.0 0.0.255.255
[R11-ospf-1-area-0.0.0.2]nssa
R12
[R12]ospf 1 router-id 12.12.12.12
[R12-ospf-1]asbr-summary 172.16.160.0 255.255.224.0
[R12-ospf-1]import-route rip 1
[R12-ospf-1]area 0.0.0.2
[R12-ospf-1-area-0.0.0.2]network 172.16.65.4 0.0.0.3
[R12-ospf-1-area-0.0.0.2]nssa
更改接口模式和邻居关系(R-3-5-6-7都更改)
R3
[R3]interface Serial 4/0/0
[R3-Serial4/0/0]link-protocol ppp
[R3-Serial4/0/0]ospf dr-priority 0
R5
[R5]interface Serial 4/0/0
[R5-Serial4/0/0]link-protocol ppp
[R5-Serial4/0/0]ospf dr-priority 0
R6
[R6]interface Serial 4/0/0
[R6-Serial4/0/0]link-protocol ppp
[R6-Serial4/0/0]ospf dr-priority 0
4.R3-R6-R7在公网接口加nat
R3
[R3]acl 2000
[R3-acl-basic-2000]rule 5 permit source 172.16.0.0 0.0.255.255
[R3]interface Serial 4/0/0
[R3-Serial4/0/0]link-protocol ppp
[R3-Serial4/0/0]ip address 46.0.0.2 24
[R3-Serial4/0/0]nat outbound 2000
[R3-Serial4/0/0]display acl 2000
Basic ACL 2000, 1 rule
Acl's step is 5
rule 5 permit source 172.16.0.0 0.0.255.255
R5
[R5]acl 2000
[R5-acl-basic-2000]rule 5 permit source 172.16.0.0 0.0.255.255
[R5-acl-basic-2000]q
[R5]interface Serial 4/0/0
[R5-Serial4/0/0]link-protocol ppp
[R5-Serial4/0/0]ip address 46.0.0.2 24
[R5-Serial4/0/0]nat outbound 2000
[R5-Serial4/0/0]display acl 2000
Basic ACL 2000, 1 rule
Acl's step is 5
rule 5 permit source 172.16.0.0 0.0.255.255
R6
[R6]acl 2000
[R6-acl-basic-2000]rule 5 permit source 172.16.0.0 0.0.255.255
[R6-acl-basic-2000]q
[R6]interface Serial 4/0/0
[R6-Serial4/0/0]link-protocol ppp
[R6-Serial4/0/0]ip address 46.0.0.2 24
[R6-Serial4/0/0]nat outbound 2000
[R6-Serial4/0/0]display acl 2000
Basic ACL 2000, 1 rule
Acl's step is 5
rule 5 permit source 172.16.0.0 0.0.255.255
R7
[R7]acl 2000
[R7-acl-basic-2000]rule 5 permit source 172.16.0.0 0.0.255.255
[R7-acl-basic-2000]q
[R7]interface g0/0/0
[R7-GigabitEthernet0/0/0]ip address 47.0.0.2 24
[R7-GigabitEthernet0/0/0]nat outbound 2000
[R7-GigabitEthernet0/0/0]display acl 2000
Basic ACL 2000, 1 rule
Acl's step is 5
rule 5 permit source 172.16.0.0 0.0.255.255
5.配置汇总后空接口防环(R-3-6-7-9-12都配置)
[R3]ip route-static 172.16.96.0 255.255.224.0 NULL 0
[R5]ip route-static 172.16.96.0 255.255.224.0 NULL 0
[R6]ip route-static 172.16.96.0 255.255.224.0 NULL 0
[R7]ip route-static 172.16.96.0 255.255.224.0 NULL 0
[R9]ip route-static 172.16.96.0 255.255.224.0 NULL 0
[R12]ip route-static 172.16.96.0 255.255.224.0 NULL 0
五、测试全网通以及路由优化
1.全网通(R1 ping R4环回 R1 ping R5环回 R1 ping R10环回 R1 ping R12环回)
2.路由优化
R1-R5-R10-R12
六、OSPF思维导图
1.OSPF基础
2.OSPF高级特性1--不规则区域
3.OSPF高级特性2--特殊区域
4.OSPF高级特性--安全特性