搭建网络拓扑图,如图
一、配置各路由器的环回地址以及接口IP
[r1]int LoopBack 0
[r1-LoopBack0]ip address 172.16.32.1 24
[r1-LoopBack0]int g0/0/0
[r1-GigabitEthernet0/0/0]ip address 172.16.48.1 29
[r2]interface LoopBack 0
[r2-LoopBack0]ip address 172.16.40.1 24
[r2-LoopBack0]int g0/0/0
[r2-GigabitEthernet0/0/0]ip address 172.16.48.2 29
[r3]int LoopBack 0
[r3-LoopBack0]ip address 172.16.0.1 24
[r3-LoopBack0]int g0/0/0
[r3-GigabitEthernet0/0/0]ip address 172.16.48.3 29
[r3-GigabitEthernet0/0/0]int
[r3-GigabitEthernet0/0/0]int s4/0/0
[r3-Serial4/0/0]ip address 34.1.1.1 24
[r4]interface Serial 4/0/0
[r4-Serial4/0/0]ip address 34.1.1.2 24
[r4-Serial4/0/0]int s4/0/1
[r4-Serial4/0/1]ip address 45.1.1.2 24
[r4-Serial4/0/1]int s3/0/0
[r4-Serial3/0/0]ip address 46.1.1.2 24
[r4-Serial3/0/0]int s3/0/1
[r4-Serial3/0/1]ip address 47.1.1.2 24
[r4]interface LoopBack 0
[r4-LoopBack0]ip ad
[r4-LoopBack0]ip address 4.4.4.4 24
[r5]int LoopBack 0
[r5-LoopBack0]ip address 172.16.4.1 24
[r5-LoopBack0]int s4/0/0
[r5-Serial4/0/0]ip address 45.1.1.1 24
[r6]int LoopBack 0
[r6-LoopBack0]ip address 172.16.8.1 24
[r6-LoopBack0]int s4/0/0
[r6-Serial4/0/0]ip address 46.1.1.1 24
[r6-Serial4/0/0]int g0/0/1
[r6-GigabitEthernet0/0/1]ip address 172.16.72.1 30
[r7]interface LoopBack 0
[r7-LoopBack0]ip address 172.16.12.1 24
[r7-LoopBack0]int s4/0/0
[r7-Serial4/0/0]ip address 47.1.1.1 24
[r7-Serial4/0/0]int g0/0/1
[r7-GigabitEthernet0/0/1]ip address 172.16.104.1 30
[r8]int LoopBack 0
[r8-LoopBack0]ip address 172.16.96.1 24
[r8-LoopBack0]int g0/0/0
[r8-GigabitEthernet0/0/0]ip address 172.16.104.2 30
[r8-GigabitEthernet0/0/0]int g0/0/1
[r8-GigabitEthernet0/0/1]ip address 172.16.104.129 30
[r9]int LoopBack 0
[r9-LoopBack0]ip address 172.16.128.1 24
[r9-LoopBack0]int g0/0/0
[r9-GigabitEthernet0/0/0]ip address 172.16.104.130 30
[r9-GigabitEthernet0/0/0]int g0/0/1
[r9-GigabitEthernet0/0/1]ip address 172.16.144.1 30
[r10]int LoopBack 0
[r10-LoopBack0]ip address 172.16.136.1 24
[r10-LoopBack0]int g0/0/0
[r10-GigabitEthernet0/0/0]ip address 172.16.144.2 30
[r11]int LoopBack 0
[r11-LoopBack0]ip address 172.16.64.1 24
[r11-LoopBack0]int g0/0/0
[r11-GigabitEthernet0/0/0]ip address 172.16.72.2 30
[r11-GigabitEthernet0/0/0]int g0/0/1
[r11-GigabitEthernet0/0/1]ip address 172.16.72.129 30
[r12]int LoopBack 0
[r12-LoopBack0]ip address 172.16.160.1 24
[r12-LoopBack0]int lo1
[r12-LoopBack1]ip address 172.16.168.1 24
[r12-LoopBack1]int g0/0/0
[r12-GigabitEthernet0/0/0]ip address 172.16.72.130 30
二、处理area0
1、配置R3/5/6/7缺省路由条目,指向R4(公网环境)
[r3]ip route-static 0.0.0.0 0 34.1.1.2
[r5]ip route-static 0.0.0.0 0 45.1.1.2
[r6]ip route-static 0.0.0.0 0 46.1.1.2
[r7]ip route-static 0.0.0.0 0 47.1.1.2
2、创建tunnel隧道 R3---R5/6/7为MGRE环境,R3为中心站点,R5/6/7为分支站点
R3(中心站点配置)
[r3]interface Tunnel 0/0/0 创建tunnel口
[r3-Tunnel0/0/0]ip address 172.16.16.1 29 配置接口IP地址
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp 修改接口模式为点到多点
[r3-Tunnel0/0/0]source 34.1.1.1 定义公有的源IP地址
[r3-Tunnel0/0/0]nhrp network-id 100
[r3-Tunnel0/0/0]nhrp entry multicast dynamic 本地成为NHRP中心,同时可以进行伪广播
R5/6/7(分支站点配置)
[r5]int Tunnel0/0/0
[r5-Tunnel0/0/0]ip address 172.16.16.2 29
[r5-Tunnel0/0/0]tunnel-protocol gre p2mp
[r5-Tunnel0/0/0]source 45.1.1.1
[r5-Tunnel0/0/0]nhrp network-id 100
[r5-Tunnel0/0/0]nhrp entry 172.16.16.1 34.1.1.1 register 分支需要到中心站点注册
[r6]interface Tunnel 0/0/0
[r6-Tunnel0/0/0]ip address 172.16.16.3 29
[r6-Tunnel0/0/0]tunnel-protocol gre p2mp
[r6-Tunnel0/0/0]source 46.1.1.1
[r6-Tunnel0/0/0]nhrp network-id 100
[r6-Tunnel0/0/0]nhrp entry 172.16.16.1 34.1.1.1 register
[r7]int Tunnel 0/0/0
[r7-Tunnel0/0/0]ip address 172.16.16.4 29
[r7-Tunnel0/0/0]tunnel-protocol gre p2mp
[r7-Tunnel0/0/0]source 47.1.1.1
[r7-Tunnel0/0/0]nhrp network-id 100
[r7-Tunnel0/0/0]nhrp entry 172.16.16.1 34.1.1.1 register
3、开启OSPF协议,宣告网段
[r3]ospf 10 router-id 93.3.3.3
[r3-ospf-10]area 0
[r3-ospf-10-area-0.0.0.0]network 172.16.0.0 0.0.0.255
[r3-ospf-10-area-0.0.0.0]network 172.16.16.1 0.0.0.0
[r5]ospf 10 router-id 95.5.5.5
[r5-ospf-10]area 0
[r5-ospf-10-area-0.0.0.0]network 172.16.16.2 0.0.0.0
[r5-ospf-10-area-0.0.0.0]network 172.16.4.0 0.0.0.255
[r6]ospf 10 router-id 96.6.6.6
[r6-ospf-10]area 0
[r6-ospf-10-area-0.0.0.0]network 172.16.16.3 0.0.0.0
[r6-ospf-10-area-0.0.0.0]network 172.16.8.0 0.0.0.255
[r7]ospf 10 router-id 97.7.7.7
[r7-ospf-10]area 0
[r7-ospf-10-area-0.0.0.0]network 172.16.16.4 0.0.0.0
[r7-ospf-10-area-0.0.0.0]network 172.16.12.0 0.0.0.255
4、更改area0中的OSPF网络类型
[r3]interface Tunnel 0/0/0
[r3-Tunnel0/0/0]ospf network-type broadcast
[r5]interface Tunnel 0/0/0
[r5-Tunnel0/0/0]ospf network-type broadcast
[r6]interface Tunnel 0/0/0
[r6-Tunnel0/0/0]ospf network-type broadcast
[r7]interface Tunnel 0/0/0
[r7-Tunnel0/0/0]ospf network-type broadcast
[r5-Tunnel0/0/0]ospf dr-priority 0
[r6-Tunnel0/0/0]ospf dr-priority 0
[r7-Tunnel0/0/0]ospf dr-priority 0
三、处理area1/2/3/4区域
area1:
[r1]ospf 10 router-id 91.1.1.1
[r1-ospf-10]area 1
[r1-ospf-10-area-0.0.0.1]network 172.16.32.0 0.0.0.255
[r1-ospf-10-area-0.0.0.1]network 172.16.48.1 0.0.0.0
[r2]ospf 10 router-id 92.2.2.2
[r2-ospf-10]area 1
[r2-ospf-10-area-0.0.0.1]network 172.16.40.0 0.0.0.255
[r2-ospf-10-area-0.0.0.1]network 172.16.48.2 0.0.0.0
[r3]ospf 10
[r3-ospf-10]area 1
[r3-ospf-10-area-0.0.0.1]network 172.16.48.2 0.0.0.0
area2:
[r6]ospf 10 router-id 96.6.6.6
[r6-ospf-10]area 2
[r6-ospf-10-area-0.0.0.2]network 172.16.72.1 0.0.0.0
[r11]ospf 10 router-id 101.11.11.11
[r11-ospf-10]area 2
[r11-ospf-10-area-0.0.0.2]network 172.16.64.0 0.0.0.255
[r11-ospf-10-area-0.0.0.2]network 172.16.72.2 0.0.0.0
[r11-ospf-10-area-0.0.0.2]network 172.16.72.129 0.0.0.0
[r12]ospf 10 router-id 102.12.12.12
[r12-ospf-10]area 2
[r12-ospf-10-area-0.0.0.2]network 172.16.72.130 0.0.0.0
area3:
[r7]ospf 10 router-id 97.7.7.7
[r7-ospf-10]area 3
[r7-ospf-10-area-0.0.0.3]network 172.16.104.1 0.0.0.0
[r8]ospf 10 router-id 98.8.8.8
[r8-ospf-10]area 3
[r8-ospf-10-area-0.0.0.3]network 172.16.96.0 0.0.0.255
[r8-ospf-10-area-0.0.0.3]network 172.16.104.2 0.0.0.0
[r8-ospf-10-area-0.0.0.3]network 172.16.104.129 0.0.0.0
[r9]ospf 10 router-id 99.9.9.9
[r9-ospf-10]area 3
[r9-ospf-10-area-0.0.0.3]network 172.16.104.130 0.0.0.0
area4及加快收敛,保障更新安全:
不规则区域问题在后面解决
[r9]ospf 10
[r9-ospf-10]area 4
[r9-ospf-10-area-0.0.0.4]network 172.16.128.0 0.0.0.255
[r9-ospf-10-area-0.0.0.4]network 172.16.144.1 0.0.0.0
[r9-ospf-10-area-0.0.0.4]q
[r9-ospf-10]q
[r9]interface g0/0/1
[r9-GigabitEthernet0/0/1]ospf timer hello 5
[r9-GigabitEthernet0/0/1]ospf timer dead 15
[r9-GigabitEthernet0/0/1]ospf authentication-mode md5 10 cipher huawei
[r10]ospf 10 router-id 100.10.10.10
[r10-ospf-10]area 4
[r10-ospf-10-area-0.0.0.4]network 172.16.136.0 0.0.0.255
[r10-ospf-10-area-0.0.0.4]network 172.16.144.2 0.0.0.0
[r10-ospf-10-area-0.0.0.4]q
[r10-ospf-10]q
[r10]int g0/0/0
[r10-GigabitEthernet0/0/0]ospf timer hello 5
[r10-GigabitEthernet0/0/0]ospf timer dead 15
[r10-GigabitEthernet0/0/0]ospf authentication-mode md5 10 cipher huawei
四、汇总减少LSA条目及不规则区域处理
1、解决不规则区域
[r9]ospf 10
[r9-ospf-10]area 4
[r9-ospf-10-area-0.0.0.4]undo network 172.16.128.0 0.0.0.255
[r9-ospf-10-area-0.0.0.4]undo network 172.16.144.1 0.0.0.0
[r9-ospf-10-area-0.0.0.4]q
[r9-ospf-10]undo area 4
[r9-ospf-10]ospf 20
[r9-ospf-20]area 4
[r9-ospf-20-area-0.0.0.4]network 172.16.128.0 0.0.0.255
[r9-ospf-20-area-0.0.0.4]network 172.16.144.1 0.0.0.0
[r9-ospf-20-area-0.0.0.4]q
[r9-ospf-20]ospf 10
[r9-ospf-10]import-route ospf 20
2、路由条目汇总
R3:
[r3]ospf 10
[r3-ospf-10]area 2
[r3-ospf-10-area-0.0.0.2]abr-summary 172.16.32.0 255.255.224.0
R6:
[r6]ospf 10
[r6-ospf-10]area 2
[r6-ospf-10-area-0.0.0.2]abr-summary 172.16.64.0 255.255.224.0
R12:
[r12]ospf 10
[r12-ospf-10]import-route direct
[r12-ospf-10]asbr-summary 172.16.160.0 255.255.224.0
R7:
[r7]ospf 10
[r7-ospf-10]area 3
[r7-ospf-10-area-0.0.0.3]abr-summary 172.16.96.0 255.255.224.0
R9:
[r2]ospf 10
[r2-ospf-10]asbr-summary 172.16.129.0 255.255.224.0
3、创建特殊区域,减少LSA
[r3]ospf 10
[r3-ospf-10]area 1
[r3-ospf-10-area-0.0.0.1]stub no-summary
[r1]ospf 10
[r1-ospf-10]area 1
[r1-ospf-10-area-0.0.0.1]nssa no-summary
[r2-ospf-10]area 1
[r2-ospf-10-area-0.0.0.1]nssa no-summary
[r6]ospf 10
[r6-ospf-10]area 2
[r6-ospf-10-area-0.0.0.2]nssa no-summary
[r11]ospf 10
[r11-ospf-10]area 2
[r11-ospf-10-area-0.0.0.2]nssa
[r12]ospf 10
[r12-ospf-10]area 2
[r12-ospf-10-area-0.0.0.2]nssa
[r7]ospf 10
[r7-ospf-10]area 3
[r7-ospf-10-area-0.0.0.3]nssa no-summary
[r8]ospf 10
[r8-ospf-10]area 3
[r8-ospf-10-area-0.0.0.3]nssa
[r9]ospf 10
[r9-ospf-10]area 3
[r9-ospf-10-area-0.0.0.3]nssa
[r9-ospf-10-area-0.0.0.3]q
[r9-ospf-10]q
[r9]ospf 20
[r9-ospf-20]default-route-advertise
4、全网可达(配置NAT)
[r3]acl 2000
[r3-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[r3-acl-basic-2000]in s4/0/0
[r3-Serial4/0/0]nat outbound 2000
[r5]acl 2000
[r5-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[r5-acl-basic-2000]int s4/0/0
[r5-Serial4/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 s4/0/0
[r6-Serial4/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 s4/0/0
[r7-Serial4/0/0]nat outbound 2000