OSPF 综合实验

一、实验需求

1,R4为ISP,其上只能配置IP地址;R4与其他所有直连设备间均使用公有IP

2,R3-R5/6/7为MGRE环境,R3为中心站点;

3,整个OSPF环境IP基于172.16.0.0/16划分;

4,所有设备均可访问R4的环回;

5,减少LSA的更新量,加快收敛,保障更新安全;

6,全网可达

二、实验目的

掌握OSPF的全部配置

三、实验思路

1、area 0的公网设备规划为43.0.0.0/24、45.0.0.0/24、46.0.0.0/24、47.0.0.0/24.

2、根据实验要求对172.16.0.0/16网段进行子网划分,方便之后的子网汇总,从而实现对路由条目的减少。

3、对R3、R5、R6、R7设备进行MGRE环境的配置,R3为中心站点(网络类型改为p2mp),并在这四个路由器上而配置到ISP的缺省路由,实现对边界路由器的私网互通。

4、对各个路由器进行配置OSPF协议并进行宣告,在宣告的时候可以汇总的路由信息可以汇总后一并宣告,让其各个路由器获取其他网段的路由拓扑信息,从而获取路由条目。

5、将域外路由通过重发布实现OSPF内可以互通。

6、对需要做特殊区域的区域做特殊区域的配置。(area 4使用多进程双向重发布 )

7、对边界路由器配置NAT协议从而实现可以对公网的访问

8、加快收敛改更新时间,保障更新安全,做认证(以区域1为例)

四、实验步骤

1,布置拓扑

2,IP地址规划

172.16.0.0/16

area 0

172.16.0.0/19

r3-r4

---34.0.0.0/24

r5-r4

---45.0.0.0/24

r6-r4

---46.0.0.0/24

r7-r4

---47.0.0.0/24

r5环回

---172.16.2.0/24

r6环回

---172.16.3.0/24

r7环回

---172.16.4.0/24

MGRE隧道

---172.16.1.0/24

area 1

172.16.32.0/19

主干

---172.16.33.0/24

r1环回

---172.16.34.0/24

r2环回

---172.16.35.0/24

r3环回

---172.16.36.0/24

area 2

172.16.64.0/19

r6-r11

---172.16.65.0/24

r11-r12

---172.16.66.0/24

r11环回

---172.16.67.0/24

area 3

172.16.96.0/19

r7-r8

---172.16.97.0/24

r8-r9

---172.16.98.0/24

r8环回

---172.16.99.0/24

area 4

172.16.128.0/19

r9-r10

---172.16.129.0/24

r8环回

---172.16.130.0/24

r8环回

---172.16.131.0/24

RIP

172.16.160.0/19

r12环回0

---172.16.160.0/20

r12环回1

---172.16.176.0/20

3、对area 0 的设备进行IP地址和环回地址以及缺省路由配置

R3配置
[Huawei]sys r3
[r3]int s 4/0/0
[r3-Serial4/0/0]ip address 34.0.0.1 24
[r3-Serial4/0/0]q
[r3]ip route-static 0.0.0.0 0 34.0.0.2
ISP配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys isp
[isp]int s 4/0/0
[isp-Serial4/0/0]ip address 34.0.0.2 24
[isp-Serial4/0/0]
Nov 10 2023 22:57:36-08:00 isp %%01IFNET/4/LINK_STATE(l)[0]:The line protocol PP
P IPCP on the interface Serial4/0/0 has entered the UP state. 
[isp-Serial4/0/0]int s 4/0/1
[isp-Serial4/0/1]ip address 45.0.0.2 24
[isp-Serial4/0/1]int s 3/0/0
[isp-Serial3/0/0]ip address 46.0.0.2 24
[isp-Serial3/0/0]int g 0/0/0
[isp-GigabitEthernet0/0/0]ip address 47.0.0.2 24
Nov 10 2023 22:58:54-08:00 isp %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
 on the interface GigabitEthernet0/0/0 has entered the UP state. 
[isp]int l 0	
[isp-LoopBack0]ip address 4.4.4.4 24
[isp-LoopBack0]q
[isp]q
<isp>save
R5配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r5
[r5]int s 4/0/0
[r5-Serial4/0/0]ip address 45.0.0.1 24
[r5-Serial4/0/0]
Nov 10 2023 23:01:48-08:00 r5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol PPP
 IPCP on the interface Serial4/0/0 has entered the UP state. 
