实验图:
实验步骤:
1.配置IP:
R1:
R2:
R3:
R4:
R5:
R6:
R7:
R8:
R9: R10:
R11:
R12:
2.R3-R5/R6/R7构建MGRE环境
代码:
[R3]int Tunnel 0/0/0
[R3-Tunnel0/0/0]ip add 172.16.0.1 24
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp
[R3-Tunnel0/0/0]source 34.1.1.3
[R3-Tunnel0/0/0]nhrp network-id 100
[R3-Tunnel0/0/0]nhrp entry multicast dynamic
[R5]int Tunnel 0/0/0
[R5-Tunnel0/0/0]ip add 172.16.0.2 24
[R5-Tunnel0/0/0]tunnel-protocol gre p2mp
[R5-Tunnel0/0/0]source s 4/0/0
[R5-Tunnel0/0/0]nhrp entry 172.16.0.1 34.1.1.3 register
[R6]int Tunnel 0/0/0
[R6-Tunnel0/0/0]ip add 172.16.0.3 24
[R6-Tunnel0/0/0]tunnel-protocol gre p2mp
[R6-Tunnel0/0/0]source s4/0/0
[R6-Tunnel0/0/0]nhrp entry 172.16.0.1 34.1.1.3 register
[R7]int Tunnel 0/0/0
[R7-Tunnel0/0/0]ip add 172.16.0.4 24
[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.1 34.1.1.3 register
R3:
R5:
R6:
R7:
3.R3/R5/R6/R7配置缺省
R3:
[R3]ip route-static 0.0.0.0 0 34.1.1.4
R5:
[R5]ip route-static 0.0.0.0 0 54.1.1.4
R6:
[R6]ip route-static 0.0.0.0 0 64.1.1.4
R7:
[R7]ip route-static 0.0.0.0 0 74.1.1.4
4.area0区域配置OSPF
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.1 0.0.0.0
[R3-Tunnel0/0/0]ospf network-type p2mp
[R3-Tunnel0/0/0]ospf timer hello 2
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.255.255
[R5-Tunnel0/0/0]ospf network-type p2mp
[R5-Tunnel0/0/0]ospf timer hello 2
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.3 0.0.0.0
[R6-ospf-1-area-0.0.0.0]net 172.16.2.1 0.0.0.0
[R6-Tunnel0/0/0]ospf network-type p2mp
[R6-Tunnel0/0/0]ospf timer hello 2
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.4 0.0.0.0
[R7-ospf-1-area-0.0.0.0]network 172.16.3.1 0.0.0.0
[R7-Tunnel0/0/0]ospf network-type p2mp
[R7-Tunnel0/0/0]ospf timer hello 2
OSPF路由表:
5.配置其他区域的ospf
R1:
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]area 1
[R1-ospf-1-area-0.0.0.1]network 0.0.0.0 255.255.255.255
R2:
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 1
[R2-ospf-1-area-0.0.0.1]network 0.0.0.0 255.255.255.255
R3:
[R3]ospf 1
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]network 172.16.16.3 0.0.0.0
R6:
[R6]ospf 1
[R6-ospf-1]area 2
[R6-ospf-1-area-0.0.0.2]network 172.16.32.1 0.0.0.0
R7:
[R7]ospf 1
[R7-ospf-1]area 3
[R7-ospf-1-area-0.0.0.3]network 172.16.48.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.49.1 0.0.0.0
[R8-ospf-1-area-0.0.0.3]network 172.16.48.2 0.0.0.0
[R8-ospf-1-area-0.0.0.3]network 172.16.48.5 0.0.0.0
R9:
[R9]ospf 1 router-id 9.9.9.9
[R9-ospf-1]area 3
[R9-ospf-1-area-0.0.0.3]net 172.16.48.6 0.0.0.0
[R9]ospf 2 router-id 9.9.9.9
[R9-ospf-2]area 0
[R9-ospf-2-area-0.0.0.0]network 172.16.64.1 0.0.0.0
[R9-ospf-2-area-0.0.0.0]network 172.16.66.1 0.0.0.0
R10:
[R10]ospf 1 router-id 10.10.10.10
[R10-ospf-1]area 0
[R10-ospf-1-area-0.0.0.0]network 0.0.0.0 255.255.255.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 0.0.0.0 255.255.255.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.32.6 0.0.0.0
因为R9同时处于两个区域并且不是骨干区域,所以要使用双向重发布的方式
[R9]ospf 1
[R9-ospf-1]import-route ospf 2
[R9]ospf 2
[R9-ospf-2]import-route ospf 1
6.启用RIP协议:
R12:
[R12]rip 1
[R12-rip-1]version 2
[R12-rip-1]network 172.16.0.0
双向重发布:
[R12]ospf 1
[R12-ospf-1]import-route rip 1
[R12]rip 1
[R12-rip-1]import-route ospf 1
7.减少LSA的更新量,进行区域汇总:
R3:
[R3]ospf 1
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]abr
[R3-ospf-1-area-0.0.0.1]abr-summary 172.16.16.0 255.255.240.0
R6:
[R6]ospf 1
[R6-ospf-1]area 2
[R6-ospf-1-area-0.0.0.2]abr-summary 172.16.32.0 255.255.240.0
R7:
[R7]ospf 1
[R7-ospf-1]area 3
[R7-ospf-1-area-0.0.0.3]network 172.16.48.0 255.255.240.0
R9:
[R9]ospf 1
[R9-ospf-1]asbr-summary 172.16.64.0 255.255.240.0
R12:
[R12]ospf 1
[R12-ospf-1]asbr-summary 172.16.128.0 255.255.128.0
R5OSPF路由表:
特殊区域:
R1:
[R1]ospf 1
[R1-ospf-1]area 1
[R1-ospf-1-area-0.0.0.1]stub
R2:
[R2]ospf 1
[R2-ospf-1]area 1
[R2-ospf-1-area-0.0.0.1]stub
R3:
[R3]ospf 1
[R3-ospf-1]area 1
R8:
[R8]ospf 1
[R8-ospf-1]area 3
[R8-ospf-1-area-0.0.0.3]nssa ns
R9:
[R9]ospf 1
[R9-ospf-1]area 3
[R9-ospf-1-area-0.0.0.3]nssa
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
8.保障更新安全
R1:
[R1]ospf 1
[R1-ospf-1]area 1
[R1-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 123456
R2:
[R2]ospf 1
[R2-ospf-1]area 1
[R2-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 123456
R3:
[R3]ospf 1
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 123456
9. R3-R6-R7配置NAT
R3:
[R3]acl 2000
[R3-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R3]int s4/0/0
[R3-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]int g0/0/0
[R7-GigabitEthernet0/0/0]nat outbound 2000
10.测试: