一、实验要求
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、全网可达
二、拓扑图
三、实验思路
1.子网划分
2.公网各接口添加IP地址
3.配置.r3、r5、r6、r7路由器指向r4的缺省路由
4.公网建立MGRE
5OSPF创建
6.重发布
7.路由汇总
8.空接口防环
9.NAT
四、指令
1.公网建立mgre(r3 r5 r6 r7) 区域0
r3:
[r3]interface t0/0/0
[r3-Tunnel0/0/0]ip address 172.16.0.129 29
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp
[r3-Tunnel0/0/0]source 34.1.1.1
[r3]int Tunnel 0/0/0
[r3-Tunnel0/0/0]nhrp entry multicast dynamic
r5:
[r5]interface t0/0/0
[r5-Tunnel0/0/0]ip address 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
r6:
[r6]interface t0/0/0
[r6-Tunnel0/0/0]ip address 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
r7:
[r7]int t0/0/0
[r7-Tunnel0/0/0]ip address 172.168.0.132 26
[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
2.私有网络
(1)r1 r2 r3 区域1 172.16.32.0/19
r1:
[r1]interface lo1
[r1-LoopBack1]ip address 172.16.33.1 25
[r1-LoopBack1]q
[r1]interface g0/0/1
[r1-GigabitEthernet0/0/1]ip address 172.16.32.129 29
r2:
[r2]interface lo1
[r2-LoopBack1]ip address 172.16.33.129 25
[r2-LoopBack1]q
[r2]interface g0/0/0
[r2-GigabitEthernet0/0/0]ip address 172.16.32.130 29
r3:
[r3]interface lo1
[r3-LoopBack1]ip address 172.16.34.1 25
[r3-LoopBack1]q
[r3]interface g0/0/0
[r3-GigabitEthernet0/0/0]ip address 172.16.32.131 29
(2)r5 r6 r7 区域0 172.16.0.0/19
r5:
[r5]interface lo1
[r5-LoopBack1]ip address 172.16.1.1 25
r6:
[r6]interface lo1
[r6-LoopBack1]ip address 172.16.1.129 25
r7:
[r7]interface lo1
[r7-LoopBack1]ip address 172.16.2.1 25
(3)r7 r8 r9 区域3 172.16.64.0/19
r7:
[r7]interface g0/00/1
[r7-GigabitEthernet0/0/1]ip address 172.16.64.1 30
r8:
[r8]interface g0/0/0
[r8-GigabitEthernet0/0/0]ip address 172.16.64.2 30
[r8-GigabitEthernet0/0/0]q
[r8]interface g0/0/1
[r8-GigabitEthernet0/0/1]ip address 172.16.64.5 30
[r8]interface lo1
[r8-LoopBack1]ip address 172.16.65.1 25
r9:
[r9]interface g0/0/0
[r9-GigabitEthernet0/0/0]ip address 172.16.64.6 30
(4)r6 r11 r12 区域2 172.16.96.0/19
r6:
[r6]interface g0/0/1
[r6-GigabitEthernet0/0/1]ip address 172.16.96.1 30
r11:
[r11]interface lo1
[r11-LoopBack1]ip address 172.16.97.1 25
[r11-LoopBack1]q
[r11]interface g0/0/0
[r11-GigabitEthernet0/0/0]ip address 172.16.96.2 30
[r11-GigabitEthernet0/0/0]q
[r11]interface g0/0/1
[r11-GigabitEthernet0/0/1]ip ad
[r11-GigabitEthernet0/0/1]ip address 172.16.96.5 30
r12:
[r12]interface g0/0/0
[r12-GigabitEthernet0/0/0]ip address 172.16.96.6 30
(5)r9 r10 区域4 172.16.128.0/19
r9:
[r9]interface lo1
[r9-LoopBack1]ip address 172.16.129.1 25
[r9-LoopBack1]q
[r9]interface g0/0/1
[r9-GigabitEthernet0/0/1]ip address 172.16.128.1 30
r10:
[r10]interface lo1
[r10-LoopBack1]ip address 172.16.129.129 25
[r10-LoopBack1]q
[r10]interface g0/0/0
[r10-GigabitEthernet0/0/0]ip address 172.16.128.2 30
(6)r12
r12:
[r12]interface lo1
[r12-LoopBack1]ip address 172.16.160.1 20
[r12-LoopBack1]int lo2
[r12-LoopBack2]ip address 172.16.176.1 20
3.ospf
(1)
r1:
[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]area 1
[r1-ospf-1-area-0.0.0.1]network 172.16.32.0 0.0.1.125
r2:
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 1
[r2-ospf-1-area-0.0.0.1]network 172.16.32.0 0.0.1.255
r3:
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 172.16.0.129 0.0.0.0
[r3-ospf-1]area 1
[r3-ospf-1-area-0.0.0.1]network 172.16.32.0 0.0.3.255
r5:
[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]area 0
[r5-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.1.255
r6:
[r6]ospf 1 router-id 6.6.6.6
[r6-ospf-1]area 0
[r6-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.1.255
[r6-ospf-1-area-0.0.0.0]q
[r6-ospf-1]area 2
[r6-ospf-1-area-0.0.0.2]network 172.16.96.1 0.0.0.0
r7:
[r7]ospf 1 router-id 7.7.7.7
[r7-ospf-1]area 0
[r7-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.3.255
[r7-ospf-1-area-0.0.0.0]q
[r7-ospf-1]area 3
[r7-ospf-1-area-0.0.0.3]network 172.16.64.1 0.0.0.0
r8:
[r8]ospf 1 router-id 8.8.8.8
[r8-ospf-1]area 3
[r8-ospf-1-area-0.0.0.3]network 172.16.64.0 0.0.1.255
r9:
[r9]ospf 1 router-id 9.9.9.9
[r9-ospf-1]area 3
[r9-ospf-1-area-0.0.0.3]network 172.16.64.0 0.0.0.0
[r9-ospf-1-area-0.0.0.3]q
[r9-ospf-1]area 4
[r9-ospf-1-area-0.0.0.4]network 172.16.128.0 0.0.1.255
r10:
[r10]ospf 1 router-id 10.10.10.10
[r10-ospf-1]area 4
[r10-ospf-1-area-0.0.0.4]network 172.16.128.0 0.0.1.255
r11:
[r11]ospf 1 router-id 11.11.11.11
[r11-ospf-1]area 2
[r11-ospf-1-area-0.0.0.2]network 172.16.96.0 0.0.1.255
r12:
[r12]ospf 1 router-id 12.12.12.12
[r12-ospf-1]area 2
[r12-ospf-1-area-0.0.0.2]network 172.16.96.6 0.0.0.0
[r12]rip 1
[r12-rip-1]vers 2
[r12-rip-1]network 172.16.0.0
(2)
r3:
[r3]interface t0/0/0
[r3-Tunnel0/0/0]ospf network-type broadcast
r5:
[r5]interface t0/0/0
[r5-Tunnel0/0/0]ospf network-type broadcast
r6:
[r6]interface t0/0/0
[r6-Tunnel0/0/0]ospf network-type broadcast
r7:
[r7]interface t0/0/0
[r7-Tunnel0/0/0]ospf network-type broadcast
(3)
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
4.引入r12的rip
[r12]ospf 1
[r12-ospf-1]import-route rip
5.多进程双向重发布
1.
r9:
[r9]ospf 1
[r9-ospf-1]area 4
[r9-ospf-1-area-0.0.0.4]undo network 172.16.128.0 0.0.1.255
r9-ospf-1]undo area 4
[r9]ospf 2
[r9-ospf-2]area 4
[r9-ospf-2-area-0.0.0.4]network 172.16.128.0 0.0.1.255
2.
r9:
[r9]ospf 1
[r9-ospf-1]import-route ospf 2
[r9]ospf 2
[r9-ospf-2]import-route ospf 1
6.减少到各区域的路由,减少LSA的更新量
区域0:
r3:
[r3]ospf 1
[r3-ospf-1]area 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]area 2
[r6-ospf-1-area-0.0.0.2]abr-summary 172.16.96.0 255.255.224.0
r7:
[r7]ospf 1
[r7-ospf-1]area 3
[r7-ospf-1-area-0.0.0.3]abr-summary 172.16.64.0 255.255.224.0
r9:
[r9]ospf 1
[r9-ospf-1]asbr-summary 172.16.128.0 255.255.224.0
r12:
[r12]ospf 1
[r12-ospf-1]asbr-summary 172.16.160.0 255.255.224.0
区域1:
r1:
[r1]ospf 1
[r1-ospf-1]area 1
[r1-ospf-1-area-0.0.0.1]stub no
r2:
[r2]ospf 1
[r2-ospf-1]area 1
[r2-ospf-1-area-0.0.0.1]stub no
r3:
[r3]ospf 1
[r3-ospf-1]area 1
[r3-ospf-1-area-0.0.0.1]stub no-summary
区域2:
r6:
[r6]ospf 1
[r6-ospf-1]area 2
[r6-ospf-1-area-0.0.0.2]nssa no-summary
r11:
[r11]ospf 1
[r11-ospf-1]area 2
[r11-ospf-1-area-0.0.0.2]nssa
r12:
[r12]ospf 1
[r12-ospf-1]area 2
[r12-ospf-1-area-0.0.0.2]nssa
区域3:
r7:
[r7]ospf 1
[r7-ospf-1]area 3
[r7-ospf-1-area-0.0.0.3]nssa no-import-route
r8:
[r8]ospf 1
[r8-ospf-1]area 3
[r8-ospf-1-area-0.0.0.3]nssa
r9:
[r9]ospf 1
[r9-ospf-1]area 3
[r9-ospf-1-area-0.0.0.3]nssa
区域4:
r9:
[r9]ospf 2
[r9-ospf-2]undo import-route ospf 1
[r9]ospf 2
[r9-ospf-2]default-route-advertise
7.空接口防环
[r3]ip route-static 172.16.32.0 19 NULL 0
[r6]ip route-static 172.16.96.0 19 NULL 0
[r7]ip route-static 172.16.64.0 19 NULL 0
[r9]ip route-static 172.16.128.0 19 NULL 0
[r12]ip route-static 172.16.160.0 19 NULL 0
8.内部网络访问外部网络
r3:
[r3]acl 2000
[r3-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[r3]interface g0/0/1
[r3-GigabitEthernet0/0/1]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]int g0/0/0
[r6-GigabitEthernet0/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]int g0/0/0
[r7-GigabitEthernet0/0/0]nat outbound 2000
五、各路由器配置
r1:
r2:
r3:
r5:
r6:
r7:
r8:
r9:
r10:
r11:
r12:
六、结果