
1、拓扑信息
2、需求分析
3、IP规划
4、配置
5、测试
1、拓扑信息

2、需求分析
- R4为ISP,其上只能配置I地址; R4与其他所有直连设备间均使用公有IP
- 公网中使用的是点到点链路,因为比以太网链路稳定安全(只有两人)
- 5/6/7为MGRE环境,R3-RR3为中心站点;
- 只能使用非shortcut方式(因为如果shortcut方式,无法在R3上汇总除直连区域学到的路由信息,例:区域2)
- 整个OSPF环境IP基于172.16.0.0/16划分;
- 所有设备均可访问R4的环回;(需要做NAT)
- 减少LSA的更新量,加快收敛,保障更新安全;
- (OSPF优化:特殊区域)
- 减少Hello时间与死亡时间,网络接口P2P/P2MP
- 做认证
- 全网可达
3、IP规划
172.16.0.0/16
先分成2个网段(OSPF + RIP),借1位
172.16.0.0/17 ---OSPF
再按区域划分(5个区域),借3位
172.16.0.0/20 ---Area 0
三个环回 + MGRE = 4个网段,但一般网络只有200主机左右,所以直接规划到/24
172.16.0.0/24 ---MGRE
172.16.0.0/24 ---R5环回
172.16.0.0/24 ---R6环回
172.16.0.0/24 ---R7环回
...
172.16.15.0/24 ---保留备用
172.16.16.0/20 ---Area 1
三个环回 + 一个骨干 = 4个网段,但还是直接规划到/24
172.16.16.0/24 ---Area 1骨干
需要3个IP,所以到/29
172.16.16.0/29 ---不能用
172.16.16.1/29 ---R1接口
172.16.16.2/29 ---R2接口
172.16.16.3/29 ---R3接口
172.16.16.4/29 ---保留备用
172.16.16.5/29 ---保留备用
172.16.16.6/29 ---保留备用
172.16.16.7/29 ---不能用
172.16.17.0/24 ---R1环回
172.16.18.0/24 ---R2环回
172.16.19.0/24 ---R3环回
...
172.16.31.0/24 ---保留备用
172.16.32.0/20 ---Area 2
1个环回+2个骨干
172.16.32.0/24 ---R11环回
172.16.33.0/30 ---R6-R11
172.16.33.4/30 ---R11-R12
172.16.48.0/20 ---Area 3
1个环回+2个骨干
172.16.48.0/24 ---R8环回
172.16.49.0/30 ---R7-R8
172.16.49.4/30 ---R8-R9
172.16.64.0/20 ---Area 4
2个环回+1个骨干
172.16.64.0/24 ---R9环回
172.16.65.0/24 ---R10环回
172.16.66.0/30 ---R9-R10
172.16.80.0/20 ---保留备用
172.16.96.0/20 ---保留备用
172.16.112.0/20 ---保留备用
172.16.128.0/17 ---RIP
2个环回
172.16.128.0/18
172.16.192.0/18
4、配置
配置IP和环回
R1配置
<Huawei>sys
Huaweisys r1
r1int g0/0/0
r1-GigabitEthernet0/0/0ip add 172.16.16.1 29
r1-GigabitEthernet0/0/0int l 0
r1-LoopBack0ip add 172.16.17.1 24
R2配置
<Huawei>sys
Huaweisys r2
r2int g0/0/0
r2-GigabitEthernet0/0/0ip add 172.16.16.2 29
r2-GigabitEthernet0/0/0int l 0
r2-LoopBack0ip add 172.16.18.1 24
R3配置
<Huawei>sys
Huaweisys r3
r3int g0/0/0
r3-GigabitEthernet0/0/0ip add 172.16.16.3 29
r3-GigabitEthernet0/0/0int l 0
r3-LoopBack0ip add 172.16.19.1 24
r3-LoopBack0int s4/0/0
r3-Serial4/0/0ip add 34.0.0.3 24
R4配置
<Huawei>sys
Huaweisys r4
r4int g0/0/0
r4-GigabitEthernet0/0/0ip add 47.0.0.4 24
r4-GigabitEthernet0/0/0int s4/0/0
r4-Serial4/0/0ip add 34.0.0.4 24
r4-Serial4/0/0int s4/0/1
r4-Serial4/0/1ip add 45.0.0.4 24
r4-Serial4/0/1int s3/0/0
r4-Serial3/0/0ip add 46.0.0.4 24
r4-Serial3/0/0int l 0
r4-LoopBack0ip add 4.4.4.4 32
R5配置
<Huawei>sys
Huaweisys r5
r5int s4/0/0
r5-Serial4/0/0ip add 45.0.0.5 24
r5-Serial4/0/0int l 0
r5-LoopBack0ip add 172.16.1.1 24
R6配置
<Huawei>sys
Huaweisys r6
r6int s4/0/0
r6-Serial4/0/0ip add 46.0.0.6 24
r6-Serial4/0/0int g0/0/0
r6-GigabitEthernet0/0/0ip add 172.16.33.1 30
r6-GigabitEthernet0/0/0int l 0
r6-LoopBack0ip add 172.16.2.1 24
R7配置
<Huawei>sys
Huaweisys r7
r7int g0/0/0
r7-GigabitEthernet0/0/0ip add 47.0.0.7 24
r7-GigabitEthernet0/0/0int l 0
r7-LoopBack0ip add 172.16.3.1 24
r7-LoopBack0int g0/0/1
r7-GigabitEthernet0/0/1ip add 172.16.49.1 30
R8配置
<Huawei>sys
Huaweisys r8
r8int g0/0/0
r8-GigabitEthernet0/0/0ip add 172.16.49.2 30
r8-GigabitEthernet0/0/0int g0/0/1
r8-GigabitEthernet0/0/1ip add 172.16.49.5 30
r8-GigabitEthernet0/0/1int l 0
r8-LoopBack0ip add 172.16.48.1 24
R9配置
<Huawei>sys
Huaweisys r9
r9int g0/0/0
r9-GigabitEthernet0/0/0ip add 172.16.49.6 30
r9-GigabitEthernet0/0/0int l 0
r9-LoopBack0ip add 172.16.64.1 24
r9-LoopBack0int g0/0/1
r9-GigabitEthernet0/0/1ip add 172.16.66.1 30
R10配置
<Huawei>sys
Huaweisys r10
r10int g0/0/0
r10-GigabitEthernet0/0/0ip add 172.16.66.2 30
r10-GigabitEthernet0/0/0int l 0
r10-LoopBack0ip add 172.16.65.1 24
R11配置
<Huawei>sys
Huaweisys r11
r11int g0/0/0
r11-GigabitEthernet0/0/0ip add 172.16.33.2 30
r11-GigabitEthernet0/0/0int g0/0/1
r11-GigabitEthernet0/0/1ip add 172.16.33.5 30
r11-GigabitEthernet0/0/1int l 0
r11-LoopBack0ip add 172.16.32.1 24
R12配置
<Huawei>sys
Huaweisys r12
r12int g0/0/0
r12-GigabitEthernet0/0/0ip add 172.16.33.6 30
r12-GigabitEthernet0/0/0int l 0
r12-LoopBack0ip add 172.16.128.1 18
r12-LoopBack0int l 1
r12-LoopBack1ip add 172.16.192.1 18
测试所有直连网段是否通
用 Ping
搭建非shortcut方式的MGRE环境
R3配置
r3int t0/0/0
r3-Tunnel0/0/0ip add 172.16.0.1 24
r3-Tunnel0/0/0tunnel-protocol gre p2mp
r3-Tunnel0/0/0source 34.0.0.3
r3-Tunnel0/0/0nhrp entry multicast dynamic
r3ip route-static 0.0.0.0 0 34.0.0.4
R5配置
r5int t0/0/0
r5-Tunnel0/0/0ip add 172.16.0.2 24
r5-Tunnel0/0/0tunnel-protocol gre p2mp
r5-Tunnel0/0/0source Serial 4/0/0
r5-Tunnel0/0/0nhrp entry 172.16.0.1 34.0.0.3 register
r5ip route-static 0.0.0.0 0 45.0.0.4
R6配置
r6int t0/0/0
r6-Tunnel0/0/0ip add 172.16.0.3 24
r6-Tunnel0/0/0tunnel-protocol gre p2mp
r6-Tunnel0/0/0source Serial 4/0/0
r6-Tunnel0/0/0nhrp entry 172.16.0.1 34.0.0.3 register
r6ip route-static 0.0.0.0 0 46.0.0.4
R7配置
r7int t0/0/0
r7-Tunnel0/0/0ip add 172.16.0.4 24
r7-Tunnel0/0/0tunnel-protocol gre p2mp
r7-Tunnel0/0/0source GigabitEthernet 0/0/0
r7-Tunnel0/0/0nhrp entry 172.16.0.1 34.0.0.3 register
r7ip route-static 0.0.0.0 0 47.0.0.4
检查NHRP表

