OSPF定义了3种网络:点到点、广播、非广播多路访问
在非广播多路访问环境中,接口又可以选择broadcast、non-broadcast、point-to-multipoint、point-to-multipoint nonbroadcast及point-to-point。其中broadcast、point-to-multipoint nonbroadcast及point-to-point为思科专属的。
说明:OSPF协议是一个非常复杂的路由协议,在设计网络的时候要关注很多的细节,本实验主要考虑OSPF接口的网络类型,不考虑区域,所以所有的路由器将工作在Area0中。
一、实验拓扑图:
二、设备选择及实验环境搭建细节
实验设备:
路由器:2600(R1、R3、R4);3640(R2、R5、R6、R7、R8)
交换机:3640(Switch)
路由器:2600(R1、R3、R4);3640(R2、R5、R6、R7、R8)
交换机:3640(Switch)
帧中继交换机设置:
VC:S0:205:S1:502
VC:S1:502:S0:205
VC:S0:206:S2:602
VC:S2:602:S0:206
VC:S0:207:S3:702
VC:S3:702:S0:207
VC:S0:208:S4:802
VC:S4:802:S0:208
VC:S0:205:S1:502
VC:S1:502:S0:205
VC:S0:206:S2:602
VC:S2:602:S0:206
VC:S0:207:S3:702
VC:S3:702:S0:207
VC:S0:208:S4:802
VC:S4:802:S0:208
设备连接详情:
Router1 F0/0 <----> Router2 F0/0
Router2 F1/0 <----> Switch1 F0/0
Router3 F0/0 <----> Switch1 F0/1
Router4 F0/0 <----> Switch1 F0/2
Router2 S2/0 <----> SwitchFR S0/0
Router5 S0/0 <----> SwitchFR S0/1
Router6 S0/0 <----> SwitchFR S0/2
Router7 S0/0 <----> SwitchFR S0/3
Router8 S0/0 <----> SwitchFR S0/4
Router1 F0/0 <----> Router2 F0/0
Router2 F1/0 <----> Switch1 F0/0
Router3 F0/0 <----> Switch1 F0/1
Router4 F0/0 <----> Switch1 F0/2
Router2 S2/0 <----> SwitchFR S0/0
Router5 S0/0 <----> SwitchFR S0/1
Router6 S0/0 <----> SwitchFR S0/2
Router7 S0/0 <----> SwitchFR S0/3
Router8 S0/0 <----> SwitchFR S0/4
三、实验要求
R1与R2相连的接口类型为P2P(192.168.1.0/30)
R2与R3、R4之间的接口类型为Broadcast(三台路由器位于同一子网 192.168.2.0/24)
R2与R5、R6间的接口类型为Non-broadcast(R2子接口S2/0.1 与R5 位于192.168.3.0/30 ,R2子接口S2/0.2 与R6位于 192.168.3.4/30)
R2与R7、R8间的接口类型为point-to-multipoint(R2子接口S0/2.3与R7、R8位于同一子网 192.168.4.0/24)
R2与R3、R4之间的接口类型为Broadcast(三台路由器位于同一子网 192.168.2.0/24)
R2与R5、R6间的接口类型为Non-broadcast(R2子接口S2/0.1 与R5 位于192.168.3.0/30 ,R2子接口S2/0.2 与R6位于 192.168.3.4/30)
R2与R7、R8间的接口类型为point-to-multipoint(R2子接口S0/2.3与R7、R8位于同一子网 192.168.4.0/24)
四、关键配置
1.路由器R1:
interface FastEthernet0/0
description Connected to R2
ip address 192.168.1.1 255.255.255.252
ip ospf network point-to-point (定义OSPF网络类型)
speed 100
full-duplex
!
interface FastEthernet0/1
no ip address
shutdown
duplex auto
speed auto
!
router ospf 1
router-id 1.1.1.1
log-adjacency-changes
network 192.168.1.0 0.0.0.3 area 0
!
interface FastEthernet0/0
description Connected to R2
ip address 192.168.1.1 255.255.255.252
ip ospf network point-to-point (定义OSPF网络类型)
speed 100
full-duplex
!
interface FastEthernet0/1
no ip address
shutdown
duplex auto
speed auto
!
router ospf 1
router-id 1.1.1.1
log-adjacency-changes
network 192.168.1.0 0.0.0.3 area 0
!
2.路由器R2:
!
interface FastEthernet0/0
description Connected to R1
ip address 192.168.1.2 255.255.255.252
ip ospf network point-to-point
duplex auto
speed auto
!
interface FastEthernet1/0
description Connected to Switch
ip address 192.168.2.1 255.255.255.0
duplex auto
speed auto
!
interface Serial2/0
description Connected to Frame-Relay Network
no ip address
encapsulation frame-relay IETF
serial restart-delay 0
!
interface Serial2/0.1 point-to-point
ip address 192.168.3.1 255.255.255.252
ip ospf network non-broadcast
frame-relay interface-dlci 205
!
interface Serial2/0.2 point-to-point
ip address 192.168.3.5 255.255.255.252
ip ospf network non-broadcast
frame-relay interface-dlci 206
!
interface Serial2/0.3 multipoint
ip address 192.168.4.1 255.255.255.0
ip ospf network point-to-multipoint
frame-relay interface-dlci 207
frame-relay interface-dlci 208
!
interface FastEthernet0/0
description Connected to R1
ip address 192.168.1.2 255.255.255.252
ip ospf network point-to-point
duplex auto
speed auto
!
interface FastEthernet1/0
description Connected to Switch
ip address 192.168.2.1 255.255.255.0
duplex auto
speed auto
!
interface Serial2/0
description Connected to Frame-Relay Network
no ip address
encapsulation frame-relay IETF
serial restart-delay 0
!
interface Serial2/0.1 point-to-point
ip address 192.168.3.1 255.255.255.252
ip ospf network non-broadcast
frame-relay interface-dlci 205
!
interface Serial2/0.2 point-to-point
ip address 192.168.3.5 255.255.255.252
ip ospf network non-broadcast
frame-relay interface-dlci 206
!
interface Serial2/0.3 multipoint
ip address 192.168.4.1 255.255.255.0
ip ospf network point-to-multipoint
frame-relay interface-dlci 207
frame-relay interface-dlci 208
!
!
router ospf 1
router-id 2.2.2.2
log-adjacency-changes
network 192.168.1.0 0.0.0.3 area 0
network 192.168.2.0 0.0.0.255 area 0
network 192.168.3.0 0.0.0.3 area 0
network 192.168.3.4 0.0.0.3 area 0
network 192.168.4.0 0.0.0.255 area 0
neighbor 192.168.3.6 (接口的网络类型为non-broadcast,所以需要指定邻居)
neighbor 192.168.3.2
!
router ospf 1
router-id 2.2.2.2
log-adjacency-changes
network 192.168.1.0 0.0.0.3 area 0
network 192.168.2.0 0.0.0.255 area 0
network 192.168.3.0 0.0.0.3 area 0
network 192.168.3.4 0.0.0.3 area 0
network 192.168.4.0 0.0.0.255 area 0
neighbor 192.168.3.6 (接口的网络类型为non-broadcast,所以需要指定邻居)
neighbor 192.168.3.2
!
3.路由器R3:
!
interface FastEthernet0/0
description Connected to Switch
ip address 192.168.2.2 255.255.255.0
ip ospf priority 0 (确保R2为DR)
speed 100
full-duplex
!
router ospf 1
router-id 3.3.3.3
log-adjacency-changes
network 192.168.2.0 0.0.0.255 area 0
!
interface FastEthernet0/0
description Connected to Switch
ip address 192.168.2.2 255.255.255.0
ip ospf priority 0 (确保R2为DR)
speed 100
full-duplex
!
router ospf 1
router-id 3.3.3.3
log-adjacency-changes
network 192.168.2.0 0.0.0.255 area 0
!
4.路由器R4:
!
interface FastEthernet0/0
description Connected to Switch
ip address 192.168.2.3 255.255.255.0
ip ospf priority 0
speed 100
full-duplex
!
router ospf 1
router-id 4.4.4.4
log-adjacency-changes
network 192.168.2.0 0.0.0.255 area 0
!
interface FastEthernet0/0
description Connected to Switch
ip address 192.168.2.3 255.255.255.0
ip ospf priority 0
speed 100
full-duplex
!
router ospf 1
router-id 4.4.4.4
log-adjacency-changes
network 192.168.2.0 0.0.0.255 area 0
!
5.路由器R5:
!
interface Serial0/0
description Connected to Frame-Relay Network
ip address 192.168.3.2 255.255.255.252
encapsulation frame-relay IETF
ip ospf priority 0
serial restart-delay 0
!
interface Serial0/0
description Connected to Frame-Relay Network
ip address 192.168.3.2 255.255.255.252
encapsulation frame-relay IETF
ip ospf priority 0
serial restart-delay 0
!
router ospf 1
router-id 5.5.5.5
log-adjacency-changes
network 192.168.3.0 0.0.0.3 area 0
!
router-id 5.5.5.5
log-adjacency-changes
network 192.168.3.0 0.0.0.3 area 0
!
6.路由器R6:
!
interface Serial0/0
description Connected to Frame-Relay Network
ip address 192.168.3.6 255.255.255.252
encapsulation frame-relay
ip ospf priority 0
serial restart-delay 0
!
interface Serial0/0
description Connected to Frame-Relay Network
ip address 192.168.3.6 255.255.255.252
encapsulation frame-relay
ip ospf priority 0
serial restart-delay 0
!
router ospf 1
router-id 6.6.6.6
log-adjacency-changes
network 192.168.3.4 0.0.0.3 area 0
!
router-id 6.6.6.6
log-adjacency-changes
network 192.168.3.4 0.0.0.3 area 0
!
7.路由器R7:
!
interface Serial0/0
description Connected to Frame-Relay Network
ip address 192.168.4.2 255.255.255.0
encapsulation frame-relay IETF
ip ospf network point-to-multipoint
serial restart-delay 0
!
interface Serial0/0
description Connected to Frame-Relay Network
ip address 192.168.4.2 255.255.255.0
encapsulation frame-relay IETF
ip ospf network point-to-multipoint
serial restart-delay 0
!
router ospf 1
router-id 7.7.7.7
log-adjacency-changes
network 192.168.4.0 0.0.0.255 area 0
!
router-id 7.7.7.7
log-adjacency-changes
network 192.168.4.0 0.0.0.255 area 0
!
8.路由器R8:
!
interface Serial0/0
description Connected to Frame-Relay Network
ip address 192.168.4.3 255.255.255.0
encapsulation frame-relay IETF
ip ospf network point-to-multipoint
serial restart-delay 0
!
interface Serial0/0
description Connected to Frame-Relay Network
ip address 192.168.4.3 255.255.255.0
encapsulation frame-relay IETF
ip ospf network point-to-multipoint
serial restart-delay 0
!
router ospf 1
router-id 8.8.8.8
log-adjacency-changes
network 192.168.4.0 0.0.0.255 area 0
!
router-id 8.8.8.8
log-adjacency-changes
network 192.168.4.0 0.0.0.255 area 0
!
五、验证(里面包含很多的内容,大家可以在每台路由器上敲敲这些命令,好好研究一下)
1.查看邻居 sh ip ospf neighbor
2.查看OSPF接口信息
3.查看OSPF LSDB
同一区域内的路由器,所看到的网络视图是一样的。
还有一个比较好玩的命令show ip ospf database network,大家可以更直观的获得有用信息。
4.查看路由表 show ip route
本次实验结束:
OSPF在帧中继这种NBMA环境中的配置还是比较复杂的,大家如果在实验中遇到麻烦,可以查看一下链接帧中继的串行接口/子接口的网络类型,然后确定解决方案(比如,是不是需要定义邻居等等)。
大家在做实验的时候可以把R1和R2之间的链路用串行线连接,这个实验就更完美了。
本文转自 tiger506 51CTO博客,原文链接:http://blog.51cto.com/tiger506/169290,如需转载请自行联系原作者