思科OSPF配置实验案例详解

本文实例讲述了思科OSPF配置实验。分享给大家供大家参考,具体如下:

实验拓扑图

 思科OSPF配置实验案例详解

IPv4地址表

Device

Interface

IP Address

R1

F 0/0

10.1.65.1

S 1/0

192.168.65.1

R3

S 1/0

192.168.65.3

 

R4

S 1/0

192.168.65.4

R5

F 0/0

10.1.65.5

S 1/0

12.1.65.5

R6

F 0/0

10.1.65.6

F 0/1

11.1.65.6

R8

F 0/1

11.1.65.7

S 1/0

12.1.65.7

步骤1:开启帧中继交换功能

R2(config)#frame-relay switching

步骤2:配置接口封装

R2(config)#int s 1/2 

R2(config-if)#no shutdown

R2(config-if)#clock rate 128000    

R2(config-if)#encapsulation frame-relay

R2(config)#int s 1/0

R2(config-if)#no shutdown

R2(config-if)#clock rate 128000  

R2(config-if)#encapsulation frame-relay

R2(config)#int s 1/1

R2(config-if)#no shutdown

R2(config-if)#clock rate 128000  

R2(config-if)#encapsulation frame-relay

(3) 步骤3:配置LMI类型

R2(config)#int s 1/2

R2(config-if)#frame-relay lmi-type cisco

R2(config-if)#frame-relay intf-type dce

R2(config)#int s 1/0

R2(config-if)#frame-relay lmi-type cisco

R2(config-if)#frame-relay intf-type dce

R2(config)#int s 1/1

R2(config-if)#frame-relay lmi-type cisco

R2(config-if)#frame-relay intf-type dce

(4) 步骤4:配置帧中继交换表

R2(config)#int s 1/2

R2(config-if)#frame-relay route 103 interface s 1/0 301

R2(config-if)#frame-relay route 104 interface s 1/1 401

R2(config)#int Serial 1/0

R2(config-if)#frame-relay route 301 interface Serial1/2 103

R2(config)#int Serial 1/1

R2(config-if)#frame-relay route 401 interface Serial1/2 104

此时“show frame-relay route”

检查帧中继交换机是否正常

 思科OSPF配置实验案例详解

(5)步骤5:配置R1、R3、R4,使得它们能够互相通信

R1(config)#int s 1/0 

R1(config-if)#ip address 192.168.65.1 255.255.255.0

R1(config-if)#no shutdown

R1(config-if)#encapsulation frame-relay

R1(config-if)#frame-relay lmi-type cisco

R1(config-if)#no frame-relay inverse-arp     //关闭自动映射

R1(config-if)#frame-relay map ip 192.168.65.3 103 broadcast

R1(config-if)#frame-relay map ip 192.168.65.4 104 broadcast

R3(config)#int s 1/0 

R3(config-if)#ip address 192.168.65.3 255.255.255.0

R3(config-if)#no shutdown

R3(config-if)#encapsulation frame-relay

R3(config-if)#no frame-relay inverse-arp

R3(config-if)#frame-relay map ip 192.168.65.1 301 broadcast
R4(config)#int s 1/0 

R4(config-if)#ip address 192.168.65.4 255.255.255.0

R4(config-if)#no shutdown

R4(config-if)#encapsulation frame-relay

R4(config-if)#no frame-relay inverse-arp

R4(config-if)#frame-relay map ip 192.168.65.1 401 broadcast

进行ping命令测试

从R1ping到R3与R4

 思科OSPF配置实验案例详解

R1#show frame-relay map

R1#show frame-relay pvc 

发现已有两条本地连接

 思科OSPF配置实验案例详解

思科OSPF配置实验案例详解

步骤6:开始配置ospf 

先配置外部路由器ospf (R6、R1为例,R5.R8同理)

先配置外部路由器ospf (R6、R1为例,R5.R8同理)

R6(config)#router ospf 1

R6(config-router)#router-id 6.6.6.6

R6 (config-router)#area 1 nssa――配置区域 1 为 NSSA 区域

R6(config)#interface loopback 0

R6(config-if)#ip add 6.6.6.6 255.255.255.255

R6(config)#int f 0/0

R6(config-if)#ip add 10.1.65.6 255.255.255.0

R6(config-if)#no shut

R6(config-if)#ip ospf 1 area 0

R6(config-if)#int f 0/1

R6(config-if)#ip add 11.1.65.6 255.255.255.0

R6(config-if)#no shut

R6(config-if)#ip ospf 1 area 1

R6(config-if)#ex

R6(config)#router ospf 1

R6(config-router)#network 6.6.6.6 0.0.0.0 area 0

R6(config-router)#network 10.1.65.0 0.0.0.255 area 0

R6(config-router)#network 11.1.65.0 0.0.0.255 area 0

R1(config)#router ospf 1

R1(config-router)#router-id 1.1.1.1

R1(config)#interface loopback 0

R1(config-if)#ip add 1.1.1.1 255.255.255.255

R1(config)#int f 0/0

R1(config-if)#ip add 10.1.65.1 255.255.255.0

R1(config-if)#no shut

R1(config-if)#ip ospf 1 area 0

R1(config-if)#int s 1/0

R1(config-if)#ip ospf 1 area 0

R1(config-if)#ex

R1(config)#router ospf 1

R1(config-router)#network 1.1.1.1 0.0.0.0 area 0

R1(config-router)#network 10.1.65.0 0.0.0.255 area 0

R1(config-router)#network 192.168.65.0 0.0.0.255 area 0

R1(config-router)#neighbor 192.168.65.3

R1(config-router)#neighbor 192.168.65.4

步骤7:配置帧中继中路由器的ospf (R3为例,R4同理)

R3(config)#router ospf 1

R3(config-router)#router-id 3.3.3.3

R3(config-router)#ex

R3(config)#int loopback 0

R3(config-if)#ip add 3.3.3.3 255.255.255.255

R3(config-if)#ip ospf 1 area 2

R3(config-if)#int s 1/0

R3(config-if)# ip ospf 1 area 2

R3(config-if)# ip ospf priority 0

R3(config)#router ospf 1

R3(config-router)#network 3.3.3.3 0.0.0.0 area 2

R3(config-router)#network 192.168.65.0 0.0.0.255 area 2

已完成OSPFv2配置,在R1上查ospf邻居关系

R1#show ipv6 ospf neighbor

 思科OSPF配置实验案例详解

测试路由通断情况

在R5上测试得出结果如下(从内部到外部皆ping通,实验完成)

 思科OSPF配置实验案例详解

因为RIPNG是针对IPV6设计的一种路由协议,不支持IPV4,所以在OSPFv2里并没有做RIPNG路由配置。