自学内容网 自学内容网

OSPF综合实验

IP规划 

 ospf和RIP分两个网段:

172.16.0.0/17 -- ospf

172.16.128.0/17  -- rip

ospf五个区域:

172.16.0.0/20 -- area 0

172.16.16.0/20 -- area 1

172.16.32.0/20 -- area 2

172.16.48.0/20 -- area 3

172.16.64.0/20 -- area 4

172.16.96.0/20 

area 0 :链路,3个路由器的环回。4个网段:直接划到24,预留网段

172.16.1.0/24 -- R5环回

172.16.2.0/24 -- R6环回

172.16.3.0/24 -- R7环回

...

链路网段为34.1.1.1  。。。这样

MGRE:

tunnel ip:

100.1.1.3

100.1.1.5

...

area 1 :同area0一样

172.16.16.0/24 --链路(接口)网段

172.16.17.0/24 -- R1环回

172.16.18.0/24 -- R2环回

172.16.19.0/24 -- R3环回

area 2:1个环回+2段链路

172.16.32.0/24 --R6-R11

172.16.33.0/24 -- R11-R12

172.16.34.0/24 -- R11 环回

area 3:1个环回+2段链路

172.16.48.0/24 -- R7-R8

172.16.49.0/24 -- R8-R9

172.16.50.0/24 -- R8环回

area 4:2个环回+1段链路

172.16.64.0/24 -- R9 环回

172.16.65.0/24 -- R10 环回

172.16.66.0/24 -- R9-R10

RIP:

172.16.128.0/17 

 2个环回:

                172.16.128.0/18

                172.16.192.0/18

基础配置

R1

[r1-GigabitEthernet0/0/0]ip add 172.16.16.1 24
[r1-GigabitEthernet0/0/0]int l0
[r1-LoopBack0]ip add 172.16.17.1 24


[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]area 1
[r1-ospf-1-area-0.0.0.1]net 172.16.17.0 0.0.0.255
[r1-ospf-1-area-0.0.0.1]net 172.16.16.0 0.0.0.255
 

R2 

[r2-GigabitEthernet0/0/0]ip add 172.16.16.2 24
[r2-GigabitEthernet0/0/0]int l0
[r2-LoopBack0]ip add 172.16.18.1 24