起Area 0的OSPF
R3配置
r3ospf 1 router-id 3.3.3.3
r3-ospf-1area 0
r3-ospf-1-area-0.0.0.0network 172.16.0.1 0.0.0.0
改p2mp类型
r3-ospf-1-area-0.0.0.0int t0/0/0
r3-Tunnel0/0/0ospf network-type p2mp
减少Hello时间与死亡时间
r3-Tunnel0/0/0ospf timer hello 1
将环回类型(主机)改为broadcast (不然OSPF学到的是掩码32的路由)
r6int l 0
r6-LoopBack0ospf network-type broadcast
R5配置
r5ospf 1 router-id 5.5.5.5
r5-ospf-1area 0
r5-ospf-1-area-0.0.0.0network 172.16.0.0 0.0.255.255
改p2mp类型
r5-ospf-1-area-0.0.0.0int t0/0/0
r5-Tunnel0/0/0ospf network-type p2mp
减少Hello时间与死亡时间
r5-Tunnel0/0/0ospf timer hello 1
R6配置
r6ospf 1 router-id 6.6.6.6
r6-ospf-1area 0
r6-ospf-1-area-0.0.0.0network 172.16.0.3 0.0.0.0
r6-ospf-1-area-0.0.0.0network 172.16.2.1 0.0.0.0
改p2mp类型
r6-ospf-1-area-0.0.0.0int t0/0/0
r6-Tunnel0/0/0ospf network-type p2mp
减少Hello时间与死亡时间
r6-Tunnel0/0/0ospf timer hello 1
R7配置
r7ospf 1 router-id 7.7.7.7
r7-ospf-1area 0
r7-ospf-1-area-0.0.0.0network 172.16.0.0 0.15.255.255
改p2mp类型
r7-ospf-1-area-0.0.0.0int t0/0/0
r7-Tunnel0/0/0ospf network-type p2mp
减少Hello时间与死亡时间
r7-Tunnel0/0/0ospf timer hello 1
测试OSPF与Hello修改