[r5-Serial4/0/0]int l 0
[r5-LoopBack0]ip address 172.16.2.1 24
[r5-LoopBack0]q
[r5]ip route-static 0.0.0.0 0 45.0.0.2
R6配置
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r6
[r6]int s 4/0/0
[r6-Serial4/0/0]ip address 46.0.0.1 24
[r6-Serial4/0/0]
Nov 10 2023 23:06:18-08:00 r6 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol PPP
 IPCP on the interface Serial4/0/0 has entered the UP state. 
[r6-Serial4/0/0]int l 0
[r6-LoopBack0]ip address 172.16.3.1 24
[r6-LoopBack0]q
[r6]ip route-static 0.0.0.0 0 46.0.0.2
R7配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r7
[r7]int g 0/0/0
[r7-GigabitEthernet0/0/0]ip address 47.0.0.1 24
Nov 10 2023 23:10:36-08:00 r7 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r7-GigabitEthernet0/0/0]int l 0
[r7-LoopBack0]ip address 172.16.4.1 24 
[r7-LoopBack0]q
[r7]ip route-static 0.0.0.0 0 47.0.0.2

4、R3-R5/6/7为MGRE环境,R3为中心站点;

R3配置
[r3]int t 0/0/0
[r3-Tunnel0/0/0]ip address 172.16.1.1 24	
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r3-Tunnel0/0/0]source  34.0.0.1
Nov 10 2023 23:16:53-08:00 r3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface Tunnel0/0/0 has entered the UP state. 
[r3-Tunnel0/0/0]nhrp network-id 100
[r3-Tunnel0/0/0]nhrp entry multicast dynamic 
R5配置
[r5]int tun 0/0/0
[r5-Tunnel0/0/0]ip address 172.16.1.2 24
[r5-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r5-Tunnel0/0/0]source Serial 4/0/0
Nov 10 2023 23:19:12-08:00 r5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface Tunnel0/0/0 has entered the UP state. 	
[r5-Tunnel0/0/0]nhrp network-id 100
[r5-Tunnel0/0/0]nhrp entry 172.16.1.1 34.0.0.1 register 
R6配置
[r6]int t 0/0/0
[r6-Tunnel0/0/0]ip address 172.16.1.3 24
[r6-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r6-Tunnel0/0/0]source Serial 4/0/0
Nov 10 2023 23:22:26-08:00 r6 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface Tunnel0/0/0 has entered the UP state. 
[r6-Tunnel0/0/0]nhrp network-id 100
[r6-Tunnel0/0/0]nhrp entry 172.16.1.1 34.0.0.1 register 
R7配置
[r7-Tunnel0/0/0]display this
[V200R003C00]
#
interface Tunnel0/0/0
 ip address 172.16.1.4 255.255.255.0 
 tunnel-protocol gre p2mp
 source GigabitEthernet0/0/0
 nhrp network-id 100
 nhrp entry 172.16.1.1 34.0.0.1 register
#
return

5、配置area 1、area 2、area 3、area 4的IP地址以及环回

area 1

R1配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r1
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]ip address 172.168.33.1 24
Nov 10 2023 23:37:04-08:00 r1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r1-GigabitEthernet0/0/0]int l 0
[r1-LoopBack0]ip address 172.16.34.1 24
R2配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r2
[r2]int g 0/0/0
[r2-GigabitEthernet0/0/0]ip address 172.16.33.2 24
[r2]int l 0
[r2-LoopBack0]ip address 172.16.35.1 24
R3配置
[r3]int g 0/0/0
[r3-GigabitEthernet0/0/0]ip address 172.16.33.3 24
Nov 10 2023 23:49:15-08:00 r3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r3-GigabitEthernet0/0/0]int l 0
[r3-LoopBack0]ip address 172.16.36.1 24

area 2

R6配置
<r6>sys
Enter system view, return user view with Ctrl+Z.
[r6]int g 0/0/0
[r6-GigabitEthernet0/0/0]ip address 172.16.65.1 24
Nov 11 2023 12:51:13-08:00 r6 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
R11配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r11
[r11]int g 0/0/0
[r11-GigabitEthernet0/0/0]ip address 172.16.65.2 24
Nov 11 2023 12:52:30-08:00 r11 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
 on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r11-GigabitEthernet0/0/0]int g 0/0/1
[r11-GigabitEthernet0/0/1]ip address 172.16.66.1 24
Nov 11 2023 12:53:15-08:00 r11 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
 on the interface GigabitEthernet0/0/1 has entered the UP state. 
