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、R4为ISP,其上只配置IP地址;R4与其他所直连设备间均使用公有IP;
①配置IP地址
R1
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 172.16.33.1 24
[R1-GigabitEthernet0/0/0]int l0
[R1-LoopBack0]ip add 172.16.34.1 24
[R1-LoopBack0]q
R2
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 172.16.33.3 24
[R2-GigabitEthernet0/0/0]int l0
[R2-LoopBack0]ip add 172.16.35.2 24
[R2-LoopBack0]q
R3
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 172.16.33.3 24
[R3]int s 4/0/0
[R3-Serial4/0/0]ip add 34.0.0.3 24
[R3]int l0
[R3-LoopBack0]ip add 172.16.36.3 24
[R3-LoopBack0]q
R4---ISP
[ISP]int s 4/0/0
[ISP-Serial4/0/0]ip add 34.0.0.4 24
[ISP-Serial4/0/0]int s 3/0/0
[ISP-Serial3/0/0]ip add 46.0.0.4 24
[ISP-Serial3/0/0]int s 4/0/1
[ISP-Serial4/0/1]ip add 45.0.0.4 24
[ISP-Serial4/0/1]int g0/0/0
[ISP-GigabitEthernet0/0/0]ip add 47.0.0.4 24
[ISP]int l0
[ISP-LoopBack0]ip add 172.16.2.4 24
[ISP-LoopBack0]q
R5
[R5]int s 4/0/0
[R5-Serial4/0/0]ip add 45.0.0.5 24
[R5-Serial4/0/0]int l0
[R5-LoopBack0]ip add 172.16.3.5 24
R6
[R6]int s 4/0/0
[R6-Serial4/0/0]ip add 46.0.0.6 24
[R6-Serial4/0/0]int g0/0/0
[R6-GigabitEthernet0/0/0]ip add 172.16.65.1 30
[R6-GigabitEthernet0/0/0]int l0
[R6-LoopBack0]ip add 172.16.4.6 24
[R6-LoopBack0]q
R7
[R7]int g0/0/0
[R7-GigabitEthernet0/0/0]ip add 47.0.0.7 24
[R7-GigabitEthernet0/0/0]int l0
[R7-LoopBack0]ip add 172.16.5.7 24
[R7-LoopBack0]int g0/0/1
[R7-GigabitEthernet0/0/1]ip add 172.16.97.1 30
[R7-GigabitEthernet0/0/1]q
R8
[R8]int g0/0/0
[R8-GigabitEthernet0/0/0]ip add 172.16.97.2 30
[R8-GigabitEthernet0/0/0]int g0/0/1
[R8-GigabitEthernet0/0/1]ip add 172.16.97.5 30
[R8-GigabitEthernet0/0/1]int l0
[R8-LoopBack0]ip add 172.16.98.8 24
[R8-LoopBack0]q
R9
[R9]int g0/0/0
[R9-GigabitEthernet0/0/0]ip add 172.16.97.6 30
[R9-GigabitEthernet0/0/0]int g0/0/1
[R9-GigabitEthernet0/0/1]ip add 172.16.129.1 30
[R9-GigabitEthernet0/0/1]int l0
[R9-LoopBack0]ip add 172.16.130.9 24
[R9-LoopBack0]q
R10
[R10]int g0/0/0
[R10-GigabitEthernet0/0/0]ip add 172.16.129.2 30
[R10-GigabitEthernet0/0/0]int l0
[R10-LoopBack0]ip add 172.16.131.10 24
[R10-LoopBack0]q
R11
[R11]int g0/0/0
[R11-GigabitEthernet0/0/0]ip add 172.16.65.2 30
[R11-GigabitEthernet0/0/0]int g0/0/1
[R11-GigabitEthernet0/0/1]ip add 172.16.65.5 30
[R11-GigabitEthernet0/0/1]int l0
[R11-LoopBack0]ip add 172.16.66.11 24
[R11-LoopBack0]q
R12
[R12]int g0/0/0
[R12-GigabitEthernet0/0/0]ip add 172.16.65.6 30
[R12-GigabitEthernet0/0/0]int l0
[R12-LoopBack0]ip add 172.16.160.12 24
[R12-LoopBack0]int l1
[R12-LoopBack1]ip add 172.16.161.12 24
[R12-LoopBack1]q
②使区域area0的公网全通
R3
[R3]ip route-static 0.0.0.0 0 34.0.0.4
R5
[R5]ip route-static 0.0.0.0 0 45.0.0.4
R6
[R6]ip route-static 0.0.0.0 0 46.0.0.4
R7
[R7]ip route-static 0.0.0.0 0 47.0.0.4
测试
③实现私网通,使用ospf宣告
R1
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]area 1
[R1-ospf-1-area-0.0.0.1]net 172.16.33.0 0.0.0.255
[R1-ospf-1-area-0.0.0.1]net 172.16.34.0 0.0.0.255
[R1-ospf-1-area-0.0.0.1]q
R2
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]ar 1
[R2-ospf-1-area-0.0.0.1]net 172.16.33.0 0.0.0.255
[R2-ospf-1-area-0.0.0.1]net 172.16.35.0 0.0.0.255
[R2-ospf-1-area-0.0.0.1]q
R3
[R3]ospf 1 r
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]net 172.16.33.0 0.0.0.255
[R3-ospf-1-area-0.0.0.1]area 0
[R3-ospf-1-area-0.0.0.0]net 172.16.36.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]q
R4接口全是公网网段,因此不用宣告
R5
[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1]ar 0
[R5-ospf-1-area-0.0.0.0]net 172.16.3.0 0.0.0.255
[R5-ospf-1-area-0.0.0.0]q
R6
[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]area 0
[R6-ospf-1-area-0.0.0.0]net 172.16.4.0 0.0.0.255
[R6-ospf-1-area-0.0.0.0]area 2
[R6-ospf-1-area-0.0.0.2]net 172.16.65.1 0.0.0.0
[R6-ospf-1-area-0.0.0.2]q
R7
[R7]ospf 1 router-id 7.7.7.7
[R7-ospf-1]area 0
[R7-ospf-1-area-0.0.0.0]net 172.16.5.0 0.0.0.255
[R7-ospf-1-area-0.0.0.0]area 3
[R7-ospf-1-area-0.0.0.3]net 172.16.97.1 0.0.0.0
[R7-ospf-1-area-0.0.0.3]q
R8
[R8]ospf 1 r
[R8]ospf 1 router-id 8.8.8.8
[R8-ospf-1]area 3
[R8-ospf-1-area-0.0.0.3]net 172.16.97.2 0.0.0.0
[R8-ospf-1-area-0.0.0.3]net 172.16.97.5 0.0.0.0
[R8-ospf-1-area-0.0.0.3]net 172.16.98.0 0.0.0.255
R9
[R9]ospf 1 router-id 9.9.9.9
[R9-ospf-1]ar 3
[R9-ospf-1-area-0.0.0.3]net 172.16.97.6 0.0.0.0
R11
[R11]ospf 1 router-id 11.11.11.11
[R11-ospf-1]ar 2
[R11-ospf-1-area-0.0.0.2]net 172.16.65.2 0.0.0.0
[R11-ospf-1-area-0.0.0.2]net 172.16.65.5 0.0.0.0
[R11-ospf-1-area-0.0.0.2]net 172.16.66.0 0.0.0.255
[R11-ospf-1-area-0.0.0.2]q
R12的G0/0/0接口使用ospf宣告,其他是rip协议宣告
[R12]ospf 1 r
[R12]ospf 1 router-id 12.12.12.12
[R12-ospf-1]area 2
[R12-ospf-1-area-0.0.0.2]net 172.16.65.6 0.0.0.0
[R12-ospf-1]q
[R12]rip 1
[R12-rip-1]ver 2
[R12-rip-1]undo summary
[R12-rip-1]net 172.16.0.0
在R12上引入rip协议路由
[R12]ospf 1
[R12-ospf-1]import-route rip
R10是不规则区域,在R9和R10上使用ospf2
R9
[R9]ospf 2 router-id 9.9.9.9
[R9-ospf-2]a 4
[R9-ospf-2-area-0.0.0.4]net 192.168.129.1 0.0.0.0
[R9-ospf-2-area-0.0.0.4]net 192.168.130.0 0.0.0.0
R10
[R10]ospf 2 router-id 10.10.10.10
[R10-ospf-2]a 4
[R10-ospf-2-area-0.0.0.4]net 172.16.129.2 0.0.0.0
[R10-ospf-2-area-0.0.0.4]net 172.16.131.0 0.0.0.255
每个区域查看一下
2、R3-R5、R6、R7为MGRE环境,R3为中心站点;
R3
[R3]int t 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]source s4/0/0
[R3-Tunnel0/0/0]nhrp network-id 100
[R3-Tunnel0/0/0]nhrp entry multicast dynamic
R5
[R5]int tu 0/0/0
[R5-Tunnel0/0/0]ip add 172.16.6.5 24
[R5-Tunnel0/0/0]tunnel-protocol gre p2mp
[R5-Tunnel0/0/0]source s4/0/0
[R5-Tunnel0/0/0]nhrp network-id 100
[R5-Tunnel0/0/0]nhrp entry 172.16.6.3 34.0.0.3 register
R6
[R6]int t0/0/0
[R6-Tunnel0/0/0]ip add 172.16.6.6 24
[R6-Tunnel0/0/0]tunnel-protocol gre p2mp
[R6-Tunnel0/0/0]source s4/0/0
[R6-Tunnel0/0/0]nhrp network-id 100
[R6-Tunnel0/0/0]nhrp entry 172.16.6.3 34.0.0.3 register
R7
[R7]int t0/0/0
[R7-Tunnel0/0/0]ip add 172.16.6.7 24
[R7-Tunnel0/0/0]tunnel-protocol gre p2mp
[R7-Tunnel0/0/0]source g0/0/0
[R7-Tunnel0/0/0]nhrp network-id 100
[R7-Tunnel0/0/0]nhrp entry 172.16.6.3 34.0.0.3 register
进入相应ospf协议区域宣告隧道地址
R3
[R3]ospf 1
[R3-ospf-1]ar 0
[R3-ospf-1-area-0.0.0.0]net 172.16.6.0 0.0.0.255
R5
[R5]ospf
[R5-ospf-1]area 0
[R5-ospf-1-area-0.0.0.0]net 172.16.6.0 0.0.0.255
[R5-ospf-1-area-0.0.0.0]
R6
[R6]ospf
[R6-ospf-1]area 0
[R6-ospf-1-area-0.0.0.0]net 172.16.6.0 0.0.0.255
[R6-ospf-1-area-0.0.0.0]
R7
[R7]ospf
[R7-ospf-1]area 0
[R7-ospf-1-area-0.0.0.0]net 172.16.6.0 0.0.0.255
[R7-ospf-1-area-0.0.0.0]
解决建邻问题---隧道是点到点的,不会选举DR/BDR,更改网络中tunnel接口类型为广播
R3
[R3]int t0/0/0
[R3-Tunnel0/0/0]ospf network-type broadcast
R5
[R5]int t0/0/0
[R5-Tunnel0/0/0]ospf network-type broadcast
R6
[R6]int t0/0/0
[R6-Tunnel0/0/0]ospf network-type broadcast
R7
[R7]int t0/0/0
[R7-Tunnel0/0/0]ospf network-type broadcast
取消其他分支站点的选取资格,保证中心站点是整个广播网络中唯一的DR
R5
[R5-Tunnel0/0/0]ospf dr-priority 0
R6
[R6-Tunnel0/0/0]ospf dr-priority 0
R7
[R7-Tunnel0/0/0]ospf dr-priority 0
查看一下
R9上进行路由引入,使区域4与其他区域能互相学习到
[R9]ospf 1
[R9-ospf-1]i
[R9-ospf-1]import-route ospf 2
[R9-ospf-1]ospf 2
[R9-ospf-2]import-route ospf 1
查看R10的路由表
3、整个OSPF环境IP基于172.16.0.0/16划分;除了R12有两个环回,其他路由器均有一个环回IP
4、所有设备均可访问R4的环回;
在边界路由器(ABR)上做Easy-ip
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 s4/0/0
[R3-Serial4/0/0]nat outbound 2000
R5
[R5]acl 2000
[R5-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R5-acl-basic-2000]q
[R5]int s4/0/0
[R5-Serial4/0/0]nat outbound 2000
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 s4/0/0
[R6-Serial4/0/0]nat outbound 2000
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-GigabitEthernet0/0/1]int g0/0/0
[R7-GigabitEthernet0/0/0]nat outbound 2000
5、减少LSA的更新量,加快收敛,保障更新安全;
①减少LSA的更新量---做路由聚合
ABR聚合和ASBR聚合---只能优化骨干区域
ABR聚合
R3
[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
[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
[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
ASBR聚合
R12
[R12]ospf 1
[R12-ospf-1]asbr-summary 172.16.160.0 255.255.224.0
R9
[R9]ospf 1
[R9-ospf-1]asbr-summary 172.16.128.0 255.255.224.0
totally stub(完全末梢区域),totally NSSA区域(完全非纯末梢区域)----可以优化非骨干区域
R1
[R1]ospf 1
[R1-ospf-1]ar 1
[R1-ospf-1-area-0.0.0.1]stub no-summary
R2
[R2]ospf 1
[R2-ospf-1]a 1
[R2-ospf-1-area-0.0.0.1]stub no-summary
R3
[R3]ospf 1
[R3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1]stub no-summary
R6
[R6]ospf 1
[R6-ospf-1]ar 2
[R6-ospf-1-area-0.0.0.2]nssa no-summary
R7
[R7]ospf 1
[R7-ospf-1]a 3
[R7-ospf-1-area-0.0.0.3]nssa no-summary
R8
[R8]ospf 1
[R8-ospf-1]a 3
[R8-ospf-1-area-0.0.0.3]nssa no-summary
R9
[R9]ospf 1
[R9-ospf-1]ar 3
[R9-ospf-1-area-0.0.0.3]nssa no-summary
[R9-ospf-1-area-0.0.0.3]q
R11
[R11]ospf 1
[R11-ospf-1]a 2
[R11-ospf-1-area-0.0.0.2]nssa no-summary
R12
[R12]ospf 1
[R12-ospf-1]a 2
[R12-ospf-1-area-0.0.0.2]nssa no-summary
[R12-ospf-1-area-0.0.0.2]
查看一下每个区域
在R9上给R10下发缺省
[R9]ospf 2
[R9-ospf-2]default-route-advertise
测试R10能ping通其他环回口了
②加快收敛--更改hello时间
R1
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ospf timer hello 5
R2
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ospf timer h
[R2-GigabitEthernet0/0/0]ospf timer hello 5
R3
[R3-ospf-1]int g0/0/0
[R3-GigabitEthernet0/0/0]ospf timer hello 5
[R3-GigabitEthernet0/0/0]int s4/0/0
[R3-Serial4/0/0]ospf timer hello 5
R4
[ISP]int s4/0/0
[ISP-Serial4/0/0]ospf timer hello 5
[ISP-Serial4/0/0]int s4/0/1
[ISP-Serial4/0/1]ospf timer hello 5
[ISP-Serial4/0/1]int g0/0/0
[ISP-GigabitEthernet0/0/0]ospf timer hello 5
[ISP-GigabitEthernet0/0/0]int s3/0/0
[ISP-Serial3/0/0]ospf timer hello 5
R5
[R5]int s4/0/0
[R5-Serial4/0/0]ospf ti he 5
R6
[R6]int s4/0/0
[R6-Serial4/0/0]ospf ti he 5
[R6]int g0/0/0
[R6-GigabitEthernet0/0/0]ospf ti he 5
R7
[R7]int g0/0/0
[R7-GigabitEthernet0/0/0]ospf ti he 5
[R7-GigabitEthernet0/0/0]int g0/0/1
[R7-GigabitEthernet0/0/1]ospf ti he 5
R8
[R8]int g0/0/0
[R8-GigabitEthernet0/0/0]ospf ti he 5
[R8-GigabitEthernet0/0/0]int g0/0/1
[R8-GigabitEthernet0/0/1]ospf ti he 5
R9
[R9]int g0/0/0
[R9-GigabitEthernet0/0/0]ospf ti he 5
[R9-GigabitEthernet0/0/0]int g0/0/1
[R9-GigabitEthernet0/0/1]ospf ti he 5
R10
[R10]int g0/0/0
[R10-GigabitEthernet0/0/0]ospf ti he 5
R11
[R11]int g0/0/0
[R11-GigabitEthernet0/0/0]ospf ti he 5
[R11-GigabitEthernet0/0/0]int g0/0/1
[R11-GigabitEthernet0/0/1]ospf ti he 5
R12
[R12]int g0/0/0
[R12-GigabitEthernet0/0/0]ospf ti he 5
查看一下
③保证更新安全---做区域验证
R1
[R1]ospf 1
[R1-ospf-1]a 1
[R1-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 12345
R2
[R2]ospf 1
[R2-ospf-1]a 1
[R2-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 12345
R3
[R3]ospf 1
[R3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 12345
[R3-ospf-1-area-0.0.0.2]a 0
[R3-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 12345
R4
[ISP]ospf
[ISP-ospf-1]a 0
[ISP-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 12345
R5
[R5]ospf
[R5-ospf-1]a 0
[R5-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 12345
R6
[R6]ospf
[R6-ospf-1]a 0
[R6-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 12345
[R6-ospf-1-area-0.0.0.0]a 2
[R6-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher 12345
R7
[R7]ospf
[R7-ospf-1]a 0
[R7-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 12345
[R7-ospf-1-area-0.0.0.0]a 3
[R7-ospf-1-area-0.0.0.3]authentication-mode md5 1 cipher 12345
R8
[R8]ospf
[R8-ospf-1]a 3
[R8-ospf-1-area-0.0.0.3]authentication-mode md5 1 cipher 12345
R9
[R9]ospf
[R9-ospf-1]a 3
[R9-ospf-1-area-0.0.0.3]authentication-mode md5 1 cipher 12345
[R9-ospf-1]ospf 2
[R9-ospf-2]area 4
[R9-ospf-2-area-0.0.0.4]authentication-mode md5 1 cipher 12345
R10
[R10]ospf
[R10-ospf-1]ospf 2
[R10-ospf-2]a 4
[R10-ospf-2-area-0.0.0.4]authentication-mode md5 1 cipher 12345
R11
[R11]ospf
[R11-ospf-1]a 2
[R11-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher 12345
R12
[R12]ospf
[R12-ospf-1]a 2
[R12-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher 12345
6、全网可达;
测试一下