OSPF的综合实验

一、实验拓扑

c9abff77d95b49879380ab12c8836308.jpg

二、实验要求

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地址

(1)先按区域划分大网段

172.16.0.0/19——area0

172.16.32.0/19——area1

172.16.64.0/19——area2

172.16.96.0/19——area3

172.16.128.0/19——area4

172.16.160.0/19——RIP

172.16.192.0/19

172.16.224.0/19

(2)划分area0小网段

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——隧道

(3)划分area1小网段

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环回

(4)划分area2小网段

172.16.64.0/24——P2P

172.16.65.0/24——MA

172.16.65.0/30——R6-R11

172.16.65.4/30——R11-R12

172.16.66.0/24——R11环回

(5)划分area3小网段

172.16.96.0/24——P2P

172.16.97.0/24——MA

172.16.97.0/30——R7-R8

172.16.97.4/20——R8-R9

172.16.98.0/24——R8环回

(6)划分area4小网段

172.16.128.0/24——P2P

172.16.129.0/24——MA

172.16.129.0/30——R9-R10

172.16.130.0/24——R9环回

172.16.131.0/24——R10环回

(7)划分RIP小网段

172.16.160.0/24——L0

172.16.161.0/24——L1

2.配置IP地址

区域1:

[R1]int g0/0/0

[R1-GigabitEthernet0/0/0]ip add 172.16.33.1 24

[R1-GigabitEthernet0/0/0]int l0

[R1-LoopBack0]ip add 172.16.34.1 24

[R1-LoopBack0]quit

[R1]dis ip int br

[R2]int g0/0/0

[R2-GigabitEthernet0/0/0]ip add 172.16.33.2 24

[R2-LoopBack0]ip add 172.16.35.2 24

[R2-LoopBack0]quit

[R2]dis ip int b

[R3]int g0/0/0

[R3-GigabitEthernet0/0/0]ip add 172.16.33.3 24

[R3-GigabitEthernet0/0/0]int l0

[R3-LoopBack0]ip add 172.16.36.3 24

[R3-LoopBack0]quit

[R3]dis ip int b


区域0:

[R3]int s4/0/0

[R3-Serial4/0/0]ip add 43.0.0.3 24

[R3-Serial4/0/0]quit

[R3]dis ip int b

[R5]int s 4/0/0

[R5-Serial4/0/0]ip add 45.0.0.5 24

[R5-Serial4/0/0]quit

[R5]int l0 

[R5-LoopBack0]ip add 172.16.3.5 24

[R5-LoopBack0]quit

[R5]dis ip int b

[R6]int s 4/0/0

[R6-Serial4/0/0]ip add 46.0.0.6 24

[R6-Serial4/0/0]quit

[R6]int l0

[R6-LoopBack0]ip add 172.16.4.6 24

[R6-LoopBack0]quit

[R6]dis ip int b

[R7]int g0/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.5.7 24

[R7-LoopBack0]quit

[R7]dis ip int b

[R4]int s 4/0/0

[R4-Serial4/0/0]ip add 43.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 g0/0/0

[R4-GigabitEthernet0/0/0]ip add 47.0.0.4 24

[R4-GigabitEthernet0/0/0]int l0 

[R4-LoopBack0]ip add 172.16.2.4 24

[R4-LoopBack0]quit

[R4]dis ip int b


区域2:

[R6]int g0/0/0

[R6-GigabitEthernet0/0/0]ip add 172.16.65.1 30

[R6-GigabitEthernet0/0/0]quit

[R6]dis ip int b

[R11]int g0/0/0

[R11-GigabitEthernet0/0/0]ip add 172.16.65.2 30

[R11-GigabitEthernet0/0/0]int g0/0/1

[R11-GigabitEthernet0/0/1]ip add 172.16.65.5 30

[R11-GigabitEthernet0/0/1]int l0

[R11-LoopBack0]ip add 172.16.66.11 24

[R11-LoopBack0]quit

[R11]dis ip int b

[R12]int g0/0/0

[R12-GigabitEthernet0/0/0]ip add 172.16.65.6 30


RIP区域:

[R12-GigabitEthernet0/0/0]int l0

[R12-LoopBack0]ip add 172.16.160.12 24

[R12-LoopBack0]int l1

[R12-LoopBack1]ip add 172.16.161.12 24

[R12-LoopBack1]quit

[R12]dis ip int b


区域3:

[R7]int g0/0/1

[R7-GigabitEthernet0/0/1]ip add 172.16.97.1 30

[R7-GigabitEthernet0/0/1]quit

[R7]dis ip int b

[R8]int g0/0/0

[R8-GigabitEthernet0/0/0]ip add 172.16.97.2 30

[R8-GigabitEthernet0/0/0]int g0/0/1

