实验拓扑图和实验要求:
分析:
通过子网划分172.16.0.0/16网段减少路由条目,配置R3567MGRE环境并配置R3为中心站点,再配置ISP缺省路由,实现边界路由器私网互通,对各个路由器配置ospf并汇总路由信息后再宣告,重发布域外路由实现互通并配置NAT协议实现访问公网
配置
R1:
配置IP
[R1]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip add 172.16.32.1 24
[R1]int LoopBack 0
[R1-LoopBack0]ip add 172.16.37.0 22
ODPF配置[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.0.255
路由汇总[R1]ospf 1
[R1-ospf-1]a 1
[R1-ospf-1-area-0.0.0.1]stub
R2:
配置IP
[R2]int g 0/0/0
[R2-GigabitEthernet0/0/0]ip add 172.16.32.2 24
[R2]int LoopBack 0
[R2-LoopBack0]ip add 172.16.41.0 22ODPF配置
[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.0.255路由汇总
[R2]ospf 1
[R2-ospf-1]area 1
[R2-ospf-1-area-0.0.0.1]stub
R3:
配置IP
[R3]int g 0/0/0
[R3-GigabitEthernet0/0/0]ip add 172.16.32.3 24
[R3]int LoopBack 0
[R3-LoopBack0]ip add 172.16.45.0 22
配置缺省路由[R3]ip route-static 0.0.0.0 0 172.16.0.2
配置NAT出站[R3]acl 2000
[R3-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R3]int s 4/0/0
[R3-Serial4/0/0]nat outbound 2000
配置MGRE环境[R3]int Tunnel 0/0/0
[R3-Tunnel0/0/0]ip add 192.168.1.1 24
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp
[R3-Tunnel0/0/0]source Serial 4/0/0
[R3-Tunnel0/0/0]nhrp network-id 100
ODPF配置[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.1 0.0.0.0
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]network 172.16.32.0 0.0.7.255路由汇总
[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]ospf 1
[R3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1]stub no-summary防止空接口
[R3]ip route-static 172.16.32.0 19 NULL 0加快收敛速度
[R3]int t0/0/0
[R3-Tunnel0/0/0]ospf timer hello 10
R4:
配置IP
[ISP]int g 0/0/0
[ISP-GigabitEthernet0/0/0]ip add 172.16.3.2 24
[ISP]int LoopBack 0
[ISP-LoopBack0]ip add 172.16.5.0 22
[ISP]int s 3/0/0
[ISP-Serial3/0/0]ip add 172.16.2.2 24
[ISP-Serial3/0/0]int s 4/0/0
[ISP-Serial4/0/0]ip add 172.16.0.2 24
[ISP-Serial4/0/0]int s 4/0/1
[ISP-Serial4/0/1]ip add 172.16.1.2 24
R5:
配置IP
R5]int LoopBack 0
[R5-LoopBack0]ip add 172.16.9.0 22
[R5]int s 4/0/0
[R5-Serial4/0/0]ip add 172.16.1.1 24
配置缺省路由[R5]ip route-static 0.0.0.0 0 172.16.1.2
配置MGRE环境
[R5]int Tunnel 0/0/0
[R5-Tunnel0/0/0]ip add 192.168.1.2 24
[R5-Tunnel0/0/0]tunnel-protocol gre p2mp
[R5-Tunnel0/0/0]source Serial 4/0/0
[R5-Tunnel0/0/0]nhrp network-id 100
[R5-Tunnel0/0/0]nhrp entry 192.168.1.1 172.16.0.1 register
ODPF配置[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.255.255
加快收敛速度[R5]int t0/0/0
[R5-Tunnel0/0/0]ospf timer hello 10
R6:
配置IP
[R6]int LoopBack 0
[R6-LoopBack0]ip add 172.16.13.0 22
[R6-LoopBack0]q
[R6]int s 4/0/0
[R6-Serial4/0/0]ip add 172.16.2.1 24
配置缺省路由[R6]ip route-static 0.0.0.0 0 172.16.2.2
配置NAT出站
[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 s 4/0/0
[R6-Serial4/0/0]nat outbound 2000
配置MGRE环境[R6]int Tunnel 0/0/0
[R6-Tunnel0/0/0]ip add 192.168.1.3 24
[R6-Tunnel0/0/0]tunnel-protocol gre p2mp
[R6-Tunnel0/0/0]source Serial 4/0/0
[R6-Tunnel0/0/0]nhrp network-id 100
[R6-Tunnel0/0/0]nhrp entry 192.168.1.1 172.16.0.1 registerODPF配置
[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.2.1 0.0.0.0
[R6-ospf-1-area-0.0.0.0]network 172.16.13.0 0.0.0.0
[R6-ospf-1-area-0.0.0.0]area 1
[R6-ospf-1-area-0.0.0.1]network 172.16.64.1 0.0.0.0
路由汇总[R6]ospf 1
[R6-ospf-1]area 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]nssa no-summary防止空接口
[R6]ip route-static 172.16.64.0 19 NULL 0加快收敛速度
[R6-Tunnel0/0/0]ospf timer hello 10
R7:
配置IP
[R7]int g 0/0/0
[R7-GigabitEthernet0/0/0]ip add 172.16.3.1 24
[R7]int LoopBack 0
[R7-LoopBack0]ip add 172.16.17.0 22
[R7]int g 0/0/1
[R7-GigabitEthernet0/0/1]ip add 172.16.96.1 24
配置缺省路由[R7]ip route-static 0.0.0.0 0 172.16.3.2
配置NAT出站
[R7]acl 2000
[R7-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R7]int g 0/0/0
[R7-GigabitEthernet0/0/0]nat outbound 2000
配置MGRE环境[R7]int Tunnel 0/0/0
[R7-Tunnel0/0/0]ip add 192.168.1.4 24
[R7-Tunnel0/0/0]tunnel-protocol gre p2mp
[R7-Tunnel0/0/0]source g 0/0/0
[R7-Tunnel0/0/0]nhrp network-id 100
[R7-Tunnel0/0/0]nhrp entry 192.168.1.1 172.16.0.1 register
ODPF配置[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.17.0 0.0.0.0
[R7-ospf-1-area-0.0.0.0]network 172.16.3.1 0.0.0.0
[R7-ospf-1-area-0.0.0.0]area 3
[R7-ospf-1-area-0.0.0.3]network 172.16.96.1 0.0.0.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-ospf-1-area-0.0.0.3]nssa no-summary
防止空接口
[R7-ospf-1-area-0.0.0.3]ip route-static 172.16.96.0 19 NULL 0加快收敛
[R7]int t 0/0/0
[R7-Tunnel0/0/0]ospf timer hello 10
R8:
配置IP
[R8]int g 0/0/0
[R8-GigabitEthernet0/0/0]ip add 172.16.96.2 24
[R8-GigabitEthernet0/0/0]int g 0/0/1
[R8-GigabitEthernet0/0/1]ip add 172.16.97.1 24
[R8]int LoopBack 0
[R8-LoopBack0]ip add 172.16.101.0 22
ODPF配置[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.101.0 0.0.0.0
[R8-ospf-1-area-0.0.0.3]network 172.16.97.1 0.0.0.0
[R8-ospf-1-area-0.0.0.3]network 172.16.96.2 0.0.0.0
路由汇总[R8]ospf 1
[R8-ospf-1]a 3
[R8-ospf-1-area-0.0.0.3]nssa
R9:
配置IP
[R9]int g 0/0/0
[R9-GigabitEthernet0/0/0]ip add 172.16.97.2 24
[R9-GigabitEthernet0/0/0]int g 0/0/1
[R9-GigabitEthernet0/0/1]ip add 172.16.128.1 24
[R9]int LoopBack 0
[R9-LoopBack0]ip add 172.16.133.0 22ODPF配置
[R9]ospf 1 router-id 9.9.9.9
[R9-ospf-1]area 4
[R9-ospf-1-area-0.0.0.4]network 172.16.33.0 0.0.0.0
[R9-ospf-1-area-0.0.0.4]network 172.16.128.1 0.0.0.0
路由汇总[R9]ospf 1
[R9-ospf-1]asbr-summary 172.16.128.0 255.255.224.0
[R9-ospf-1]a 3
[R9-ospf-1-area-0.0.0.3]nssa防止空接口
[R9]ip route-static 172.16.128.0 19 NULL 0
R10:
配置IP
[R10]int g 0/0/0
[R10-GigabitEthernet0/0/0]ip add 172.16.128.2 24
[R10]int LoopBack 0
[R10-LoopBack0]ip add 172.16.137.0 22
ODPF配置[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.137.0 0.0.0.0
[R10-ospf-1-area-0.0.0.4]network 172.16.128.2 0.0.0.0
R11:
配置IP
[R11]int g 0/0/0
[R11-GigabitEthernet0/0/0]ip add 172.16.64.2 24
[R11]int LoopBack 0
[R11-LoopBack0]ip add 172.16.69.0 22
ODPF配置[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.65.1 0.0.0.0
[R11-ospf-1-area-0.0.0.2]network 172.16.65.2 0.0.0.0
路由汇总[R11]ospf 1
[R11-ospf-1]a 2
[R11-ospf-1-area-0.0.0.2]nssa
R12:
配置IP
[R12]int g 0/0/0
[R12-GigabitEthernet0/0/0]ip add 172.16.65.2 24
[R12]int LoopBack 0
[R12-LoopBack0]ip add 172.16.165.0 22
[R12-LoopBack0]int LoopBack 1
[R12-LoopBack1]ip add 172.16.169.0 22
ODPF配置[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.65.2 0.0.0.0
RIP配置[R12]rip 1
[R12-rip-1]v 2
[R12-rip-1]network 172.16.0.0
路由汇总[R12]ospf 1
[R12-ospf-1]asbr-summary 172.16.160.0 255.255.224.0
[R12-ospf-1]a 2
[R12-ospf-1-area-0.0.0.2]nssa
防止空接口
[R12]ip route-static 172.16.160.0 19 NULL 0
测试: