OSPF综合实验

一、实验拓扑及要求

二、过程

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

1、配置IP地址

(1)R1
[R1]int g 0/0/0  
[R1-GigabitEthernet0/0/0]ip address 172.16.17.1 24
[R1-GigabitEthernet0/0/0]
Jul 16 2024 21:47:18-08:00 R1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R1-GigabitEthernet0/0/0]int l0
[R1-LoopBack0]ip address 172.16.17.1 24
(2)R2
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip ad 172.16.16.2 29
Jul 16 2024 21:48:21-08:00 r2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r2-GigabitEthernet0/0/0]int l0
[r2-LoopBack0]ip ad 172.16.18.1 24
(3)R3
[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]ip ad 172.16.16.3 29
Jul 16 2024 21:49:56-08:00 r3 %%01IFNET/4/LINK_STATE(l)[6]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r3-GigabitEthernet0/0/0]int l0
[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]ip ad 172.16.16.3 29
Jul 16 2024 21:51:43-08:00 r3 %%01IFNET/4/LINK_STATE(l)[8]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r3-GigabitEthernet0/0/0]int l0
[r3-LoopBack0]ip ad 172.16.19.1 24
[r3-LoopBack0]int s4/0/0
[r3-Serial4/0/0]ip ad 34.0.0.3 24
(4)R4
[r4]int g0/0/0
[r4-GigabitEthernet0/0/0]ip ad 47.0.0.4 24
Jul 16 2024 21:53:49-08:00 r4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r4-GigabitEthernet0/0/0]int s4/0/0
[r4-Serial4/0/0]ip ad 34.0.0.4 24
[r4-Serial4/0/0]
Jul 16 2024 21:54:22-08:00 r4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol PPP
 IPCP on the interface Serial4/0/0 has entered the UP state. 
[r4-Serial4/0/0]int s4/0/1
[r4-Serial4/0/1]ip ad 45.0.0.4 24
[r4-Serial4/0/1]int s3/0/0
[r4-Serial3/0/0]ip ad 46.0.0.4 24
[r4-Serial3/0/0]int l0
[r4-LoopBack0]ip ad 4.4.4.4 32
 (5)R5
[r5]int s4/0/0
[r5-Serial4/0/0]ip ad 45.0.0.5 24
Jul 16 2024 21:56:33-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 l0
[r5-LoopBack0]ip ad 172.16.1.1 24
(6)R6
[r6]int s4/0/0
[r6-Serial4/0/0]ip ad 46.0.0.6 24
[r6-Serial4/0/0]
Jul 16 2024 21:57:24-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 g0/0/0
[r6-GigabitEthernet0/0/0]ip ad 172.16.33.1 30
[r6-GigabitEthernet0/0/0]
Jul 16 2024 21:57:43-08:00 r6 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r6-GigabitEthernet0/0/0]int l0
[r6-LoopBack0]ip ad 172.16.2.1 24
(7)R7
[r7]int g0/0/0
[r7-GigabitEthernet0/0/0]int l0
[r7-LoopBack0]ip ad 172.16.3.1 24
[r7-LoopBack0]int g0/0/1
[r7-GigabitEthernet0/0/1]ip ad 172.16.49.1 30
Jul 16 2024 21:59:50-08:00 r7 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
(8)R8
[r8]int g0/0/0
[r8-GigabitEthernet0/0/0]ip ad 172.16.49.2 30
Jul 16 2024 22:00:57-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 g0/0/1
[r8-GigabitEthernet0/0/1]ip ad 172.16.49.5 30
Jul 16 2024 22:01:26-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 l0
[r8-LoopBack0]ip ad 172.16.48.1 24
[r8-LoopBack0]q
(9)R9
[r9]int g0/0/0
[r9-GigabitEthernet0/0/0]ip ad 172.16.49.6 30
Jul 16 2024 22:03:20-08:00 r9 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r9-GigabitEthernet0/0/0]int l0
[r9-LoopBack0]ip ad 172.16.64.1 24
[r9-LoopBack0]int g0/0/1
[r9-GigabitEthernet0/0/1]ip ad 172.16.66.1 30
[r9-GigabitEthernet0/0/1]
Jul 16 2024 22:04:02-08:00 r9 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
(10)R10
[R10]int g 0/0/0
[R10-GigabitEthernet0/0/0]ip ad 172.16.66.2 30
[R10-GigabitEthernet0/0/0]int l0
[R10-LoopBack0]ip ad 172.16.65.1 24
(11)R11
[r11]int g0/0/0
[r11-GigabitEthernet0/0/0]ip ad 172.16.33.2 30
[r11-GigabitEthernet0/0/0]
Jul 16 2024 22:06:10-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 g0/0/1
[r11-GigabitEthernet0/0/1]ip ad 172.16.33.5 30
Jul 16 2024 22:06:31-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 l0
[r11-LoopBack0]ip ad 172.16.32.1 24
(12)R12
[r12]int g0/0/0
[r12-GigabitEthernet0/0/0]
[r12-GigabitEthernet0/0/0]ip ad 172.16.33.6 30
[r12-GigabitEthernet0/0/0]
Jul 16 2024 22:07:41-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 l0
[r12-LoopBack0]ip ad 172.16.128.1 18
[r12-LoopBack0]int l1
[r12-LoopBack1]ip ad 172.16.192.1 18

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