[R8-GigabitEthernet0/0/1]ip add 172.16.97.5 30

[R8-GigabitEthernet0/0/1]int l0 

[R8-LoopBack0]ip add 172.16.98.8 24

[R8-LoopBack0]quit

[R8]dis ip int b

[R9]int g0/0/0

[R9-GigabitEthernet0/0/0]ip add 172.16.97.6 30

[R9-GigabitEthernet0/0/0]quit

[R9]dis ip int b


区域4:

[R9]int g0/0/1

[R9-GigabitEthernet0/0/1]ip add 172.16.129.1 30

[R9-GigabitEthernet0/0/1]int l0 

[R9-LoopBack0]ip add 172.16.130.9 24

[R9-LoopBack0]quit

[R9]dis ip int b

[R10]int g0/0/0

[R10-GigabitEthernet0/0/0]ip add 172.16.129.2 30

[R10-GigabitEthernet0/0/0]int l0

[R10-LoopBack0]ip add 172.16.131.10 24

[R10-LoopBack0]quit

[R10]dis ip int b
 

3、在公网口的路由器上下发静态缺省。

[R3]ip route-static 0.0.0.0 0 43.0.0.4

[R5]ip route-static 0.0.0.0 0 45.0.0.4

[R6]ip route-static 0.0.0.0 0 46.0.0.4 

[R7]ip route-static 0.0.0.0 0 47.0.0.4

d0cc4c9337c1476da529fdc97287a315.png 

4、配置RIP协议、OSPF协议,使私网全通

(1)在R1上配置OSPF协议

[R1]ospf 1 router-id 1.1.1.1

[R1-ospf-1]area 0.0.0.1

[R1-ospf-1-area-0.0.0.1]network 172.16.32.0 0.0.31.255 

(2)在R1上配置OSPF协议

[R2]ospf 1 router-id 2.2.2.2

[R2-ospf-1]area 0.0.0.1

[R2-ospf-1-area-0.0.0.1]network 172.16.32.0 0.0.31.255 

(3)在R3上配置OSPF协议

[R3]ospf 1 router-id 3.3.3.3

[R3-ospf-1]area 0.0.0.1

[R3-ospf-1-area-0.0.0.1]network 172.16.32.0 0.0.31.255

930d4df6a82f4631b1943cb57526dcbd.png 

(4)在R6上配置OSPF协议

[R6]ospf 1 router-id 6.6.6.6

[R6-ospf-1]area 0.0.0.0

[R6-ospf-1-area-0.0.0.0]network 172.16.4.0 0.0.0.255 

[R6-ospf-1]area 0.0.0.2

[R6-ospf-1-area-0.0.0.2]network 172.16.64.0 0.0.31.255 

(5)在R11上配置OSPF协议

[R11]ospf 1 router-id 11.11.11.11

[R11-ospf-1]area 0.0.0.2

[R11-ospf-1-area-0.0.0.2]network 172.16.64.0 0.0.31.255

(6)在R12上配置RIP协议、OSPF协议

[R12]rip 1

[R12-rip-1]version 2

[R12-rip-1]undo summary

[R12-rip-1]network 172.16.0.0 

[R12]ospf 1 router-id 12.12.12.12

[R12-ospf-1]area 0.0.0.2

[R12-ospf-1-area-0.0.0.2]network 172.16.64.0 0.0.31.255 

[R12-ospf-1]import-route rip 

bc7483919f0f436e811ac5e21301795f.png

 

(7)在R7上配置OSPF协议

[R7]ospf 1 router-id 7.7.7.7

[R7-ospf-1]area 0.0.0.0

[R7-ospf-1-area-0.0.0.0]network 172.16.5.0 0.0.0.255 

[R7-ospf-1]area 0.0.0.3

[R7-ospf-1-area-0.0.0.3]network 172.16.96.0 0.0.31.255 

(8)在R8上配置OSPF协议

[R8]ospf 1 router-id 8.8.8.8

[R8-ospf-1]area 0.0.0.3

[R8-ospf-1-area-0.0.0.3]network 172.16.96.0 0.0.31.255 

(9)在R9上配置OSPF协议

[R9]ospf 1 router-id 9.9.9.9

[R9-ospf-1]area 0.0.0.3

[R9-ospf-1-area-0.0.0.3]network 172.16.96.0 0.0.31.255 

[R9]ospf 2 router-id 9.9.9.9 

[R9-ospf-2]area 0.0.0.4

[R9-ospf-2-area-0.0.0.4]network 172.16.128.0 0.0.31.255 

[R9-ospf-2]import-route ospf 1 

[R9-ospf-1]import-route ospf 2 

(10)在R10上配置OSPF协议

[R10]ospf 2 router-id 10.10.10.10

[R10-ospf-2]area 0.0.0.4

[R10-ospf-2-area-0.0.0.4]network 172.16.128.0 0.0.31.255 

7df951c64fd1427e9b4b057cacfd1ade.png

 

5、配置MGRE环境

(1)在R3上配置隧道IP地址,以R3为中心站点

[R3]interface 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 34.0.0.3 

[R3-Tunnel0/0/0]nhrp network-id 100 

[R3-Tunnel0/0/0]nhrp entry multicast dynamic 

(2)在R5是配置隧道IP地址,分支站点IP地址不固定,所以封装serial接口

[R5]interface Tunnel 0/0/0

[R5-Tunnel0/0/0]ip address172.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 

(3)在R6是配置隧道IP地址,分支站点IP地址不固定,所以封装serial接口

[R6]interface Tunnel 0/0/0

[R6-Tunnel0/0/0]ip address172.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

(7)在R7是配置隧道IP地址,分支站点IP地址不固定,所以封装serial接口

[R7]interface Tunnel 0/0/0

[R7-Tunnel0/0/0]ip address172.16.6.7 24

[R7-Tunnel0/0/0]tunnel-protocol gre p2mp

[R7-Tunnel0/0/0]source GigabitEthernet0/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 

6.配置路由协议

(1)在R3上宣告隧道地址

[R3]ospf 1

[R3-ospf-1]area 0.0.0.0

[R3-ospf-1-area-0.0.0.0]network 172.16.6.0 0.0.0.255 //宣告隧道网段

(2)在R5上宣告隧道地址

[R5]ospf 1 router-id 5.5.5.5

[r5-ospf-1]area 0.0.0.0

[R5-ospf-1-area-0.0.0.0]network 172.16.3.0 0.0.0.255 

[R5-ospf-1-area-0.0.0.0]network 172.16.6.0 0.0.0.255

(3)在R6上宣告隧道地址

[R6]ospf 1

[R6-ospf-1]area 0.0.0.0

[R6-ospf-1-area-0.0.0.0]network 172.16.6.0 0.0.0.255 

(4)在R7上宣告隧道地址

[R7]ospf 1

[R7-ospf-1]area 0.0.0.0

[R7-ospf-1-area-0.0.0.0]network 172.16.6.0 0.0.0.255

7、基于OSPF上配置MGRE环境的问题,OSPF的路由表可能学习不全,所以更改tunnel接口类型为广播或P2MP

[R3]interface Tunnel 0/0/0

[R3-Tunnel0/0/0]ospf network-type broadcast

[R5-Tunnel0/0/0]ospf network-type broadcast

[R6-Tunnel0/0/0]ospf network-type broadcast

[R7-Tunnel0/0/0]ospf network-type broadcast

8、因为BR和BDR选举容易混乱,所以关闭R5、R6和R7的选举权

[R5]interface Tunnel 0/0/0

[R5-Tunnel0/0/0]ospf dr-priority 0

[R6-Tunnel0/0/0]ospf dr-priority 0

[R7-Tunnel0/0/0]ospf dr-priority 0

R1pingR10

d5133526d15f4b0cae5591d2eb7c29f1.png

R1pingR12

6d9c833d3179488385060c8b7d279010.png

 

9、配置Easy IP,使全网可访问R4环回

(1)在R3上配置Easy IP

[R3]acl 2000