[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 1
[r2-ospf-1-area-0.0.0.1]net 172.16.16.0 0.0.0.255
[r2-ospf-1-area-0.0.0.1]net 172.16.18.0 0.0.0.255

R3

 [r3-GigabitEthernet0/0/0]ip add 172.16.16.3 24
[r3-GigabitEthernet0/0/0]int l0
[r3-LoopBack0]ip add 172.16.19.1 24

[r3-Serial4/0/0]ip add 34.1.1.1 24

[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 1
[r3-ospf-1-area-0.0.0.1]net 172.16.16.0 0.0.0.255

[r3-ospf-1-area-0.0.0.1]net 172.16.19.0 0.0.0.255

[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]net 34.1.1.0 0.0.0.255
 

R4 

 [r4-Serial4/0/0]ip add 34.1.1.2 24
[r4-Serial4/0/1]ip add 45.1.1.1 24
[r4-Serial3/0/0]ip add 46.1.1.1 24
[r4-GigabitEthernet0/0/0]ip add 47.1.1.1 24
[r4-LoopBack0]ip add 4.4.4.4 24

R5 

[r5-Serial4/0/0]ip add 45.1.1.2 24
[r5-LoopBack0]ip add 172.16.1.1 24

[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.1.0 0.0.0.255

R6 

[r6-Serial4/0/0]ip add 46.1.1.2 24
[r6-LoopBack0]ip add 172.16.2.1 24        
[r6-GigabitEthernet0/0/0]ip add 172.16.32.1 24

[r6]ospf 1 router-id 6.6.6.6
[r6-ospf-1]area 0
[r6-ospf-1-area-0.0.0.0]net 172.16.2.0 0.0.0.255
[r6-ospf-1-area-0.0.0.2]net 172.16.32.0 0.0.0.255

R7 

 [r7-GigabitEthernet0/0/0]ip add 47.1.1.2 24
[r7-GigabitEthernet0/0/1]ip add 172.16.48.1 24
[r7-LoopBack0]ip add 172.16.3.1 24

[r7]ospf 1 router-id 7.7.7.7
[r7-ospf-1]area 0
[r7-ospf-1-area-0.0.0.0]net 172.16.3.1 0.0.0.0

[r7-ospf-1-area-0.0.0.3]net 172.16.48.1 0.0.0.0

R8 

 [r8-GigabitEthernet0/0/0]ip add 172.16.48.2 24
[r8-GigabitEthernet0/0/1]ip add 172.16.49.1 24
[r8-LoopBack0]ip add 172.16.50.1 24

[r8]ospf 1 router-id 8.8.8.8 
[r8-ospf-1]area 3
[r8-ospf-1-area-0.0.0.3]net 172.16.48.2 0.0.0.0

[r8-ospf-1-area-0.0.0.3]net 172.16.49.1  0.0.0.0
[r8-ospf-1-area-0.0.0.3]net 172.16.50.1 0.0.0.0
 

R9 

 [r9-GigabitEthernet0/0/0]ip add 172.16.49.2 24
[r9-GigabitEthernet0/0/1]ip add 172.16.66.1 24
[r9-LoopBack0]ip add 172.16.64.1 24

[r9]ospf 1 router-id 9.9.9.9
[r9-ospf-1]area 3
[r9-ospf-1-area-0.0.0.3]net 172.16.49.2 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]network 172.16.66.1 0.0.0.0
[r9-ospf-2-area-0.0.0.4]network 172.16.64.1 0.0.0.0

R10 

 [r10-GigabitEthernet0/0/0]ip add 172.16.66.2 24
[r10-LoopBack0]ip add 172.16.65.1 24

[r10]ospf 1 router-id 10.1.1.1
[r10-ospf-1]area 4
[r10-ospf-1-area-0.0.0.4]net 172.16.66.2 0.0.0.0
[r10-ospf-1-area-0.0.0.4]net 172.16.65.1 0.0.0.0

R11 

 [r11-GigabitEthernet0/0/0]ip add 172.16.32.2 24
[r11-GigabitEthernet0/0/1]ip add 172.16.33.1 24
[r11-LoopBack0]ip add 172.16.34.1 24

[r11]ospf 1 router-id 11.1.1.1 
[r11-ospf-1]area 2
[r11-ospf-1-area-0.0.0.2]net 172.16.32.2 0.0.0.0
[r11-ospf-1-area-0.0.0.2]net 172.16.33.1 0.0.0.0
[r11-ospf-1-area-0.0.0.2]net 172.16.34.1 0.0.0.0
 

R12 

[r12-GigabitEthernet0/0/0]ip add 172.16.33.2 24
[r12-LoopBack0]ip add 172.16.128.1 24
[r12-LoopBack0]ip add 172.16.192.1 24

[r12]ospf 1 router-id 12.1.1.1
[r12-ospf-1]area 2
[r12-ospf-1-area-0.0.0.2]net 172.16.33.2 0.0.0.0
[r12-rip-1]net 172.16.0.0

 MGRE

R3 

 [r3]int Tunnel 0/0/0
[r3-Tunnel0/0/0]ip add 100.1.1.3 24
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r3-Tunnel0/0/0]source 34.1.1.1

[r3-Tunnel0/0/0]nhrp entry multicast dynamic
[r3-Tunnel0/0/0]nhrp network-id 100

[r3-Tunnel0/0/0]ospf network-type p2mp

[r3]ip route-static 0.0.0.0 0 34.1.1.2

R5 

 [r5]int Tunnel 0/0/0
[r5-Tunnel0/0/0]ip add 100.1.1.5 24
[r5-Tunnel0/0/0]tunnel-protocol gre p2

[r5-Tunnel0/0/0]source 45.1.1.2
[r5-Tunnel0/0/0]nhrp network-id 100
[r5-Tunnel0/0/0]nhrp entry 100.1.1.3 34.1.1.1 register 
[r5-Tunnel0/0/0]ospf network-type p2mp

[r5]ip route-static 0.0.0.0 0 45.1.1.1

[r5-ospf-1-area-0.0.0.0]net 100.1.1.5 0.0.0.0

R6 

[r6]int Tunnel 0/0/0
[r6-Tunnel0/0/0]ip add 100.1.1.6 24
[r6-Tunnel0/0/0]tunnel-protocol gre p2mp

[r6-Tunnel0/0/0]source 46.1.1.2

[r6-Tunnel0/0/0]nhrp entry 100.1.1.3 34.1.1.1 register

[r6-Tunnel0/0/0]ospf network-type p2mp

[r6]ip route-static 0.0.0.0 0 46.1.1.1

[r6-ospf-1-area-0.0.0.0]net 100.1.1.6 0.0.0.0

R7 

[r7]int Tunnel 0/0/0
[r7-Tunnel0/0/0]ip add 100.1.1.7 24
[r7-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r7-Tunnel0/0/0]source 47.1.1.2
[r7-Tunnel0/0/0]nhrp entry 100.1.1.3 34.1.1.1 register
[r7-Tunnel0/0/0]ospf network-type p2mp
[r7]ip route-static 0.0.0.0 0 47.1.1.1

[r7-ospf-1-area-0.0.0.0]net 100.1.1.7 0.0.0.0

全网互通

R9

 双向重发布解决:

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

 R12

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

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

汇总 ,特殊区域

在IP规划时,咱们给区域划分好网段了,所以直接配就好

 R3

在边界路由器上设置汇总:

[r3-ospf-1-area-0.0.0.1]abr-summary 172.16.16.0 255.255.240.0

做Totally  stub。给R1,R2做stub

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

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

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

R6 

[r6-ospf-1-area-0.0.0.2]abr-summary 172.16.32.0 255.255.240.0

R6:Totally NSSA

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

[r11-ospf-1-area-0.0.0.2]nssa

[r12-ospf-1-area-0.0.0.2]nssa

R7 

[r7-ospf-1-area-0.0.0.3]abr-summary 172.16.48.0 255.255.240.0

R7:Totally NSSA

做完之后,R10上没有其他路由的信息,在r9上写条缺省

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

认证

区域认证:

像这样给每个区域认证

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

NAT 

[r3-acl-basic-2000]rule permit source 172.16.16.0 0.0.15.255
[r3-Serial4/0/0]nat outbound 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-Serial4/0/0]nat outbound 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-GigabitEthernet0/0/0]nat  outbound 2000

测试

 


原文地址:https://blog.csdn.net/mgwzz/article/details/143658250

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!