1、配置R3/5/6/7的缺省路由,全网可通

(1)R3
[r3]int t 0/0/0
[r3-Tunnel0/0/0]ip ad 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-Tunnel0/0/0]ip route-static 0.0.0.0 34.0.0.4
(2)R5
[r5]int t 0/0/0
[r5-Tunnel0/0/0]ip ad 172.16.0.2 24
[r5-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r5-Tunnel0/0/0]source Serial 4/0/0
Jul 16 2024 22:15: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 entry 172.16.0.1 34.0.0.3 register 
[r5-Tunnel0/0/0]q
[r5]ip route-static 0.0.0.0 0 45.0.0.4
(3)R6,R7
[r6]ip route-static 0.0.0.0 0 46.0.0.2
[r7]ip route-static 0.0.0.0 0 47.0.0.2

 2、配MGRE

(1)R3
[r3]int Tunnel 0/0/0
[r3-Tunnel0/0/0]ip address 172.16.1.1 29
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r3-Tunnel0/0/0]source 34.0.0.1
[r3-Tunnel0/0/0]nhrp network-id 100
[r3-Tunnel0/0/0]nhrp entry multicast dynamic 
[r3-Tunnel0/0/0]ospf network-type p2mp
(2)R5
[r5]int Tunnel 0/0/0
[r5-Tunnel0/0/0]ip address 172.16.1.2 29
[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.1.1 34.0.0.1 register 
[r5-Tunnel0/0/0]ospf network-type p2mp
(3)R6
[r6]int Tunnel 0/0/0
[r6-Tunnel0/0/0]ip address 172.16.1.3 29
[r6-Tunnel0/0/0]tunnel-protocol gre p2mp
[r6-Tunnel0/0/0]nhrp network-id 100
[r6-Tunnel0/0/0]source Serial 4/0/0
[r6-Tunnel0/0/0]nhrp entry 172.16.1.1 34.0.0.1 register 
[r6-Tunnel0/0/0]ospf network-type p2mp
(4)R7
[r7]int Tunnel 0/0/0
[r7-Tunnel0/0/0]ip address 172.16.1.4 29
[r7-Tunnel0/0/0]tunnel-protocol gre p2mp
[r7-Tunnel0/0/0]nhrp network-id 100
[r7-Tunnel0/0/0]source GigabitEthernet 0/0/0
[r7-Tunnel0/0/0]nhrp entry 172.16.1.1 34.0.0.1 register 
[r7-Tunnel0/0/0]ospf network-type p2mp

(三)整个OSPF环境IP基于172.16.0.0/16划分;

1、area 0

(1)R3
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]net    
[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 t0/0/0
[r3-Tunnel0/0/0]ospf network-type p2mp
[r3-Tunnel0/0/0]ospf timer hello 1
(2)R5
[r5-Tunnel0/0/0]ospf network-type p2mp
[r5-Tunnel0/0/0]o    
[r5-Tunnel0/0/0]os    
[r5-Tunnel0/0/0]ospf t    
[r5-Tunnel0/0/0]ospf net    
[r5-Tunnel0/0/0]ospf network-type p    
[r5-Tunnel0/0/0]ospf ti    
[r5-Tunnel0/0/0]ospf timer h    
[r5-Tunnel0/0/0]ospf timer hello 1
(3)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 t0/0/0
[r6-Tunnel0/0/0]ospf network-type p2mp
[r6-Tunnel0/0/0]ospf timer hello 1
(4)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 t0/0/0
[r7-Tunnel0/0/0]ospf network-type p2mp
[r7-Tunnel0/0/0]ospf timer hello 1

2、area 1的

(1)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-ospf-1-area-0.0.0.1]int g0/0/0
[R1-GigabitEthernet0/0/0]ospf timer hello 1
(2)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-ospf-1-area-0.0.0.1]int g0/0/0
[r2-GigabitEthernet0/0/0]ospf timer hello 1
(3)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-ospf-1-area-0.0.0.1]int g0/0/0
[r3-GigabitEthernet0/0/0]ospf timer hello 1

3、area 2的

(1)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-ospf-1-area-0.0.0.2]int g0/0/0
[r6-GigabitEthernet0/0/0]ospf timer hello 1
(2)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-ospf-1-area-0.0.0.2]int g0/0/0
[r11-GigabitEthernet0/0/0]ospf timer hello 1
[r11-GigabitEthernet0/0/0]int g0/0/1
[r11-GigabitEthernet0/0/1]ospf timer hello 1
(3)R12
[r12]ospf 2 router-id 12.12.12.12
[r12-ospf-2]area 2
[r12-ospf-2-area-0.0.0.2]network 172.16.33.6 0.0.0.0
[r12-ospf-2-area-0.0.0.2]int g0/0/0
[r12-GigabitEthernet0/0/0]ospf timer hello 1

4、area 3的