[r11-GigabitEthernet0/0/1]int l 0
[r11-LoopBack0]ip address 172.16.67.1 24
R12配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r12
[r12]int g 0/0/0
[r12-GigabitEthernet0/0/0]ip address 172.16.66.2 24
Nov 11 2023 12:56:28-08:00 r12 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
 on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r12-GigabitEthernet0/0/0]int l 0
[r12-LoopBack0]ip address 172.16.160.1 20
[r12-LoopBack0]int l 1
[r12-LoopBack1]ip address 172.16.176.1 20

area 3

R7配置
[r7]int g 0/0/1
[r7-GigabitEthernet0/0/1]ip address 172.16.97.1 24
R8配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r8
[r8]int g 0/0/0
[r8-GigabitEthernet0/0/0]ip address 172.16.97.2 24
Nov 11 2023 13:07:53-08:00 r8 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r8-GigabitEthernet0/0/0]int g 0/0/1
[r8-GigabitEthernet0/0/1]ip address 172.16.98.1 24
Nov 11 2023 13:08:20-08:00 r8 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[r8-GigabitEthernet0/0/1]int l 0
[r8-LoopBack0]ip address 172.16.99.1 24
R9配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r9
[r9]int g 0/0/0
[r9-GigabitEthernet0/0/0]ip address 172.16.98.2 24
Nov 11 2023 13:11:11-08:00 r9 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 

area 4

R9配置
[r9-GigabitEthernet0/0/0]int g 0/0/1
[r9-GigabitEthernet0/0/1]ip address 172.16.129.1 24
[r9-GigabitEthernet0/0/1]
Nov 11 2023 13:13:52-08:00 r9 %%01IFNET/4/LINK_STATE(l)[4]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[r9-GigabitEthernet0/0/1]int l 0
[r9-LoopBack0]ip address 172.16.130.1 24
R10配置
<Huawei>sys 
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r10
[r10]int g 0/0/0
[r10-GigabitEthernet0/0/0]ip address 172.16.129.2 24
Nov 11 2023 13:15:33-08:00 r10 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
 on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r10-GigabitEthernet0/0/0]int l 0
[r10-LoopBack0]ip address 172.16.131.2 24

