OSPF综合实验(一)
一、实验拓扑图
二、实验要求
1、R4为ISP,其上只配置IP地址;R4与其他所直连设备间均使用公有IP;
2、R3-R5、R6、R7为MGRE环境,R3为中心站点;
3、整个OSPF环境IP基于172.16.0.0/16划分;除了R12有两个环回,其他路由器均有一个环回IP
4、所有设备均可访问R4的环回;
5、减少LSA的更新量,加快收敛,保障更新安全;
6、全网可达;
三、实验思路
1、IP 地址规划:基于 172.16.0.0/16 为各设备接口、环回分配地址,区分公有 IP和私有 IP 。
(1)area0
总地址:172.16.0.0/19
用户地址:
172.16.0.0/24---P2P
172.16.1.0/24---MA
172.16.2.0/24---R4(环回)
172.16.3.0/24---R5(环回)
172.16.4.0/24---R6(环回)
172.16.5.0/24---R7(环回)
172.16.6.0/24---隧道
(2)area1
总地址:172.16.32.0/19
用户地址:
172.16.32.0/24---P2P
172.16.33.0/24---MA
172.16.34.0/24---R1(环回)
172.16.35.0/24---R2(环回)
172.16.36.0/24---R3(环回)
(3)area2
总地址:172.16.64.0/19
用户地址:
172.16.64.0/24---P2P
172.16.65.0/24---MA
172.16.65.0/30
172.16.65.4/30
172.16.66.0/24---R11(环回)
(4)area3
总地址:172.16.96.0/19
用户地址:
172.16.96.0/24---P2P
172.16.97.0/24---MA
172.16.97.0/30
172.16.97.0/30
172.16.98.0/24---R8(环回)
(5)area4
总地址:172.16.128.0/19
用户地址:
172.16.128.0/24---P2P
172.16.129.0/24---MA
172.16.129.0/30
172.16.130.0/24---R9(环回)
172.16.131.0/24---R10(环回)
(6)RIP:
地址:172.16.160.0/19
L0:172.16.160.0/24
L1:172.16.161.0/24
2、OSPF 配置:
按区域(area 0 - 4 )部署 OSPF ,设置区域属性(如 Stub、NSSA 等)减少 LSA ;配置 MGRE 环境(R3 为中心),实现动态组播或点到多点,优化更新;配置认证保障安全 。
3、RIP 与 OSPF 交互:
在 R12 配置 RIP ,并做路由重分发,让 OSPF 与 RIP 网络互通 。
4、连通性保障:
检查接口 IP、OSPF 邻居、路由表,测试设备间(含访问 R4 环回)连通性,排查解决问题 。
四、实验步骤
1、配置IP地址(R1---R12)
R1:
[Huawei]sy R1
[R1]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip address 172.16.33.1 24
[R1-GigabitEthernet0/0/0]int l0
[R1-LoopBack0]ip address 172.16.34.1 24
R2:
[Huawei]sy R2
[R2]int g 0/0/0
[R2-GigabitEthernet0/0/0]ip address 172.16.33.2 24
[R2-GigabitEthernet0/0/0]int l0
[R2-LoopBack0]ip address 172.16.35.2 24
R3:
[Huawei]sy R3
[R3]int g 0/0/0
[R3-GigabitEthernet0/0/0]ip address 172.16.33.3 24
[R3-GigabitEthernet0/0/0]int l0
[R3-LoopBack0]ip address 172.16.36.3 24
[R3-LoopBack0]int s 4/0/0
[R3-Serial4/0/0]ip address 34.0.0.3 24
R4:
<Huawei>sy
[Huawei]sy R4
[R4]int s 4/0/0
[R4-Serial4/0/0]ip address 34.0.0.4 24
[R4-Serial4/0/0]int s 3/0/1
[R4-Serial3/0/1]ip address 45.0.0.4 24
[R4-Serial3/0/1]int s 3/0/0
[R4-Serial3/0/0]ip address 46.0.0.4 24
[R4-Serial3/0/0]int g 0/0/0
[R4-GigabitEthernet0/0/0]ip address 47.0.0.4 24
[R4-GigabitEthernet0/0/0]int l0
[R4-LoopBack0]ip address 172.16.2.4 24
R5:
<Huawei>sy
[Huawei]sy R5
[R5]int s 4/0/0
[R5-Serial4/0/0]ip address 45.0.0.5 24
[R5-Serial4/0/0]int l0
[R5-LoopBack0]ip ad 172.16.3.5 24
R6:
<Huawei>sy
[Huawei]sy R6
[R6]int s 4/0/0
[R6-Serial4/0/0]ip address 46.0.0.6 24
[R6-Serial4/0/0]int l0
[R6-LoopBack0]ip address 172.16.4.6 24
[R6-LoopBack0]int g 0/0/0
[R6]int g 0/0/0
[R6-GigabitEthernet0/0/0]ip address 172.16.65.1 30
R7:
<Huawei>sy
[Huawei]sy R7
[R7]int g 0/0/0
[R7-GigabitEthernet0/0/0]ip address 47.0.0.7 24
[R7-GigabitEthernet0/0/0]int l0
[R7-LoopBack0]ip address 172.16.5.7 24
[R7-LoopBack0]int g 0/0/1
[R7-GigabitEthernet0/0/1]ip address 172.16.97.1 30
R8:
<Huawei>sy
[Huawei]sy R8
[R8]int g 0/0/0
[R8-GigabitEthernet0/0/0]ip address 172.16.97.2 30
[R8-GigabitEthernet0/0/0]int g 0/0/1
[R8-GigabitEthernet0/0/1]ip address 172.16.97.5 30
[R8-GigabitEthernet0/0/1]int l0
[R8-LoopBack0]ip address 172.16.98.8 24
R9:
<Huawei>sy
[Huawei]sy R9
[R9]int g 0/0/0
[R9-GigabitEthernet0/0/0]ip address 172.16.97.6 30
[R9-GigabitEthernet0/0/0]int g 0/0/1
[R9-GigabitEthernet0/0/1]ip address 172.16.129.1 30
[R9-GigabitEthernet0/0/1]int l0
[R9-LoopBack0]ip address 172.16.130.9 24
R10:
<Huawei>sy
[Huawei]sy R10
[R10]int g 0/0/0
[R10-GigabitEthernet0/0/0]ip address 172.16.129.2 30
[R10-GigabitEthernet0/0/0]int l0
[R10-LoopBack0]ip address 172.16.131.10 24
R11:
[R11]sy R11
[R11]int g 0/0/0
[R11-GigabitEthernet0/0/0]ip address 172.16.65.2 30
[R11-GigabitEthernet0/0/0]int g 0/0/1
[R11-GigabitEthernet0/0/1]ip address 172.16.65.5 30
[R11-GigabitEthernet0/0/1]int l0
[R11-LoopBack0]ip address 172.16.66.11 24
R12:
<Huawei>sy
[Huawei]sy R12
[R12]int g 0/0/0
[R12-GigabitEthernet0/0/0]ip address 172.16.65.6 30
[R12-GigabitEthernet0/0/0]int l 0
[R12-LoopBack0]ip address 172.16.160.12 24
[R12-LoopBack0]int l 1
[R12-LoopBack1]ip address 172.16.161.12 24
2、公网通----缺省路由(R3 R5 R6 R7)
R3:
[R3]ip route-static 0.0.0.0 0 34.0.0.4R5:
[R5]ip route-static 0.0.0.0 0 45.0.0.4R6:
[R6]ip route-static 0.0.0.0 0 46.0.0.4R7:
[R7]ip route-static 0.0.0.0 0 47.0.0.4
3、各个内网通,重发布--邻居表-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 172.16.33.1 0.0.0.0
[R1-ospf-1-area-0.0.0.1]network 172.16.34.1 0.0.0.0
R2:
[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.33.2 0.0.0.0
[R2-ospf-1-area-0.0.0.1]network 172.16.35.2 0.0.0.0
R3:
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]network 172.16.33.3 0.0.0.0
[R3-ospf-1-area-0.0.0.1]network 172.168.36.3 0.0.0.0
R5:
[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1]area 0
[R5-ospf-1-area-0.0.0.0]net 172.16.3.5 0.0.0.0
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.4.6 0.0.0.0
[R6-ospf-1-area-0.0.0.2]network 172.16.65.1 0.0.0.0
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.97.1 0.0.0.0
[R7-ospf-1]area 3
[R7-ospf-1-area-0.0.0.3]network 172.16.97.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.97.2 0.0.0.0
[R8-ospf-1-area-0.0.0.3]network 172.16.97.5 0.0.0.0
[R8-ospf-1-area-0.0.0.3]network 172.16.98.8 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]network 172.16.97.6 0.0.0.0
[R9]ospf 2 router-id 9.9.9.9
[R9-ospf-2]area 4
[R9-ospf-2-area-0.0.0.4]net 172.16.129.1 0.0.0.0
[R9-ospf-2-area-0.0.0.4]net 172.16.130.9 0.0.0.0
R10:
[R10]ospf 2 router-id 10.10.10.10
[R10-ospf-2]area 4
[R10-ospf-2-area-0.0.0.4]net 172.16.129.2 0.0.0.0
[R10-ospf-2-area-0.0.0.4]net 172.16.131.10 0.0.0.0
R11:
[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.2 0.0.0.0
[R11-ospf-1-area-0.0.0.2]network 172.16.65.5 0.0.0.0
[R11-ospf-1-area-0.0.0.2]network 172.16.66.11 0.0.0.0
R12:
[R12]ospf 1 router-id 12.12.12.12
[R12-ospf-1]
[R12-ospf-1]area 2
[R12-ospf-1-area-0.0.0.2]network 172.16.65.6 0.0.0.0
[R12]rip 1
[R12-rip-1]version 2
[R12-rip-1]undo summary
[R12-rip-1]network 172.16.0.0
[R12-ospf-1]import-route rip 1
4、配置MGRE VPN
R3:
[R3]int Tunnel 0/0/0
[R3-Tunnel0/0/0]ip address 172.16.6.3 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
[R3-Tunnel0/0/0]nhrp entry multicast dynamic
[R3-ospf-1-area-0.0.0.0]net 172.16.6.3 0.0.0.0
R5:
[R5]int t 0/0/0
[R5-Tunnel0/0/0]ip address 172.16.6.5 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 172.16.6.3 34.0.0.3 register
[R5-ospf-1-area-0.0.0.0]net 172.16.6.5 0.0.0.0
R6:
[R6]int t 0/0/0
[R6-Tunnel0/0/0]ip address 172.16.6.6 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 172.16.6.3 34.0.0.3 register
[R6-ospf-1-area-0.0.0.0]net 172.16.6.6 0.0.0.0
R7:
[R7]int t 0/0/0
[R7-Tunnel0/0/0]ip address 172.16.6.7 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 172.16.6.3 34.0.0.3 register
[R7-ospf-1-area-0.0.0.0]net 172.16.6.7 0.0.0.0
5、NAT---R3、R5、R6、R7
R3:[R3-Tunnel0/0/0]ospf network-type broadcastR5:[R5-Tunnel0/0/0]ospf network-type broadcast
[R5-Tunnel0/0/0]ospf dr
[R5-Tunnel0/0/0]ospf dr-priority 0R6:[R6-Tunnel0/0/0]ospf network-type broadcast
[R6-Tunnel0/0/0]ospf dr-priority 0R7:[R7-Tunnel0/0/0]ospf network-type broadcast
[R7-Tunnel0/0/0]ospf dr-priority 0
6、做区域间的路由聚合,防环--精简area 0的LSDB、路由表
R3:[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 2000R5:[R5]acl 2000
[R5-acl-basic-2000]rule 5 permit source 172.16.0.0 0.0.255.255
[R5-acl-basic-2000]q
[R5]int s 4/0/0
[R5-Serial4/0/0]nat outbound 2000R6:[R6]acl 2000
[R6-acl-basic-2000]rule 5 permit source 172.16.0.0 0.0.255.255
[R6]int s 4/0/0
[R6-Serial4/0/0]nat out 2000R7:[R7]acl 2000
[R7-acl-basic-2000]rule 5 permit source 172.16.0.0 0.0.255.255
[R7-acl-basic-2000]int g 0/0/0
[R7-GigabitEthernet0/0/0]nat outbound 2000
7、做域外路由聚合,防环--精简area 0的LSDB、路由表
R3:
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]abr-summary 172.16.32.0 255.255.224.0
R6:
[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]area 2
[R6-ospf-1-area-0.0.0.2]abr-summary 172.16.64.0 255.255.224.0
R7:
[R7]ospf 1 router-id 7.7.7.7
[R7-ospf-1]area 3
[R7-ospf-1-area-0.0.0.3]abr-summary 172.16.96.0 255.255.224.0
R9:
[R9]ospf 1 router-id 9.9.9.9
[R9-ospf-1]asbr-summary 172.16.128.0 255.255.224.0
R12:
[R12]ospf 1 router-id 12.12.12.12
[R12-ospf-1]asbr-summary 172.16.160.0 255.255.224.0
8、做特殊区域,精简除了AREA 0外的其他ospf区域的LSDB\路由表
(1)Area1:
R1:
[R1-ospf-1-area-0.0.0.1]stub no-summaryR2:
[R2-ospf-1-area-0.0.0.1]stub no-summaryR3:
[R3-ospf-1-area-0.0.0.1]stub no-summary
(2)Area2:
R6:
[R6-ospf-1-area-0.0.0.2]nssa no-summaryR11:
[R11-ospf-1-area-0.0.0.2]nssa no-summaryR12:
[R12-ospf-1-area-0.0.0.2]nss no-summary
(3)Area3:
R7:
[R7-ospf-1-area-0.0.0.3]nssa no-summaryR8:
[R7-ospf-1-area-0.0.0.3]nssa no-summaryR9:
[R9-ospf-1-area-0.0.0.3]nssa no-summary
9、加快收敛---更改HELLO时间
R3:
[R3]int Tunnel 0/0/0
[R3-Tunnel0/0/0]ospf timer hello 10
[R3-Tunnel0/0/0]R5:
[R5]int Tunnel 0/0/0
[R5-Tunnel0/0/0]ospf timer hello 10
[R5-Tunnel0/0/0]R6:
[R6]int Tunnel 0/0/0
[R6-Tunnel0/0/0]ospf timer hello 10
[R6-Tunnel0/0/0]R7:
[R7]int Tunnel 0/0/0
[R7-Tunnel0/0/0]ospf timer hello 10
10、区域认证、接口
R1:
[R1-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 123456R2:
[R2-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 123456R3:
[R3-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 123456
[R3-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 123456R5:
[R5-ospf-1-area-0.0.0.0] authentication-mode md5 1 cipher 123456R6:
[R6-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 123456
[R6-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher 123456R7:
[R7-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 123456
[R7-ospf-1-area-0.0.0.3]authentication-mode md5 1 cipher 123456R8:
[R8-ospf-1-area-0.0.0.3]authentication-mode md5 1 cipher 123456R9:
[R9-ospf-1-area-0.0.0.3]authentication-mode md5 1 cipher 123456
[R9-ospf-2-area-0.0.0.4]authentication-mode md5 1 cipher 123456R10:
[R10-ospf-2-area-0.0.0.4]authentication-mode md5 1 cipher 123456R11:
[R11-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher 123456R12:
[R12-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher 123456