(1)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-ospf-1-area-0.0.0.3]int g0/0/1
[r7-GigabitEthernet0/0/1]ospf timer hello 1
(2)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-ospf-1-area-0.0.0.3]int g0/0/0
[r8-GigabitEthernet0/0/0]ospf timer hello 1

[r8-GigabitEthernet0/0/0]int g0/0/1
[r8-GigabitEthernet0/0/1]ospf timer hello 1[r8-GigabitEthernet0/0/0]int g0/0/1
[r8-GigabitEthernet0/0/1]ospf timer hello 1

5、area 4的

(1)R9
[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-ospf-2-area-0.0.0.4]int g0/0/0
[r9-GigabitEthernet0/0/0]ospf timer hello 1
(2)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-ospf-1-area-0.0.0.4]int g0/0/0
[R10-GigabitEthernet0/0/0]ospf timer hello 1

6、R9/R12重发布

R9
[r9]ospf 1
[r9-ospf-1]import-route rip 1
[r9-ospf-1]q
[r9]rip 1
[r9-rip-1]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

 7、OSPF的路由汇总

(1)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
(2)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
(3)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
(4)R9
[r9]ospf 1
[r9-ospf-1]asbr-summary 172.16.64.0 255.255.240.0
(5)R12
[r12]ospf 1
[r12-ospf-1]asbr-summary 172.16.128.0 255.255.128.0

为area 1、area 2、area 3做特殊区域

1、area 1的完全末梢区域

R1
[r1]ospf 1
[r1-ospf-1]a 1
[r1-ospf-1-area-0.0.0.1]stub

R2
[r2]ospf 1
[r2-ospf-1]a 1
[r2-ospf-1-area-0.0.0.1]stub

R3
[r3]ospf 1
[r3-ospf-1]a 1
[r3-ospf-1-area-0.0.0.1]stub no-summary 

2、area 2 的非完全末梢区域

R6
[r6]ospf 1
[r6-ospf-1]a 2
[r6-ospf-1-area-0.0.0.2]nssa no-summary

R11
[r11]ospf 1
[r11-ospf-1]a 2
[r11-ospf-1-area-0.0.0.2]nssa

R12
[r12]ospf 1
[r12-ospf-1]a 2
[r12-ospf-1-area-0.0.0.2]nssa

3、area 3的非完全末梢区域

R7
[r7]ospf 1
[r7-ospf-1]a 3
[r7-ospf-1-area-0.0.0.3]nssa no-summary

R8
[r8]ospf 1
[r8-ospf-1]a 3
[r8-ospf-1-area-0.0.0.3]nssa

R9
[r9]ospf 1 
[r9-ospf-1]a 3
[r9-ospf-1-area-0.0.0.3]nssa
[r9-ospf-1-area-0.0.0.3]ospf 2
[r9-ospf-2]default-route-advertise

配置NAT

R3
[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 Serial 4/0/0
[r3-Serial4/0/0]nat outbound 2000

R6
[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 Serial 4/0/0
[r6-Serial4/0/0]nat outbound 2000

R7
[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 GigabitEthernet 0/0/0
[r7-GigabitEthernet0/0/0]nat outbound 2000

加快收敛

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

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

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

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

OSPF认证

R1
[r1-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 123456 

R2
[r2-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 123456

R3
[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 123456

R5
[r5-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 123456

R6
[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 123456

R7
[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 123456

R8
[r8-ospf-1-area-0.0.0.3]authentication-mode md5 1 cipher 123456

R9
[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 123456

R10
[r10-ospf-1-area-0.0.0.4]authentication-mode md5 1 cipher 123456

R11
[r11-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher 123456

R12
[r12-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456

全网通

 

 

OSPF(开放最短路径优先)是一种用于路由的动态路由协议,它是根据路由器之间的链路状态来计算最短路径的。 在一个OSPF综合实验案例中,可以模拟一个复杂的网络拓扑,包括多个路由器和连接它们的链路。假设有5个路由器A、B、C、D和E,它们之间通过不同的链路相连。 首先,需要配置每个路由器上的OSPF进程,并为它们分配一个路由器ID。然后,在每个链路上配置正确的IP地址和子网掩码。接下来,通过在OSPF进程中启用不同的区域,将路由器分成不同的区域。 然后,需要配置每个路由器之间的OSPF邻居关系。这可以通过指定邻居的路由器ID和链路上的IP地址来完成。路由器之间的邻居关系建立后,它们将开始交换链路状态信息(LSA)。 每个路由器将根据接收到的LSA计算自己的链路状态数据库(LSDB)。然后,通过运行Dijkstra算法,每个路由器将计算出到达其他路由器的最短路径。最后,每个路由器将根据最短路径选择相应的接口进行路由。 在这个实验案例中,还可以模拟链路故障的情况,观察OSPF的快速收敛性。当某个链路出现故障时,路由器将发送通告信息给邻居,通知它们链路状态已经改变。邻居将更新自己的LSDB,并重新计算最短路径。 通过这个综合实验案例,可以深入了解OSPF协议的工作原理和功能。同时,还可以通过观察实验结果,了解OSPF网络中的优势和效率。这些知识和经验将帮助网络工程师更好地设计、优化和故障排除复杂的网络拓扑。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值