起Area 1的OSPF
R1配置
r1ospf 1 router-id 1.1.1.1
r1-ospf-1area 1
r1-ospf-1-area-0.0.0.1network 0.0.0.0 255.255.255.255
减少Hello时间与死亡时间
r1int g0/0/0
r1-GigabitEthernet0/0/0ospf timer hello 1
R2配置
r2ospf 1 router-id 2.2.2.2
r2-ospf-1area 1
r2-ospf-1-area-0.0.0.1network 0.0.0.0 255.255.255.255
减少Hello时间与死亡时间
r2int g0/0/0
r2-GigabitEthernet0/0/0ospf timer hello 1
R3配置
r3ospf 1
r3-ospf-1area 1
r3-ospf-1-area-0.0.0.1network 172.16.16.0 0.15.255.255
减少Hello时间与死亡时间
r3int g0/0/0
r3-GigabitEthernet0/0/0ospf timer hello 1
起Area 2的OSPF与RIP
R6配置
r6ospf 1
r6-ospf-1area 2
r6-ospf-1-area-0.0.0.2network 172.16.33.1 0.0.0.0
减少Hello时间与死亡时间
r6int g0/0/0
r6-GigabitEthernet0/0/0ospf timer hello 1
R11配置
r11ospf 1 router-id 11.11.11.11
r11-ospf-1area 2
r11-ospf-1-area-0.0.0.2network 0.0.0.0 255.255.255.255
减少Hello时间与死亡时间
r11int g0/0/0
r11-GigabitEthernet0/0/0ospf timer hello 1
r11-GigabitEthernet0/0/0int g0/0/1
r11-GigabitEthernet0/0/1ospf timer hello 1
R12配置
r12ospf 1 router-id 12.12.12.12
r12-ospf-1area 2
r12-ospf-1-area-0.0.0.2network 172.16.33.6 0.0.0.0
减少Hello时间与死亡时间
r12int g0/0/0
r12-GigabitEthernet0/0/0ospf timer hello 1
起RIP
r12-ospf-1-area-0.0.0.2q
r12-ospf-1q
r12rip 1
r12-rip-1ver 2
r12-rip-1undo summary
r12-rip-1network 172.16.0.0
起Area 3的OSPF
R7配置
r7ospf 1
r7-ospf-1area 3
r7-ospf-1-area-0.0.0.3network 172.16.49.1 0.0.0.0
减少Hello时间与死亡时间
r7int g0/0/1
r7-GigabitEthernet0/0/1ospf timer hello 1
R8配置
r8ospf 1 router-id 8.8.8.8
r8-ospf-1area 3
r8-ospf-1-area-0.0.0.3network 0.0.0.0 255.255.255.255
减少Hello时间与死亡时间
r8int g0/0/0
r8-GigabitEthernet0/0/0ospf timer hello 1
r8int g0/0/1
r8-GigabitEthernet0/0/1ospf timer hello 1
R9配置
r9ospf 1 router-id 9.9.9.9
r9-ospf-1area 3
r9-ospf-1-area-0.0.0.3network 172.16.49.6 0.0.0.0
减少Hello时间与死亡时间
r9int g0/0/0
r9-GigabitEthernet0/0/0ospf timer hello 1
起Area 4的OSPF(不同进程)
R9配置
r9ospf 2 router-id 9.9.9.9
r9-ospf-2area 4
r9-ospf-2-area-0.0.0.4network 172.16.64.0 0.15.255.255
减少Hello时间与死亡时间
r9-GigabitEthernet0/0/0int g0/0/1
r9-GigabitEthernet0/0/1ospf timer hello 1
R10配置
r10ospf 1 router-id 10.10.10.10
r10-ospf-1area 4
r10-ospf-1-area-0.0.0.4network 0.0.0.0 255.255.255.255
减少Hello时间与死亡时间
r10int g0/0/0
r10-GigabitEthernet0/0/0ospf timer hello 1
R12与R9上做重发布
R12配置
r12ospf 1
r12-ospf-1import-route rip 1
r12-ospf-1q
r12rip 1
r12-rip-1import-route ospf 1
R9配置
r9ospf 1
r9-ospf-1import-route ospf 2
r9-ospf-1q
r9ospf 2
r9-ospf-2import-route ospf 1
做OSPF路由汇总
R3配置
r3ospf 1
r3-ospf-1area 1
r3-ospf-1-area-0.0.0.1abr-summary 172.16.16.0 255.255.240.0
R6配置
r6ospf 1
r6-ospf-1area 2
r6-ospf-1-area-0.0.0.2abr-summary 172.16.32.0 255.255.240.0
R7配置
r7ospf 1
r7-ospf-1area 3
r7-ospf-1-area-0.0.0.3abr-summary 172.16.48.0 255.255.240.0
R9配置(域外路由汇总)
r9ospf 1
r9-ospf-1asbr-summary 172.16.64.0 255.255.240.0
R12配置(域外路由汇总)
r12ospf 1
r12-ospf-1asbr-summary 172.16.128.0 255.255.128.0
做特殊区域
Area 1做成Totally Stub Area
R1配置
r1ospf 1
r1-ospf-1area 1
r1-ospf-1-area-0.0.0.1stub
R2配置
r2ospf 1
r2-ospf-1area 1
r2-ospf-1-area-0.0.0.1stub
R3配置
r3ospf 1
r3-ospf-1area 1
r3-ospf-1-area-0.0.0.1stub no-summary
Area 2做成Totally NSSA
R6配置
r6ospf 1
r6-ospf-1area 2
r6-ospf-1-area-0.0.0.2nssa no-summary
R11配置
r11ospf 1
r11-ospf-1area 2
r11-ospf-1-area-0.0.0.2nssa
R12配置
r12ospf 1
r12-ospf-1area 2
r12-ospf-1-area-0.0.0.2nssa
Area 3做成Totally NSSA
R7配置
r7ospf 1
r7-ospf-1area 3
r7-ospf-1-area-0.0.0.3nssa no-summary
R8配置
r8ospf 1
r8-ospf-1area 3
r8-ospf-1-area-0.0.0.3nssa
R9配置
r9ospf 1
r9-ospf-1area 3
r9-ospf-1-area-0.0.0.3nssa
下发一个缺省,不然R10中既没有缺省,也没有其他路由
r9ospf 2
r9-ospf-2default-route-advertise
做认证保障更新安全
R9配置(接口认证)
r9int g0/0/1
r9-GigabitEthernet0/0/1ospf authentication-mode md5 1 cipher 123456
R10配置(接口认证)
r10int g0/0/0
r10-GigabitEthernet0/0/0ospf authentication-mode md5 1 cipher 123456
R1配置(区域认证)
r1ospf 1
r1-ospf-1area 1
r1-ospf-1-area-0.0.0.1authentication-mode md5 1 cipher 123456
R2配置(区域认证)
r2ospf 1
r2-ospf-1area 1
r2-ospf-1-area-0.0.0.1authentication-mode md5 1 cipher 123456
R3配置(区域认证)
r3ospf 1
r3-ospf-1area 1
r3-ospf-1-area-0.0.0.1authentication-mode md5 1 cipher 123456
空接口防环(优化)
R3配置
r3ip route-static 172.16.16.0 20 NULL 0
R6配置
r6ip route-static 172.16.32.0 20 NULL 0
静默接口(优化)
配在连接用户上(即环回接口)
R1配置
r1ospf 1
r1-ospf-1silent-interface LoopBack 0
R2配置
r2ospf 1
r2-ospf-1silent-interface LoopBack 0
R3配置
r3ospf 1
r3-ospf-1silent-interface LoopBack 0
R4配置
r4ospf 1
r4-ospf-1silent-interface LoopBack 0
R5配置
r5ospf 1
r5-ospf-1silent-interface LoopBack 0
R6配置
r6ospf 1
r6-ospf-1silent-interface LoopBack 0
R7配置
r7ospf 1
r7-ospf-1silent-interface LoopBack 0
R8配置
r8ospf 1
r8-ospf-1silent-interface LoopBack 0
R9配置
r9ospf 1
r9-ospf-1silent-interface LoopBack 0
R10配置
r10ospf 1
r10-ospf-1silent-interface LoopBack 0
R11配置
r11ospf 1
r11-ospf-1silent-interface LoopBack 0
R12配置
做NAT
R3配置
r3acl 2000
r3-acl-basic-2000rule permit source 172.16.16.0 0.0.15.255
r3-acl-basic-2000q
r3int s4/0/0
r3-Serial4/0/0nat outbound 2000
R6配置
r6acl 2000
r6-acl-basic-2000rule permit source 172.16.32.0 0.0.15.255
r6-acl-basic-2000rule permit source 172.16.128.0 0.0.254.255
r6-acl-basic-2000q
r6int s4/0/0
r6-Serial4/0/0nat outbound 2000
R7配置
r7acl 2000
r7-acl-basic-2000rule permit source 172.16.48.0 0.0.15.255
r7-acl-basic-2000rule permit source 172.16.64.0 0.0.15.255
r7-acl-basic-2000q
r7int g0/0/0
r7-GigabitEthernet0/0/0nat outbound 2000
5、测试
测试所有设备均可访问R4的环回







测试全网可达



