OSPF综合实验

拓扑图与要求

实验步骤

一.IP地址划分

公网

        AR3-AR4:34.0.0.0 24

        AR7-AR4:47.0.0.0 24

        AR6-AR4:46.0.0.0 24

        AR5-AR4:45.0.0.0 24

        AR4回环:100.0.0.1

私网

        对于网段172.16.0.0/16划分,分为八个网段,取其中六个为区域配置

 area0

        划分网段172.16.0.0/19

        172.16.0.0/24        骨干链路(p2p网段)

                172.16.0.0/30       

                172.16.0.4/30

                172.16.0.8/30

                ……

        172.16.1.0/24        骨干链路(MA骨干)

                172.16.1.0/29

                172.16.1.8/29

                172.16.1.16/29

                ……

        172.16.2.0/24

        172.16.3.0/24

         ……

area1

        划分网段172.16.32.0/19

        172.16.32.0/24        骨干链路(p2p网段)

                172.16.32.0/30

                172.16.32.4/30

                172.16.32.8/30

                ……

        172.16.33.0/24        骨干链路(MA骨干)

                172.16.1.0/29

                172.16.1.8/29

                172.16.1.16/29

                ……

        172.16.2.0/24

        172.16.3.0/24

        ……

  area2        

        划分网段172.16.64.0/19

        172.16.64.0/24        骨干链路(p2p网段)

                172.16.64.0/30

                172.16.64.4/30

                172.16.64.8/30

                ……

        172.16.65.0/24        骨干链路(MA骨干)

                172.16.65.0/29

                172.16.65.8/29

                172.16.65.16/29

                ……

        172.16.66.0/24

        172.16.67.0/24

        ……

area3

        划分网段172.16.96.0/19

        172.16.96.0/24        骨干链路(p2p网段)

                172.16.96.0/30

                172.16.96.4/30

                172.16.96.8/30

                ……

        172.16.97.0/24        骨干链路(MA骨干)

                172.16.97.0/29

                172.16.97.8/29

                172.16.97.16/29

                ……

        172.16.98.0/24

        172.16.99.0/24

        ……

area4

        划分网段172.16.128.0/19

        172.16.128.0/24        骨干链路(p2p网段)

                172.16.128.0/30

                172.16.128.4/30

                172.16.128.8/30

                ……

        172.16.129.0/24        骨干链路(MA骨干)

                172.16.129.0/29

                172.16.129.8/29

                172.16.129.16/29

                ……

        172.16.130.0/24

        172.16.131.0/24

        ……

RIP

        划分网段172.16.160.0/19

        172.16.160.0/24        

        172.16.161.0/24        

        172.16.162.0/24

        172.16.163.0/24

        ……

……

二.配置区域0

配置IP地址以及缺省,达到公网互通
[r3]int s 4/0/0
[r3-Serial4/0/0]ip add 34.0.0.1 24
[r3]ip route-static 0.0.0.0 0 34.0.0.2

[r7]int g 0/0/0
[r7-GigabitEthernet0/0/0]ip add 47.0.0.1 24 
[r7-GigabitEthernet0/0/0]q
[r7]ip route-static 0.0.0.0 0 47.0.0.2
[r7]int l0
[r7-LoopBack0]ip add 172.16.4.1 24

[r6]int s 4/0/0
[r6-Serial4/0/0]ip add 46.0.0.1 24
[r6-Serial4/0/0]q
[r6]ip route-static 0.0.0.0 0 46.0.0.2
[r6]int l0
[r6-LoopBack0]ip add 172.16.3.1 24

[r5]int s 4/0/0
[r5-Serial4/0/0]ip add 45.0.0.1 24
[r5]ip route-static 0.0.0.0 0 45.0.0.2
[r5]int l0
[r5-LoopBack0]ip add 172.16.2.1 24

[ISP]int s 4/0/0
[ISP-Serial4/0/0]ip add 34.0.0.2 24
[ISP-Serial4/0/0]int s 4/0/1
[ISP-Serial4/0/1]ip add 45.0.0.2 24 
[ISP-Serial4/0/1]int s 3/0/0
[ISP-Serial3/0/0]ip add 46.0.0.2 24 
[ISP-Serial3/0/0]int g 0/0/0
[ISP-GigabitEthernet0/0/0]ip add 47.0.0.2 24
[ISP-GigabitEthernet0/0/0]int l0
[ISP-LoopBack0]ip add 100.0.0.1 24

       运行结果如下,达到互通

        配置MGRE环境
