实验要求:1、R4为ISP,其上只能配置ip地址;R4与其他直连设备使用公有ip;
2、R3---R5/6/7为MGRE,R3为中心站点
3、整个OSPF环境ip地址为172.16.0.0/16
4、所有设备均可访问R4环回
5、减少LSA的更新量,加快收敛,保证更新安全
6、全网可达
7、除R12有两个环回,环回跑RIP,其余路由器仅有一个环回
实验思路:第一步:地址规划
第二步:公网配置(MGRE)
第三步:区域地址配置
第四步:OSPF
第五步:路由
第六步:优化
第七步:全网可达、访问外网
第一步:地址规划
两种划分思路:1、协议划分,172.16.0.0/16分给OSPF和RIP
2、区域划分,OSPF5个区域和一个RIP区域
本实验使用区域划分,较为合适:
6个区域借3位:172.16.0.0/16
172.16.000 00000.0/19——>172.16.0.0/19 area0
骨干
172.16.0.0/25 —— p2p 172.16.0.0/30 ……
172.16.0.128/25 —— MA 172.16.0.128/29……
用户
172.16.1.0/25 172.16.1.128/25 172.16.2.0/25 172.16.2.128/25……
172.16.001 00000.0/19——>172.16.32.0/19 area1
172.16.32.0/25 P2P 172.16.32.128/25 MA
172.16.33.0/25 172.16.33.128/25 172.168.34.0/25……
172.16.010 00000.0/19——>172.16.64.0/19 area2
172.16.64.0/25 P2P 172.16.64.128/25 MA
172.16.65.0/25 172.16.65.128/25 172.16.66.0/25……
172.16.011 00000.0/19——>172.16.96.0/19 area3
172.16.100 00000.0/19——>172.16.128.0/19 area4
172.16.101 00000.0/19——>172.16.160.0/19 rip
172.16.160.0/20 172.16.176.0/20
172.16.110 00000.0/19——>172.16.192.0/19 保留
172.16.111 00000.0/19——>172.16.224.0/19 保留
第二步:公网配置(MGRE)
公网配置:
[R3]int g0/0/2
[R3-GigabitEthernet0/0/2]ip add 34.1.1.1 24
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 34.1.1.2 24
[R4-GigabitEthernet0/0/0]int g4/0/0
[R4-GigabitEthernet4/0/0]ip add 74.1.1.2 24
[R4-GigabitEthernet4/0/0]int g0/0/1
[R4-GigabitEthernet0/0/1]ip add 54.1.1.2 24
[R4-GigabitEthernet0/0/1]int g0/0/2
[R4-GigabitEthernet0/0/2]ip add 64.1.1.2 24
[R4-GigabitEthernet0/0/2]int l0
[R4-LoopBack0]ip add 4.4.4.4 24
[R5]int g0/0/0
[R5-GigabitEthernet0/0/0]ip add 54.1.1.1 24
[R6]int g0/0/0
[R6-GigabitEthernet0/0/0]ip add 64.1.1.1 24
[R7]int g0/0/0
[R7-GigabitEthernet0/0/0]ip add 74.1.1.1 24
缺省:
[R3]ip route-static 0.0.0.0 0 34.1.1.2
[R5]ip route-static 0.0.0.0 0 54.1.1.2
[R6]ip route-static 0.0.0.0 0 64.1.1.2
[R7]ip route-static 0.0.0.0 0 74.1.1.2
测试:
配置MGRE
[R3]int t0/0/0
[R3-Tunnel0/0/0]ip add 172.16.0.129 29
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp
[R3-Tunnel0/0/0]source 34.1.1.1
[R3-Tunnel0/0/0]nhrp entry multicast dynamic
[R3-Tunnel0/0/0]nhrp network-id 100
[R5]int t0/0/0
[R5-Tunnel0/0/0]ip add 172.16.0.130 29
[R5-Tunnel0/0/0]tunnel-protocol gre p2mp
[R5-Tunnel0/0/0]source g0/0/0
[R5-Tunnel0/0/0]nhrp entry 172.16.0.129 34.1.1.1 register
[R5-Tunnel0/0/0]nhrp network-id 100
[R6]int t0/0/0
[R6-Tunnel0/0/0]ip add 172.16.0.131 29
[R6-Tunnel0/0/0]tunnel-protocol gre p2mp
[R6-Tunnel0/0/0]source g0/0/0
[R6-Tunnel0/0/0]nhrp entry 172.16.0.129 34.1.1.1 register
[R6-Tunnel0/0/0]nhrp network-id 100
[R7]int t0/0/0
[R7-Tunnel0/0/0]ip add 172.16.0.132 29
[R7-Tunnel0/0/0]tunnel-protocol gre p2mp
[R7-Tunnel0/0/0]source g0/0/0
[R7-Tunnel0/0/0]nhrp entry 172.16.0.129 34.1.1.1 register
[R7-Tunnel0/0/0]nhrp network-id 100
测试
area0环回
[R5]int l0
[R5-LoopBack0]ip add 172.16.1.1 25
[R6]int l0
[R6-LoopBack0]ip add 172.16.1.129 25
[R7]int l0
[R7-LoopBack0]ip add 172.16.2.1 25
第三步、区域配置
区域1:
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 172.16.32.129 29
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 172.16.32.130 29
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 172.16.32.131 29
[R1]int l0
[R1-LoopBack0]ip add 172.16.33.1 25
[R2]int l0
[R2-LoopBack0]ip add 172.16.33.129 25
[R3]int l0
[R3-LoopBack0]ip add 172.16.34.1 25
测试:
区域2
[R6]int g0/0/1
[R6-GigabitEthernet0/0/1]ip add 172.16.64.1 30
[R11]int g0/0/0
[R11-GigabitEthernet0/0/0]ip add 172.16.64.2 30
[R11-GigabitEthernet0/0/0]int g0/0/1
[R11-GigabitEthernet0/0/1]ip add 172.16.64.5 30
[R12]int g0/0/0
[R12-GigabitEthernet0/0/0]ip add 172.16.64.6 30
[R11]int l0
[R11-LoopBack0]ip add 172.16.65.1 25
区域3:
[R7]int g0/0/1
[R7-GigabitEthernet0/0/1]ip add 172.16.96.1 30
[R8]int g0/0/0
[R8-GigabitEthernet0/0/0]ip add 172.16.96.2 30
[R8-GigabitEthernet0/0/0]int g0/0/1
[R8-GigabitEthernet0/0/1]ip add 172.16.96.5 30
[R9]int g0/0/0
[R9-GigabitEthernet0/0/0]ip add 172.16.96.6 30
[R8]int l0
[R8-LoopBack0]ip add 172.16.97.1 25
区域4:
[R9]int g0/0/1
[R9-GigabitEthernet0/0/1]ip add 172.16.128.1 30
[R10]int g0/0/0
[R10-GigabitEthernet0/0/0]ip add 172.16.128.2 30
[R9]int l0
[R9-LoopBack0]ip add 172.16.129.1 25
[R10]int l0
[R10-LoopBack0]ip add 172.16.129.129 25
RIP:
[R12]int l0
[R12-LoopBack0]ip add 172.16.160.1 20
[R12-LoopBack0]int l1
[R12-LoopBack1]ip add 172.16.176.1 20
第四步:OSPF
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]a 1
[R1-ospf-1-area-0.0.0.1]network 172.16.0.0 0.0.255.255
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]a 1
[R2-ospf-1-area-0.0.0.1]network 172.16.0.0 0.0.255.255
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1]network 172.16.32.131 0.0.0.0
[R3-ospf-1-area-0.0.0.1]network 172.16.34.1 0.0.0.0
[R3-ospf-1-area-0.0.0.1]q
[R3-ospf-1]a 0
[R3-ospf-1-area-0.0.0.0]network 172.16.0.129 0.0.0.0
[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.0.0 0.0.255.255
[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.0.131 0.0.0.0
[R6-ospf-1-area-0.0.0.0]network 172.16.1.129 0.0.0.0
[R6-ospf-1-area-0.0.0.0]q
[R6-ospf-1]a 2
[R6-ospf-1-area-0.0.0.2]network 172.16.64.1 0.0.0.0
[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.2.1 0.0.0.0
[R7-ospf-1-area-0.0.0.0]network 172.16.0.132 0.0.0.0
[R7-ospf-1-area-0.0.0.0]q
[R7-ospf-1]a 3
[R7-ospf-1-area-0.0.0.3]network 172.16.96.1 0.0.0.0
[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.0.0 0.0.255.255
[R9]ospf 1 router-id 9.9.9.9
[R9-ospf-1]a 4
[R9-ospf-1-area-0.0.0.4]network 172.16.128.1 0.0.0.0
[R9-ospf-1-area-0.0.0.4]network 172.16.129.1 0.0.0.0
[R9-ospf-1-area-0.0.0.4]q
[R9-ospf-1]a 3
[R9-ospf-1-area-0.0.0.3]network 172.16.96.6 0.0.0.0
[R10]ospf 1 router-id 10.10.10.10
[R10-ospf-1]a 4
[R10-ospf-1-area-0.0.0.4]network 172.16.0.0 0.0.255.255
[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.0.0 0.0.255.255
[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.64.6 0.0.0.0
[R12-ospf-1-area-0.0.0.2]q
[R12-ospf-1]q
[R12]rip 1
[R12-rip-1]v 2
[R12-rip-1]undo summary
[R12-rip-1]network 172.16.0.0
MGRE的OSPF接口网络类型
[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
[R5-Tunnel0/0/0]ospf dr-priority 0
[R6]int t0/0/0
[R6-Tunnel0/0/0]ospf network-type broadcast
[R6-Tunnel0/0/0]ospf dr-priority 0
[R7]int t0/0/0
[R7-Tunnel0/0/0]ospf network-type broadcast
[R7-Tunnel0/0/0]ospf dr-priority 0
邻居关系全部建立
第五步:路由
重发布:
OSPF与RIP重发布
[R12]ospf 1
[R12-ospf-1]import-route rip
OSPF多进程重发布(减少LSA更新量,可以不用双向重发布)
[R9]ospf 1
[R9-ospf-1]a 4
[R9-ospf-1-area-0.0.0.4]undo network 172.16.128.1 0.0.0.0
[R9-ospf-1-area-0.0.0.4]undo network 172.16.129.1 0.0.0.0
[R9-ospf-1-area-0.0.0.4]q
[R9-ospf-1]q
[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.1 0.0.0.0
[R9-ospf-2-area-0.0.0.4]network 172.16.129.1 0.0.0.0
[R9-ospf-2-area-0.0.0.4]q
[R9-ospf-2]ospf 1
[R9-ospf-1]import-route ospf 2
第六步:优化
汇总
[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
[R3]ip route-static 172.16.32.0 19 NULL 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
[R6]ip route-static 172.16.64.0 19 NULL 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
[R7]ip route-static 172.16.96.0 19 NULL 0
R5上查看LSDB
[R12]ospf 1
[R12-ospf-1]asbr-summary 172.16.160.0 255.255.224.0
[R12]ip route-static 172.16.160.0 19 NULL 0
[R9]ospf 1
[R9-ospf-1]asbr-summary 172.16.128.0 255.255.224.0
[R9]ip route-static 172.16.128.0 19 NULL 0
非骨干优化:
[R1]ospf 1
[R1-ospf-1]a 1
[R1-ospf-1-area-0.0.0.1]stub
[R2]ospf 1
[R2-ospf-1]a 1
[R2-ospf-1-area-0.0.0.1]stub
[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
[R12]ospf 1
[R12-ospf-1]a 2
[R12-ospf-1-area-0.0.0.2]nssa
[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
[R9]ospf 1
[R9-ospf-1]a 3
[R9-ospf-1-area-0.0.0.3]nssa
第七步:全网可达、访问外网
OSPF全网可达
[R9]ospf 2
[R9-ospf-2]default-route-advertise
访问外网
[R3]acl 2000
[R3-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R3-acl-basic-2000]int g0/0/0
[R3-GigabitEthernet0/0/0]nat outbound 2000
[R7]acl 2000
[R7-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R7-acl-basic-2000]int g0/0/0
[R7-GigabitEthernet0/0/0]nat outbound 2000
[R6]acl 2000
[R6-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R6-acl-basic-2000]int g0/0/0
[R6-GigabitEthernet0/0/0]nat outbound 2000
测试: