目录
一、实验要求:
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、全网可达;
二、搭建实验拓扑规划IP 地址
1)实验拓扑搭建
根据题目中图纸搭建拓扑
2)IP地址规划
根据题目要求可知,整个OSPF环境IP基于172.16.0.0/16划分;除了R12有两个环回,其他路由器均有一个环回IP。则我们可以试着将其划分出八个子网。
区域/作用范围 | 划分过程 | IP地址 |
area0 | 172.16.0000 0000.0/19 | 172.16.0.0/19 |
area1 | 172.16.0010 0000.0/19 | 172.16.32.0/19 |
area2 | 172.16.0100 0000.0/19 | 172.16.64.0/19 |
area3 | 172.16.0110 0000.0/19 | 172.16.96.0/19 |
area4 | 172.16.1000 0000.0/19 | 172.16.128.0/19 |
环回 | 172.16.1010 0000.0/19 | 172.16.160.0/19 |
保留地址 | 172.16.1100 0000.0/19 | 172.16.192.0/19 |
172.16.1110 0000.0/19 | 172.16.224.0/19 |
三、配置IP地址
# R1
interface GigabitEthernet0/0/0
ip address 172.16.33.1 255.255.255.0
interface LoopBack0
ip address 172.16.34.1 255.255.255.0
#R2
interface GigabitEthernet0/0/0
ip address 172.16.33.2 255.255.255.0
interface LoopBack0
ip address 172.16.35.2 255.255.255.0
# R3
interface Serial4/0/0
ip address 34.0.0.3 255.255.255.0
interface GigabitEthernet0/0/0
ip address 172.16.33.3 255.255.255.0
interface LoopBack0
ip address 172.16.36.3 255.255.255.0
# R4
interface Serial3/0/0
ip address 46.0.0.4 255.255.255.0
interface Serial4/0/0
ip address 34.0.0.4 255.255.255.0
interface Serial4/0/1
ip address 45.0.0.4 255.255.255.0
interface GigabitEthernet0/0/0
ip address 47.0.0.4 255.255.255.0
interface LoopBack0
ip address 172.16.2.4 255.255.255.0
# R5
interface Serial4/0/0
ip address 45.0.0.5 255.255.255.0
interface LoopBack0
ip address 172.16.3.5 255.255.255.0
# R6
interface Serial4/0/0
ip address 46.0.0.6 255.255.255.0
interface GigabitEthernet0/0/0
ip address 172.16.65.1 255.255.255.252
interface LoopBack0
ip address 172.16.4.6 255.255.255.0
# R7
interface GigabitEthernet0/0/0
ip address 47.0.0.7 255.255.255.0
interface GigabitEthernet0/0/1
ip address 172.16.97.1 255.255.255.252
interface LoopBack0
ip address 172.16.5.7 255.255.255.0
# R8
interface GigabitEthernet0/0/0
ip address 172.16.97.2 255.255.255.252
interface GigabitEthernet0/0/1
ip address 172.16.97.5 255.255.255.252
interface LoopBack0
ip address 172.16.98.8 255.255.255.0
# R9
interface GigabitEthernet0/0/0
ip address 172.16.97.6 255.255.255.252
interface GigabitEthernet0/0/1
ip address 172.16.129.1 255.255.255.252
interface LoopBack0
ip address 172.16.130.9 255.255.255.0
# R10
interface GigabitEthernet0/0/0
ip address 172.16.129.2 255.255.255.252
interface LoopBack0
ip address 172.16.131.10 255.255.255.0
# R11
interface GigabitEthernet0/0/0
ip address 172.16.65.2 255.255.255.252
interface GigabitEthernet0/0/1
ip address 172.16.65.5 255.255.255.252
interface GigabitEthernet0/0/2
interface LoopBack0
ip address 172.16.66.11 255.255.255.0
# R12
interface GigabitEthernet0/0/0
ip address 172.16.65.6 255.255.255.252
interface LoopBack0
ip address 172.16.160.12 255.255.255.0
interface LoopBack1
ip address 172.16.161.12 255.255.255.0
四、搭建MGRE环境
中心站点R3
[R3]ip route-static 0.0.0.0 0 34.0.0.4 # 保证公网通
interface Tunnel0/0/0
ip address 172.16.6.3 255.255.255.0
tunnel-protocol gre p2mp
source 34.0.0.3
ospf network-type broadcast
nhrp entry multicast dynamic
nhrp network-id 100
分支站点R5.R6.R7:
# R5
[R5]ip route-static 0.0.0.0 0 45.0.0.4
interface Tunnel0/0/0
ip address 172.16.6.5 255.255.255.0
tunnel-protocol gre p2mp
source Serial4/0/0
ospf network-type broadcast
ospf dr-priority 0
nhrp network-id 100
nhrp entry 172.16.6.3 34.0.0.3 register
# R6
[R6]ip route-static 0.0.0.0 0 46.0.0.4
interface Tunnel0/0/0
ip address 172.16.6.6 255.255.255.0
tunnel-protocol gre p2mp
source Serial4/0/0
ospf network-type broadcast
ospf dr-priority 0
nhrp network-id 100
nhrp entry 172.16.6.3 34.0.0.3 register
# R7
[R7]ip route-static 0.0.0.0 0 47.0.0.4
interface Tunnel0/0/0
ip address 172.16.6.7 255.255.255.0
tunnel-protocol gre p2mp
source GigabitEthernet0/0/0
ospf network-type broadcast
ospf dr-priority 0
nhrp network-id 100
nhrp entry 172.16.6.3 34.0.0.3 register
五、OSPF配置
R1
ospf 1 router-id 1.1.1.1
area 0.0.0.1
network 172.16.33.0 0.0.0.255
network 172.16.34.0 0.0.0.255
R2
ospf 1 router-id 2.2.2.2
area 0.0.0.1
network 172.16.33.0 0.0.0.255
network 172.16.35.0 0.0.0.255
R3
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 172.16.6.0 0.0.0.255
area 0.0.0.1
network 172.16.33.0 0.0.0.255
network 172.16.36.0 0.0.0.255
R5
ospf 1 router-id 5.5.5.5
area 0.0.0.0
network 172.16.3.0 0.0.0.255
network 172.16.6.0 0.0.0.255
R6
ospf 1 router-id 6.6.6.6
area 0.0.0.0
network 172.16.4.0 0.0.0.255
network 172.16.6.0 0.0.0.255
area 0.0.0.2
network 172.16.65.1 0.0.0.0
R7
ospf 1 router-id 7.7.7.7
area 0.0.0.0
network 172.16.5.0 0.0.0.255
network 172.16.6.0 0.0.0.255
area 0.0.0.3
network 172.16.97.1 0.0.0.0
R8
ospf 1 router-id 8.8.8.8
area 0.0.0.3
network 172.16.97.2 0.0.0.0
network 172.16.97.5 0.0.0.0
network 172.16.98.0 0.0.0.255
R9
ospf 1 router-id 9.9.9.9
area 0.0.0.3
network 172.16.97.6 0.0.0.0
ospf 2 router-id 9.9.9.9
area 0.0.0.4
network 172.16.129.1 0.0.0.0
network 172.16.130.0 0.0.0.255
R10
ospf 2 router-id 10.10.10.10
area 0.0.0.4
network 172.16.129.2 0.0.0.0
network 172.16.131.0 0.0.0.255
R11
ospf 1 router-id 11.11.11.11
area 0.0.0.2
network 172.16.65.2 0.0.0.0
network 172.16.65.5 0.0.0.0
network 172.16.66.0 0.0.0.0
R12
ospf 1 router-id 12.12.12.12
area 0.0.0.2
network 172.16.65.6 0.0.0.0
rip 1
version 2
network 172.16.0.0
六、 双向重发布
R9:
[R9]ospf 1
[R9-ospf-1]import-route ospf 2
[R9]ospf 2
[R9-ospf-2]import-route ospf 1
R12:
[R12-ospf-1]import-route rip 1
[R12]rip 1
[R12-rip-1]import-route ospf 1
七、NAT配置
# R3
acl 2000
rule 1 permit source any
int Serial 4/0/0
nat outbound 2000
# R5
acl 2000
rule 1 permit source any
int Serial 4/0/0
nat outbound 2000
# R6
acl 2000
rule 1 permit source any
int s 4/0/0
nat outbound 2000
# R7
acl 2000
rule 1 permit source any
int g 0/0/0
nat outbound 2000
八、路由聚合(汇总)
# 路由聚合
# R3
[R3-ospf-1-area-0.0.0.1]abr-summary 172.16.32.0 255.255.224.0
# 6
[R6-ospf-1-area-0.0.0.2]abr summary 172.16.64.0 255.255.224.0
# 7
[R7-ospf-1-area-0.0.0.3]abr-summary 172.16.96.0 255.255.224.0
# R9
[R9-ospf-1]asbr-summary 172.16.128.0 255.255.224.0
# R12
[R12-ospf-1]asbr-summary 172.16.160.0 255.255.224.0
防环
[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 O
九、配置特殊区域
区域1:totally stub
进入区域1对其内的所有路由器的对应区域视图内输入stub no-summary
例如: [R1-ospf-1-area-0.0.0.1]stub no-summary(R1、R2、R3)
[R2-ospf-1-area-0.0.0.1]stub no-summary
[R3-ospf-1-area-0.0.0.1] stub no-summary
区域2、3:totally nssa
进入区域2、3对其内的所有路由器的对应区域视图内输入nssa no-summary
例如: [R6-ospf-1-area-0.0.0.2]nssa no-summary
[R11-ospf-1-area-0.0.0.2]nssa no-summary
[R12-ospf-1-area-0.0.0.2]nssa no-summary
[R7-ospf-1-area-0.0.0.3]nssa no-summary
[R8-ospf-1-area-0.0.0.3]nssa no-summary
[R9-ospf-1-area-0.0.0.3]nssa no-summary(R6、R11、R12、R7、R8、R9)
为使R10可以访问R4所以需要对R10下发缺省,由于R9本身存在缺省则使用以下命令:
[R9-ospf-2]default-route-advertise
十:保证更新安全、加快收敛
保证更新安全
给区域内每个路由器配置:authentication-mode md5 1 cipher 123456
例如:[R6-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher 123456
加快收敛
修改hello时间:每个使用OSPF协议的路由器接口均需要修改:ospf timer hello 5
例如:[R1-GigabitEthernet0/0/0]ospf timer hello 5
测试:
随机抽取路由器ping任何一个接口地址