6、启动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.0.0 0.0.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 172.16.0.0 0.0.255.255
R3配置
[r3]ospf 1 r	
[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.1.1 0.0.0.0
[r3-ospf-1-area-0.0.0.0]q
[r3-ospf-1]area 1
[r3-ospf-1-area-0.0.0.1]network 172.16.32.0 0.0.7.255
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
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.0 0.0.3.255
[r6-ospf-1-area-0.0.0.0]area 2
[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.0.0 0.0.7.255
[r7-ospf-1-area-0.0.0.0]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.0.0 0.0.255.255
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.98.2 0.0.0.0
[r9-ospf-1-area-0.0.0.3]area 4
[r9-ospf-1-area-0.0.0.4]network 172.16.128.0 0.0.3.255
R10配置
[r10]ospf 1 router-id 10.10.10.10
[r10-ospf-1]area 4	
[r10-ospf-1-area-0.0.0.4]network 172.16.0.0 0.0.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 172.16.0.0 0.0.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.66.2 0.0.0.0
[r12]rip 1
[r12-rip-1]v 2	
[r12-rip-1]network 172.16.0.0

7、发现area 0只有两个建邻,所以改变tunnel接口类型

R3配置
[r3]int Tunnel 0/0/0
[r3-Tunnel0/0/0]ospf network-type p2mp
R5配置
[r5]int tunnel 0/0/0
[r5-Tunnel0/0/0]ospf network-type p2mp
R6配置
[r6]int t 0/0/0
[r6-Tunnel0/0/0]ospf network-type p2mp
R7配置
[r7]int t 0/0/0
[r7-Tunnel0/0/0]ospf network-type p2mp

8、在r12进行重发布,从而让ospf可以学习到域外路由

[r12]ospf 1	
[r12-ospf-1]import-route rip 1

9、将AREA4更改为域外路由来减少路由信息,将AREA4改为域外路由,以此来做特殊区域来减少路由条目的数量因此在R9上重新开启一个OSPF进程,进行重发布。(不用虚链路和Tunnel隧道技术是因为要做特殊区域,因此这里要用双向重发布,但是在此拓扑当中只需要单项重发布,然后在写一条缺省路由即可。)

[r9]ospf 1
[r9-ospf-1]area 4
[r9-ospf-1-area-0.0.0.4]display this
[V200R003C00]
#
 area 0.0.0.4 
  network 172.16.128.0 0.0.3.255 
#
return
[r9-ospf-1-area-0.0.0.4]undo network 172.16.128.0 0.0.3.255
[r9-ospf-1-area-0.0.0.4]q
[r9-ospf-1]undo area 4
[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.128.0 0.0.3.255
[r9]ospf 1
[r9-ospf-1]import-route ospf 2
[r9]ospf 2
[r9-ospf-2]default-route-advertise

10、在ABR设备上做域间路由汇总,在ABSR设备上做域外路由汇总

R3配置
[r3]ospf 1
[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
[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
[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
[r9-ospf-1]asbr-summary 172.16.128.0 255.255.224.0
R12配置
[r12]ospf 1	
[r12-ospf-1]asbr-summary 172.16.160.0 255.255.224.0

11、将area1、area2、area3做特殊区域,实现路由条目减少

area 1
[r1]ospf 1
[r1-ospf-1]area 1
[r1-ospf-1-area-0.0.0.1]stub
[r2]ospf 1
[r2-ospf-1]area 1
[r2-ospf-1-area-0.0.0.1]stub
[r3]ospf 1
[r3-ospf-1]area 1
[r3-ospf-1-area-0.0.0.1]stub no-summary
area 2
[r6]ospf 1
[r6-ospf-1]area 2
[r6-ospf-1-area-0.0.0.2]nssa no-summary
[r11]ospf 1
[r11-ospf-1]area 2
[r11-ospf-1-area-0.0.0.2]nssa
[r12]ospf 1
[r12-ospf-1]area 2
[r12-ospf-1-area-0.0.0.2]nssa
area 3
[r7]ospf 1
[r7-ospf-1]area 3
[r7-ospf-1-area-0.0.0.3]nssa no-summary
[r8]ospf 1
[r8-ospf-1]area 3	
[r8-ospf-1-area-0.0.0.3]nssa 
[r9]ospf 1
[r9-ospf-1]area 3
[r9-ospf-1-area-0.0.0.3]nssa

12、汇总完成后对ABR和ASBR进行空接口防环

[r3]ip route-static 172.16.32.0 19 NULL 0
[r6]ip route-static 172.16.64.0 19 NULL 0
[r7]ip route-static 172.16.96.0 19 NULL 0
[r9]ip route-static 172.16.128.0 19 NULL 0
[r12]ip route-static 172.16.160.0 19 NULL 0

13、做nat让所有设备能访问公网环回

[r3]acl 2000
[r3-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[r3-acl-basic-2000]q
[r3]int s 4/0/0
[r3-Serial4/0/0]nat out	
[r3-Serial4/0/0]nat outbound 2000

[r5]acl 2000
[r5-acl-basic-2000]rul	
[r5-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[r5-acl-basic-2000]int s 4/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]q
[r6]int s 4/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]q
[r7]int g 0/0/0
[r7-GigabitEthernet0/0/0]nat o	
[r7-GigabitEthernet0/0/0]nat outbound 2000

14、保障更新安全,对area 1做认证

[r1]ospf 1
[r1-ospf-1]area 1
[r1-ospf-1-area-0.0.0.1]authentication-mode md5 ?
  INTEGER<1-255>  Key ID
  <cr>            Please press ENTER to execute command 
[r1-ospf-1-area-0.0.0.1]authentication-mode md5 1 c	
[r1-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 123456
[r2]ospf 1
[r2-ospf-1]area 1
[r2-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 123456
[r3]ospf 1
[r3-ospf-1]area 1
[r3-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 123456

15、加快收敛,改hello时间、死亡时间。

[r3]int t 0/0/0	
[r3-Tunnel0/0/0]ospf timer hello 10

[r5]int t 0/0/0
[r5-Tunnel0/0/0]ospf timer hello 10

[r6]int t 0/0/0
[r6-Tunnel0/0/0]ospf timer hello 10

[r7]int t 0/0/0
[r7-Tunnel0/0/0]ospf timer hello 10

五、实验结果

1,IP地址

2,路由表

其他区域的路由表都没有问题,就是区域1的路由表有问题,R1没有ospf路由,等我找出问题再更新 

破案了,兄弟们,是ensp软件bug

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值