一.实验内容、
二.需求分析
1.R4为ISP,其上只能配置I地址 R4与其他所有直连设备间均使用公有IP
2.R3-R5,R6,R7为MGRE环境,R3为中心站点;
3.整个OSPF环境IP基于172.16.0.0/16划分;
4.所有设备均可访问R4的环回;(需要做NAT)
5.减少LSA的更新量,加快收敛,保障更新安全;
1.(OSPF优化:特殊区域)
2.减少Hello时间与死亡时间,网络接口P2P/P2MP
3.设备间做认证
6.全网可达
三.基于需求三进行IP划分拓扑信息如下
四.IP划分
172.16.0.0/16
1.先分成2个网段(OSPF + RIP),借1位
172.16.0.0/17 ---OSPF
2.再按区域划分(5个区域),借3位
Area 0
172.16.0.0/20
三个环回 + MGRE = 4个网段
172.16.0.0/24 ---MGRE
172.16.1.0/24 ---R5环回
172.16.2.0/24 ---R6环回
172.16.3.0/24 ---R7环回
Area 1
172.16.16.0/20
三个环回 + 一个骨干 = 4个网段
172.16.16.0/24 ---Area 1骨干
Area1需要3个IP地址,所以到29位
172.16.16.1/29 ---R1接口
172.16.16.2/29 ---R2接口
172.16.16.3/29 ---R3接口
172.16.17.0/24 ---R1环回
172.16.18.0/24 ---R2环回
172.16.19.0/24 ---R3环回
Area 2
172.16.32.0/20
1个环回+2个骨干
172.16.32.0/24 ---R11环回
172.16.33.0/30 ---R6-R11
172.16.33.4/30 ---R11-R12
Area 3
172.16.48.0/20
1个环回+2个骨干
172.16.48.0/24 ---R8环回
172.16.49.0/30 ---R7-R8
172.16.49.4/30 ---R8-R9
Area 4
172.16.64.0/20
2个环回+1个骨干
172.16.64.0/24 ---R9环回
172.16.65.0/24 ---R10环回
172.16.66.0/30 ---R9-R10
172.16.128.0/17 ---RIP
2个环回
172.16.128.0/18
172.16.192.0/18
五.配置各设备IP
R1
<Huawei>sys
[Huawei]sys r1
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]ip add 172.16.16.1 29
[r1-GigabitEthernet0/0/0]int l0
[r1-LoopBack0]ip add 172.16.17.1 24
R2
<Huawei>sys
[Huawei]sys r2
[r2]int g 0/0/0
[r2-GigabitEthernet0/0/0]ip add 172.16.16.2 29
[r2-GigabitEthernet0/0/0]int l0
[r2-LoopBack0]ip add 172.16.18.1 24
R3
<Huawei>sys
[Huawei]sys r3
[r3]int g 0/0/0
[r3-GigabitEthernet0/0/0]ip add 172.16.16.3 29
[r3-GigabitEthernet0/0/0]int l0
[r3-LoopBack0]ip add 172.16.19.1 24
[r3-LoopBack0]int s 4/0/0
[r3-Serial4/0/0]ip add 34.0.0.3 24
R4
<Huawei>sys
[Huawei]sys r4
[r4]int g 0/0/0
[r4-GigabitEthernet0/0/0]ip add 47.0.0.4 24
[r4-GigabitEthernet0/0/0]int s 4/0/0
[r4-Serial4/0/0]ip add 34.0.0.4 24
[r4-Serial4/0/0]int s 4/0/1
[r4-Serial4/0/1]ip add 45.0.0.4 24
[r4-Serial4/0/1]int s 3/0/0
[r4-Serial3/0/0]ip add 46.0.0.4 24
[r4-Serial3/0/0]int l0
[r4-LoopBack0]ip add 4.4.4.4 32
R5
<Huawei>sys
[Huawei]sys r5
[r5]int s 4/0/0
[r5-Serial4/0/0]ip add 45.0.0.5 24
[r5-Serial4/0/0]int l0
[r5-LoopBack0]ip add 172.16.1.1 24
R6
<Huawei>sys
[Huawei]sys r6
[r6]int s 4/0/0
[r6-Serial4/0/0]ip add 46.0.0.6 24
[r6-Serial4/0/0]int g 0/0/0
[r6-GigabitEthernet0/0/0]ip add 172.16.33.1 30
[r6-GigabitEthernet0/0/0]int l0
[r6-LoopBack0]ip add 172.16.2.1 24
R7
<Huawei>sys
[Huawei]sys r7
[r7]int g 0/0/0
[r7-GigabitEthernet0/0/0]ip add 47.0.0.7 24
[r7-GigabitEthernet0/0/0]int l0
[r7-LoopBack0]ip add 172.16.3.1 24
[r7-LoopBack0]int g 0/0/1
[r7-GigabitEthernet0/0/1]ip add 172.16.49.1 30
R8
<Huawei>sys
[Huawei]sys r8
[r8]int g 0/0/0
[r8-GigabitEthernet0/0/0]ip add 172.16.49.2 30
[r8-GigabitEthernet0/0/0]int g 0/0/1
[r8-GigabitEthernet0/0/1]ip add 172.16.49.5 30
[r8-GigabitEthernet0/0/1]int l0
[r8-LoopBack0]ip add 172.16.48.1 24
R9
<Huawei>sys
[Huawei]sys r9
[r9]int g 0/0/0
[r9-GigabitEthernet0/0/0]ip add 172.16.49.6 30
[r9-GigabitEthernet0/0/0]int l0
[r9-LoopBack0]ip add 172.16.64.1 24
[r9-LoopBack0]int g 0/0/1
[r9-GigabitEthernet0/0/1]ip add 172.16.66.1 30
R10
<Huawei>sys
[Huawei]sys r10
[r10]int g 0/0/0
[r10-GigabitEthernet0/0/0]ip add 172.16.66.2 30
[r10-GigabitEthernet0/0/0]int l0
[r10-LoopBack0]ip add 172.16.65.1 24
R11
<Huawei>sys
[Huawei]sys r11
[r11]int g 0/0/0
[r11-GigabitEthernet0/0/0]ip add 172.16.33.2 30
[r11-GigabitEthernet0/0/0]int g 0/0/1
[r11-GigabitEthernet0/0/1]ip add 172.16.33.5 30
[r11-GigabitEthernet0/0/1]int l0
[r11-LoopBack0]ip add 172.16.32.1 24
R12
<Huawei>sys
[Huawei]sys r12
[r12]int g 0/0/0
[r12-GigabitEthernet0/0/0]ip add 172.16.33.6 30
[r12-GigabitEthernet0/0/0]int l0
[r12-LoopBack0]ip add 172.16.128.1 18
[r12-LoopBack0]int l1
[r12-LoopBack1]ip add 172.16.192.1 18
六.搭建R3-R5,R6,R7为MGRE环境,R3为中心站点
R3为中心站点
[r3]int t 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.0.0.3
[r3-Tunnel0/0/0]nhrp entry multicast dynamic -----说明中心站点
[r3]ip route-static 0.0.0.0 0 34.0.0.4
R5
[r5]int t 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 Serial 4/0/0
[r5-Tunnel0/0/0]nhrp entry 172.16.0.1 34.0.0.3 register ----向中心站点R3汇报
[r5]ip route-static 0.0.0.0 0 45.0.0.4
R6
[r6]int t 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 Serial 4/0/0
[r6-Tunnel0/0/0]nhrp entry 172.16.0.1 34.0.0.3 register ----向中心站点R3汇报
[r6]ip route-static 0.0.0.0 0 46.0.0.4
R7
[r7]int t 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 GigabitEthernet 0/0/0
[r7-Tunnel0/0/0]nhrp entry 172.16.0.1 34.0.0.3 register ----向中心站点R3汇报
[r7]ip route-static 0.0.0.0 0 47.0.0.4
检查R3上的NHRP表
七.配置各区域OSPF
Area0
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-ospf-1-area-0.0.0.0]int t 0/0/0
[r3-Tunnel0/0/0]ospf network-type p2mp ----将接口配置改p2mp类型
[r3-Tunnel0/0/0]ospf timer hello 1 ------减少Hello时间
[r6]int l0
[r6-LoopBack0]ospf network-type broadcast ---将环回类型改为broadcast
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-ospf-1-area-0.0.0.0]int t 0/0/0
[r5-Tunnel0/0/0]ospf network-type p2mp----将接口配置改p2mp类型
[r5-Tunnel0/0/0]ospf timer hello 1------减少Hello时间与死亡时间
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]network 172.16.2.1 0.0.0.0
[r6-ospf-1-area-0.0.0.0]int t 0/0/0
[r6-Tunnel0/0/0]ospf network-type p2mp----将接口配置改p2mp类型
[r6-Tunnel0/0/0]ospf timer hello 1-----减少Hello时间
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.15.255.255
[r7-ospf-1-area-0.0.0.0]int t 0/0/0
[r7-Tunnel0/0/0]ospf network-type p2mp----将接口配置改p2mp类型
[r7-Tunnel0/0/0]ospf timer hello 1----减少Hello时间
Area1
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
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]ospf timer hello 1------减少Hello时间
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
[r2]int g 0/0/0
[r2-GigabitEthernet0/0/0]ospf timer hello 1------减少Hello时间
R3
[r3]ospf 1
[r3-ospf-1]area 1
[r3-ospf-1-area-0.0.0.1]network 172.16.16.0 0.15.255.255
[r3]int g 0/0/0
[r3-GigabitEthernet0/0/0]ospf timer hello 1-----减少Hello时间
Area2(R12需要配置RIP)
R6
[r6]ospf 1
[r6-ospf-1]area 2
[r6-ospf-1-area-0.0.0.2]network 172.16.33.1 0.0.0.0
[r6]int g 0/0/0
[r6-GigabitEthernet0/0/0]ospf timer hello 1 ----减少Hello时间
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
[r11]int g 0/0/0
[r11-GigabitEthernet0/0/0]ospf timer hello 1---减少Hello时间
[r11-GigabitEthernet0/0/0]int g 0/0/1
[r11-GigabitEthernet0/0/1]ospf timer hello 1---减少Hello时间
R12(需要配置RIP)
[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.33.6 0.0.0.0
[r12]int g 0/0/0
[r12-GigabitEthernet0/0/0]ospf timer hello 1---减少Hello时间
配置RIP
[r12-ospf-1-area-0.0.0.2]q
[r12-ospf-1]q
[r12]rip 1
[r12-rip-1]ver 2
[r12-rip-1]undo summary
[r12-rip-1]network 172.16.0.0 8
Area3
R7
[r7]ospf 1
[r7-ospf-1]area 3
[r7-ospf-1-area-0.0.0.3]network 172.16.49.1 0.0.0.0
[r7]int g 0/0/1
[r7-GigabitEthernet0/0/1]ospf timer hello 1----减少Hello时间
R8
[r8]ospf 1 router-id 8.8.8.8
[r8-ospf-1]area 3
[r8-ospf-1-area-0.0.0.3]network 0.0.0.0 255.255.255.255
[r8]int g 0/0/0
[r8-GigabitEthernet0/0/0]ospf timer hello 1---减少Hello时间
[r8]int g 0/0/1
[r8-GigabitEthernet0/0/1]ospf timer hello 1---减少Hello时间
R9(OSPF进程1)
[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.49.6 0.0.0.0
[r9]int g 0/0/0
[r9-GigabitEthernet0/0/0]ospf timer hello 1----减少Hello时间
Area4(R9上要做不同OSPF进程的配置)
R9(OSPF进程2)
[r9]ospf 2 router-id 9.9.9.9
[r9-ospf-2]area 4
[r9-ospf-2-area-0.0.0.4]network 172.16.64.0 0.15.255.255
[r9-GigabitEthernet0/0/0]int g 0/0/1
[r9-GigabitEthernet0/0/1]ospf timer hello 1---减少Hello时间
R10
[r10]ospf 1 router-id 10.10.10.10
[r10-ospf-1]area 4
[r10-ospf-1-area-0.0.0.4]network 0.0.0.0 255.255.255.255
[r10]int g 0/0/0
[r10-GigabitEthernet0/0/0]ospf timer hello 1----减少Hello时间
八.R9与R12做重发布配置
R9
[r9]ospf 1
[r9-ospf-1]import-route ospf 2
[r9-ospf-1]q
[r9]ospf 2
[r9-ospf-2]import-route ospf 1
R12
[r12]ospf 1
[r12-ospf-1]import-route rip 1
[r12-ospf-1]q
[r12]rip 1
[r12-rip-1]import-route ospf 1
九.优化
1.路由汇总(在边界设备R3,R6,R7,R9,R12上做)
R3
[r3]ospf 1
[r3-ospf-1]area 1
[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]abr-summary 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---域外路由汇总
2.特殊区域
Area1(Totally Stub)
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
[r3-ospf-1-area-0.0.0.1]stub no-summary
Area2(Totally 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
Area3(Totally NSSA)
R7
[r7]ospf 1
[r7-ospf-1]area 3
[r7-ospf-1-area-0.0.0.3]nssa no-summary
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
[r9]ospf 2
[r9-ospf-2]default-route-advertise----下发一个缺省路由,不然R10中既没有缺省路由,也没有其他路由
3.保障更新安全,设备间做认证
接口认证
R9
[r9]int g 0/0/1
[r9-GigabitEthernet0/0/1]ospf authentication-mode md5 1 cipher 123456
R10
[r10]int g 0/0/0
[r10-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456
区域认证
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
十.所有设备均可访问R4的环回(做NAT)
R3
[r3]acl 2000
[r3-acl-basic-2000]rule permit source 172.16.16.0 0.0.15.255
[r3-acl-basic-2000]q
[r3]int s 4/0/0
[r3-Serial4/0/0]nat outbound 2000
R6
[r6]acl 2000
[r6-acl-basic-2000]rule permit source 172.16.32.0 0.0.15.255
[r6-acl-basic-2000]rule permit source 172.16.128.0 0.0.254.255
[r6-acl-basic-2000]q
[r6]int s 4/0/0
[r6-Serial4/0/0]nat outbound 2000
R7
[r7]acl 2000
[r7-acl-basic-2000]rule permit source 172.16.48.0 0.0.15.255
[r7-acl-basic-2000]rule permit source 172.16.64.0 0.0.15.255
[r7-acl-basic-2000]q
[r7]int g 0/0/0
[r7-GigabitEthernet0/0/0]nat outbound 2000