R3中心配置
[r3]int t 0/0/0
[r3-Tunnel0/0/0]ip add 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 

       

[r5]int t 0/0/0
[r5-Tunnel0/0/0]ip add 172.16.1.2 29
[r5-Tunnel0/0/0]tunnel-protocol gre p2mp
[r5-Tunnel0/0/0]source 45.0.0.1
[r5-Tunnel0/0/0]nhrp network-id 100	
[r5-Tunnel0/0/0]nhrp entry 172.16.1.1 34.0.0.1 register 

        

[r6]int t 0/0/0
[r6-Tunnel0/0/0]ip add 172.16.1.3 29
[r6-Tunnel0/0/0]tunnel-protocol gre p2mp
[r6-Tunnel0/0/0]source 46.0.0.1
[r6-Tunnel0/0/0]nhrp network-id 100
[r6-Tunnel0/0/0]nhrp entry 172.16.1.1 34.0.0.1 register

        

[r7]int t 0/0/0
[r7-Tunnel0/0/0]ip add 172.16.1.4 29
[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.1.1 34.0.0.1 register

        

运行结果如下,达到互通

配置OSPF
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 5
The number of interface that is DOWN in Physical is 3
The number of interface that is UP in Protocol is 5
The number of interface that is DOWN in Protocol is 3

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              172.16.33.3/29       up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         172.16.36.1/24       up         up(s)     
NULL0                             unassigned           up         up(s)     
Serial4/0/0                       34.0.0.1/24          up         up        
Serial4/0/1                       unassigned           down       down      
Tunnel0/0/0                       172.16.1.1/29        up         up     
[r3-ospf-1-area-0.0.0.0]network 172.16.1.1 0.0.0.0    //直接宣告此区域中对应接口地址


[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]area 0
[r5-ospf-1-area-0.0.0.0]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 4
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 4

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              unassigned           down       down      
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         172.16.2.1/24        up         up(s)     
NULL0                             unassigned           up         up(s)     
Serial4/0/0                       45.0.0.1/24          up         up        
Serial4/0/1                       unassigned           down       down      
Tunnel0/0/0                       172.16.1.2/29        up         up        
[r5-ospf-1-area-0.0.0.0]network 172.16.2.1 0.0.0.0
[r5-ospf-1-area-0.0.0.0]network 172.16.1.2 0.0.0.0


[r6]ospf 1 router-id 6.6.6.6
[r6-ospf-1]area 0
[r6-ospf-1-area-0.0.0.0]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 5
The number of interface that is DOWN in Physical is 3
The number of interface that is UP in Protocol is 5
The number of interface that is DOWN in Protocol is 3

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              172.16.64.1/30       up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         172.16.3.1/24        up         up(s)     
NULL0                             unassigned           up         up(s)     
Serial4/0/0                       46.0.0.1/24          up         up        
Serial4/0/1                       unassigned           down       down      
Tunnel0/0/0                       172.16.1.3/29        up         up        
[r6-ospf-1-area-0.0.0.0]network 172.16.3.1 0.0.0.0
[r6-ospf-1-area-0.0.0.0]network 172.16.1.3 0.0.0.0


[r7]ospf 1 router-id 7.7.7.7
[r7-ospf-1]area 0
[r7-ospf-1-area-0.0.0.0]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 5
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 5
The number of interface that is DOWN in Protocol is 1

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              47.0.0.1/24          up         up        
GigabitEthernet0/0/1              172.16.96.1/30       up         up        
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         172.16.4.1/24        up         up(s)     
NULL0                             unassigned           up         up(s)     
Tunnel0/0/0                       172.16.1.4/29        up         up        
[r7-ospf-1-area-0.0.0.0]network 172.16.4.1 0.0.0.0
[r7-ospf-1-area-0.0.0.0]network 172.16.1.4 0.0.0.0

三.配置区域1

配置ip地址
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0] ip add 172.16.33.1 29
[r1-GigabitEthernet0/0/0]int l0
[r1-LoopBack0]ip add 172.16.34.1 24