[R3-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255

[R3]interface serial 4/0/0

[R3-Serial4/0/0]nat outbound 2000

(2)在R6上配置Easy IP

[R6]acl 2000

[R6-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255

[R6]interface serial 4/0/0

[R6-Serial4/0/0]nat outbound 2000

(3)在R7上配置Easy IP

[R7]acl 2000

[R7-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255

[R7]interface GigabitEthernet0/0/0

[R7-GigabitEthernet0/0/0]nat outbound 2000

10.做区域聚合,减少LSA的更新数量。在ABR设备上做区域间聚合——在R3、R6和R7上做聚合。在ASBR设备上做域外聚合——在R9和R12上做聚合

(1)在R3上做area1的聚合

[R3]ospf 1

[R3-ospf-1]area 0.0.0.1

[R3-ospf-1-area-0.0.0.1]abr-summary 172.16.32.0 255.255.224.0

(2)在R6上做area2的聚合

[R6]ospf 1

[R6-ospf-1]area 0.0.0.2

[R6-ospf-1-area-0.0.0.2]abr-summary 172.16.64.0 255.255.224.0

(3)在R7上做area3的聚合

[R7]ospf 1

[R7-ospf-1]area 0.0.0.3

[R7-ospf-1-area-0.0.0.3]abr-summary 172.16.96.0 255.255.224.0

(4)在R9上做area4的聚合

[R9]ospf 1

[R9]asbr-summary 172.16.128.0 255.255.224.0

(5)在R12上做RIP聚合

[R12]ospf 1

[R12-ospf-1]asbr-summary 172.16.160.0 255.255.224.0

11、手动配置防环

[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

12、area1划分Totally stub;area2有ASBR设备(R12),所以划分Totally NSSA;area3有ASBR设备(R9),所以划分Totally NSSA

(1)划分area1的特殊区域

[R1]ospf 1

[R1-ospf-1]area 0.0.0.1

[R1-ospf-1-area-0.0.0.1]stub no-summary

[R2-ospf-1-area-0.0.0.1]stub no-summary

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

71df7f942de7498898c3a4bc262649b3.png

 

(2)划分area2的特殊区域

[R6]ospf 1

[R6-ospf-1]area 0.0.0.2

[R6-ospf-1-area-0.0.0.2]nssa no-summary

[R11-ospf-1-area-0.0.0.2]nssa no-summary

[R12-ospf-1-area-0.0.0.2]nssa no-summary

62723664317a4115aebc0dab09ad418a.png

 

(3)划分area3的特殊区域

[R7]ospf 1

[R7-ospf-1]area 0.0.0.3

[R7-ospf-1-area-0.0.0.3]nssa no-summary

[R8-ospf-1-area-0.0.0.3]nssa no-summary

[R9-ospf-1-area-0.0.0.3]nssa no-summary

b872ba6bab3b41ae8bcdabfdbe03d1ce.png

 

13、R9向R10下发默认缺省

[R9]ospf 2

[R9-ospf-2]default-route-advertise

2ab7d2c87f414792ab4420e1936e7860.png

 

14、修改hello时间或死亡时间来加快收敛进程

(1)修改area1的hello时间

[R1]interface GigabitEthernet0/0/0

[R1-GigabitEthernet0/0/0]ospf timer hello 5

[R2-GigabitEthernet0/0/0]ospf timer hello 5

[R3-GigabitEthernet0/0/0]ospf timer hello 5

(2)修改area0的hello时间

[R3]interface serial 4/0/0

[R3-Serial4/0/0]ospf timer hello 5

[R4-Serial4/0/0]ospf timer hello 5

[R4-Serial4/0/1]ospf timer hello 5

[R4-Serial3/0/0]ospf timer hello 5

[R4-GigabitEthernet0/0/0]ospf timer hello 5

[R5-Serial4/0/0]ospf timer hello 5

[R6-Serial4/0/0]ospf timer hello 5

[R7-GigabitEthernet0/0/0]ospf timer hello 5

(3)修改area2的hello时间

[R6]interface GigabitEthernet0/0/0

[R6-GigabitEthernet0/0/0]ospf timer hello 5

[R11-GigabitEthernet0/0/0]ospf timer hello 5

[R11-GigabitEthernet0/0/1]ospf timer hello 5

[R12-GigabitEthernet0/0/0]ospf timer hello 5

(4)修改area3的hello时间

[R7]interface GigabitEthernet0/0/1

[R7-GigabitEthernet0/0/1]ospf timer hello 5

[R8-GigabitEthernet0/0/0]ospf timer hello 5

[R8-GigabitEthernet0/0/1]ospf timer hello 5

[R9-GigabitEthernet0/0/0]ospf timer hello 5


(5)修改area4 的hello时间

[R9]interface GigabitEthernet0/0/1

[R9-GigabitEthernet0/0/1]ospf timer hello 5

[R10-GigabitEthernet0/0/0]ospf timer hello 5

15.做接口认证或区域认证,保障更新安全

(1)在area1配置区域认证

[R1]ospf 1

[R1-ospf-1]area 0.0.0.1

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

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

[R3-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher wdy12345

(2)在area2配置区域认证

[R6]ospf 1

[R6-ospf-1]area 0.0.0.2

[R6-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher wdy12345

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

[R12-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher wdy12345

(3)在area3配置区域认证

[R7]ospf 1

[R7-ospf-1]area 0.0.0.3

[R7-ospf-1-area-0.0.0.3]authentication-mode md5 1 cipher wdy12345

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

[R9-ospf-1-area-0.0.0.3]authentication-mode md5 1 cipher wdy12345

(4)在area4配置区域认证

[R9]ospf 2

[R9-ospf-2]area 0.0.0.4

[R9-ospf-2-area-0.0.0.4]authentication-mode md5 1 cipher wdy12345

[R10-ospf-2-area-0.0.0.4]authentication-mode md5 1 cipher wdy12345

(5)在area0配置区域认证

[R3]ospf 1

[R3-ospf-1]area 0.0.0.0

[R3-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher wdy12345

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

[R6-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher wdy12345

[R7-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher wdy12345

16、测试

3344953b481a45fb9d88d87c17468236.png

bb3a156f0232455caa6713222494e429.png 

 

 

  • 5
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值