[r2]int g 0/0/0
[r2-GigabitEthernet0/0/0]ip add 172.16.33.2 29
[r2-GigabitEthernet0/0/0]int l0
[r2-LoopBack0]ip add 172.16.35.1 24

[r3]int g 0/0/0
[r3-GigabitEthernet0/0/0]ip add 172.16.33.3 29
[r3-GigabitEthernet0/0/0]int l0
[r3-LoopBack0]ip add 172.16.36.1 24
配置OSPF
[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]area 1
[r1-ospf-1-area-0.0.0.1]netw	
[r1-ospf-1-area-0.0.0.1]network 0.0.0.0 0.0.0.0   //确定只在此区域时才能采取这种宣告

[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.32.0 0.0.31.255   //采用反掩码宣告

[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 1
[r3-ospf-1-area-0.0.0.1]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 5
The number of interface that is DOWN in Physical is 3
The number of interface that is UP in Protocol is 5
The number of interface that is DOWN in Protocol is 3

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              172.16.33.3/29       up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         172.16.36.1/24       up         up(s)     
NULL0                             unassigned           up         up(s)     
Serial4/0/0                       34.0.0.1/24          up         up        
Serial4/0/1                       unassigned           down       down      
Tunnel0/0/0                       172.16.1.1/29        up         up        
[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.16.36.1 0.0.0.0    //直接宣告此区域中对应接口地址

四.配置区域2

配置ip地址
[r6]int g 0/0/0
[r6-GigabitEthernet0/0/0]ip add 172.16.64.1 30

[r11]int g 0/0/0
[r11-GigabitEthernet0/0/0]ip add 172.16.64.2 30 
[r11-GigabitEthernet0/0/0]int g 0/0/1
[r11-GigabitEthernet0/0/1]ip add 172.16.64.5 30
[r11-GigabitEthernet0/0/1]int l0
[r11-LoopBack0]ip add 172.16.66.1 24

[r12]int g 0/0/0
[r12-GigabitEthernet0/0/0]ip add 172.16.64.6 30
配置OSPF
[r6]ospf 1 router-id 6.6.6.6
[r6-ospf-1]area 2
[r6-ospf-1-area-0.0.0.2]net	
[r6-ospf-1-area-0.0.0.2]network 172.16.64.1 0.0.0.0

[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.64.0 0.0.31.255

[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.64.0 0.0.31.255

五.配置区域3

配置ip地址
[r7]int g 0/0/1
[r7-GigabitEthernet0/0/1]ip add 172.16.96.1 30

[r8]int g 0/0/0
[r8-GigabitEthernet0/0/0]ip add 172.16.96.2 30
[r8-GigabitEthernet0/0/0]int g 0/0/1
[r8-GigabitEthernet0/0/1]ip add 172.16.96.5 30
[r8-GigabitEthernet0/0/1]int l0
[r8-LoopBack0]ip add 172.16.98.1 24

[r9]int g 0/0/0
[r9-GigabitEthernet0/0/0]ip add 172.16.96.6 30
配置OSPF
[r7]ospf 1 router-id 7.7.7.7
[r7-ospf-1]area 3
[r7-ospf-1-area-0.0.0.3]network 172.16.96.1 0.0.0.0

[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.96.0 0.0.31.255

[r9]ospf 1 router-id 9.9.9.9
[r9-ospf-1]area 3
[r9-ospf-1-area-0.0.0.3]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 1

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              172.16.96.6/30       up         up        
GigabitEthernet0/0/1              172.16.128.1/30      up         up        
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         172.16.130.1/24      up         up(s)     
NULL0                             unassigned           up         up(s)     
[r9-ospf-1-area-0.0.0.3]network 172.16.96.6 0.0.0.0

六.配置区域4

配置ip地址
[r9-GigabitEthernet0/0/0]int g 0/0/1
[r9-GigabitEthernet0/0/1]ip add 172.16.128.1 30
[r9-GigabitEthernet0/0/1]int l0
[r9-LoopBack0]ip add 172.16.130.1 24

[r10]int g 0/0/0
[r10-GigabitEthernet0/0/0]ip add 172.16.128.2 30
[r10-GigabitEthernet0/0/0]int l0
[r10-LoopBack0]ip add 172.16.131.1 24
配置OSPF
[r9]ospf 1 router-id 9.9.9.9
[r9-ospf-1]area 4
[r9-ospf-1-area-0.0.0.4]network 172.16.128.0 0.0.31.255

[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.128.0 0.0.31.255

七.配置RIP

配置Ip地址
[r12]int l0
[r12-LoopBack0]ip add 172.16.160.1 24
[r12-LoopBack0]int l1
[r12-LoopBack1]ip add 172.16.161.1 24
宣告rip
[r12]rip
[r12-rip-1]network 172.16.0.0

八.保证邻居关系的建立

因为区域0中建立的隧道接口,默认工作方式为点到点连接,无法广播发送,与所有设备建立邻居关系

修改接口为P2MP

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

[r5]INT T 0/0/0
[r5-Tunnel0/0/0]ospf network-type p2mp

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

[r7]int t 0/0/0
[r7-Tunnel0/0/0]ospf network-type p2mp

修改后,R3的邻居表如下

R1pingR12测试如下

九.解决不规则区域

引入RIP协议
[r12]ospf
[r12-ospf-1]import-route rip

成功学习到域外网段 172.16.160.0/24    172.16.161.0/24

使用多进程双向重发布,解决远离骨干的非骨干区域

将区域四的协议改为ospf2,如引入其他协议rip般引入区域四

删除区域四中的ospf1宣告
[r9]ospf
[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.31.255 
#
return
[r9-ospf-1-area-0.0.0.4]undo network 172.16.128.0 0.0.31.255 

删除区域4
[r9-ospf-1-area-0.0.0.4]q
[r9-ospf-1]undo area 4

R10可以直接删除OSPF1,但R9中有区域三的OSPF1配置,所以不能直接删除R3的OSPF1
[r10]undo ospf 1
Warning: The OSPF process will be deleted. Continue? [Y/N]:y

重新配置OSPF2

[r9]ospf 2 router-id 9.9.9.9
[r9-ospf-2]area 0
[r9-ospf-2-area-0.0.0.0]network 172.16.128.0 0.0.31.255
[r9-ospf-2]default-route-advertise

[r10]ospf 2 router-id 10.10.10.10
[r10-ospf-2]area 0
[r10-ospf-2-area-0.0.0.0]network 172.16.128.0 0.0.31.255

引入OSPF 2

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

十.优化

 域内汇总
区域1
[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  //172.168.32.0/19

区域2
[r6]ospf
[r6-ospf-1]area 2
[r6-ospf-1-area-0.0.0.2]abr-summary 172.16.64.0 255.255.224.0

区域3
[r7]ospf
[r7-ospf-1]area 3	
[r7-ospf-1-area-0.0.0.3]abr-summary 172.16.96.0 255.255.224.0
域外汇总
RIP
[r12]ospf	
[r12-ospf-1]asbr-summary 172.16.160.0 255.255.224.0

区域4
[r9]ospf
[r9-ospf-1]asbr-summary 172.16.128.0 255.255.224.0
特殊区域

区域1        STUB  不是骨干区域,不存在虚链路,没有ASBR

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

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

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

区域2        NSSA  不是骨干区域,不存在虚链路,存在ASBR(R12)

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

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

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

区域3  NSSA    不是骨干区域,不存在虚链路,存在ASBR(R9,连接OSPF 2)

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

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

[r9]ospf
[r9-ospf-1]area 3
[r9-ospf-1-area-0.0.0.3]nssa
访问R4,配置NAT
[r3]acl 2000
[r3-acl-basic-2000]rule permit s 172.16.0.0 0.0.255.255
[r3-acl-basic-2000]q
[r3]int s 4/0/0
[r3-Serial4/0/0]nat outbound 2000

[r5]acl 2000
[r5-acl-basic-2000]rule permit s 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 s 172.16.0.0 0.0.255.255
[r6-acl-basic-2000]int s 4/0/0
[r6-Serial4/0/0]nat outbound 2000

[r7]acl 2000
[r7-acl-basic-2000]rule permit s 172.16.0.0 0.0.255.255
[r7-acl-basic-2000]int g 0/0/0
[r7-GigabitEthernet0/0/0]nat outbound 2000
加快收敛

在边界路由器上修改hello时间

[r3]int t 0/0/0
[r3-Tunnel0/0/0]ospf timer hello 10
保障更新安全

接口认证   对某个接口

[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456

区域认证   对区域中宣告的所有

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值