OSPF实验3OSPF over NBMA下的五种网络类型 (转载)
实验等级:Professional
 
实验拓扑:
OSPF实验3:OSPF over NBMA下的五种网络类型(转载)_职场
实验基本配置:
1.       首先将R1配置成为帧中继交换机:
frame-relay switching
!
interface Serial1/0
 no ip address
 encapsulation frame-relay
 clock rate 64000
 frame-relay lmi-type ansi
 frame-relay intf-type dce
 frame-relay route 101 interface Serial1/1 102
!
interface Serial1/1
 no ip address
 encapsulation frame-relay
 clock rate 64000
 frame-relay lmi-type ansi
 frame-relay intf-type dce
     frame-relay route 102 interface Serial1/0 101
2.       R2R3的基本配置:
 
R2
interface Loopback0
 ip address 2.2.2.2 255.255.255.0
!        
interface Serial1/0
 ip address 12.1.1.2 255.255.255.0
 encapsulation frame-relay
 serial restart-delay 0
 frame-relay map ip 12.1.1.3 101 broadcast
 no frame-relay inverse-arp
!
router ospf 10
 router-id 2.2.2.2
 log-adjacency-changes
 network 2.2.2.0 0.0.0.255 area 0
 network 12.1.1.0 0.0.0.255 area 0
 
R3
interface Loopback0
 ip address 3.3.3.3 255.255.255.0
!
interface Serial1/1
 ip address 12.1.1.3 255.255.255.0
 encapsulation frame-relay
 serial restart-delay 0
 frame-relay map ip 12.1.1.2 102 broadcast
 no frame-relay inverse-arp
!
router ospf 10
 router-id 3.3.3.3
 log-adjacency-changes
 network 3.3.3.0 0.0.0.255 area 0
     network 12.1.1.0 0.0.0.255 area 0
Type1----Non_Broadcast(默认)
 
我们在R2show ip ospf neighbor发现没有邻居说明在这种情况下邻居需要手动配置!配置如下:
R2
  R2(config)#router ospf 10
R2(config-router)#neighbor 12.1.1.3
R3
R3(config)#router ospf 10
R3(config-router)#neighbor 12.1.1.2
此时在R2上查看邻居:
R2#sho ip ospf nei
 
Neighbor ID     Pri   State           Dead Time   Address         Interface
3.3.3.3           1   FULL/DR         00:01:46    12.1.1.3        Serial1/0
发现邻居已经形成并且有DRBDR的选举!
R2上查看接口
R2#show ip ospf interface
Serial1/0 is up, line protocol is up
  Internet Address 12.1.1.2/24, Area 0
  Process ID 10, Router ID 2.2.2.2, Network Type NON_BROADCAST, Cost: 64
  Transmit Delay is 1 sec, State BDR, Priority 1
  Designated Router (ID) 3.3.3.3, Interface address 12.1.1.3
  Backup Designated router (ID) 2.2.2.2, Interface address 12.1.1.2
  Flush timer for old DR LSA due in 00:01:40
  Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5
在这种网络类型中,hello的间隔是30s
打开debug信息,我们可以看到在这种网络类型中,OSPF的数据包是单播传送的。
R2#
*Aug 14 14:52:52.819: OSPF: Send hello to 12.1.1.3 area 0 on Serial1/0 from 12.1.1.2
R2#
*Aug 14 14:52:57.087: OSPF: Rcv hello from 3.3.3.3 area 0 from Serial1/0 12.1.1.3
*Aug 14 14:52:57.091: OSPF: End of hello processing
Type2---- Broadcast
首先去掉刚才手动配置的邻居关系:
R2(config)#router ospf 10
R2(config-router)#no neighbor 12.1.1.3 
R3(config)#router ospf 10
R3(config-router)#no neighbor 12.1.1.2
R2R3接口的网络类型改成broadcast
R2(config-router)#int s1/0
R2(config-if)#ip ospf network broadcast
R3(config-router)#int s1/1
R3(config-if)#ip ospf network broadcast
一会我们就看到了如下信息
R3#
*Aug 14 14:59:52.823: %OSPF-5-ADJCHG: Process 10, Nbr 2.2.2.2 on Serial1/1 from LOADING to FULL, Loading Done
这说明了在这种网络类型下是不需要手动配置邻居关系的!
R2#show ip ospf nei
 
Neighbor ID     Pri   State           Dead Time   Address         Interface
3.3.3.3           1   FULL/DR         00:00:39    12.1.1.3        Serial1/0
DRBDR的选举
R2#sho ip ospf int
Serial1/0 is up, line protocol is up
  Internet Address 12.1.1.2/24, Area 0
  Process ID 10, Router ID 2.2.2.2, Network Type BROADCAST, Cost: 64
  Transmit Delay is 1 sec, State BDR, Priority 1
  Designated Router (ID) 3.3.3.3, Interface address 12.1.1.3
  Backup Designated router (ID) 2.2.2.2, Interface address 12.1.1.2
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
 Hello时间间隔为10s
R2#
*Aug 14 15:02:20.443: OSPF: Send hello to 224.0.0.5 area 0 on Serial1/0 from 12.1.1.2
*Aug 14 15:02:20.959: OSPF: Rcv hello from 3.3.3.3 area 0 from Serial1/0 12.1.1.3
*Aug 14 15:02:20.963: OSPF: End of hello processing
使用224.0.0.5这个组播地址传送数据包。
Type3---- Point-to-Point
R2R3接口的网络类型改成Point-to-Point
R2(config-if)#ip ospf net point-to-point
R3(config-if)#ip ospf net point-to-point
很快我们就可以看到如下信息
R3(config-if)#
*Aug 14 15:06:07.559: %OSPF-5-ADJCHG: Process 10, Nbr 2.2.2.2 on Serial1/1 from LOADING to FULL, Loading Done
说明这种网络类型也不需要手动指定邻居
R2#sho ip ospf nei
 
Neighbor ID     Pri   State           Dead Time   Address         Interface
3.3.3.3           0   FULL/  -        00:00:37    12.1.1.3        Serial1/0
没有DR/BDR的选举
R2#sh ip ospf int
Serial1/0 is up, line protocol is up
  Internet Address 12.1.1.2/24, Area 0
  Process ID 10, Router ID 2.2.2.2, Network Type POINT_TO_POINT, Cost: 64
  Transmit Delay is 1 sec, State POINT_TO_POINT,
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello时间间隔为10s
R2#
*Aug 14 15:08:25.311: OSPF: Send hello to 224.0.0.5 area 0 on Serial1/0 from 12.1.1.2
R2#
*Aug 14 15:08:30.259: OSPF: Rcv hello from 3.3.3.3 area 0 from Serial1/0 12.1.1.3
*Aug 14 15:08:30.263: OSPF: End of hello processing
同样也是使用224.0.0.5这个组播地址传送数据。
Type4---- Point-to-Multipoint
将接口改为Point-to-Multipoint
R2(config-if)#ip ospf network point-to-multipoint
R3(config-if)#ip ospf network point-to-multipoint
*Aug 14 15:10:51.739: %OSPF-5-ADJCHG: Process 10, Nbr 2.2.2.2 on Serial1/1 from LOADING to FULL, Loading Done
同样也不需要手动指定邻居
R2#sho ip ospf nei
 
Neighbor ID     Pri   State           Dead Time   Address         Interface
3.3.3.3           0   FULL/  -        00:01:48    12.1.1.3        Serial1/0
没有DRBDR的选举
R2#sho ip ospf int
Serial1/0 is up, line protocol is up
  Internet Address 12.1.1.2/24, Area 0
  Process ID 10, Router ID 2.2.2.2, Network Type POINT_TO_MULTIPOINT, Cost: 64
  Transmit Delay is 1 sec, State POINT_TO_MULTIPOINT,
  Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5
Hello时间间隔为30s
R2#
*Aug 14 15:12:49.759: OSPF: Send hello to 224.0.0.5 area 0 on Serial1/0 from 12.1.1.2
R2#
*Aug 14 15:12:57.443: OSPF: Rcv hello from 3.3.3.3 area 0 from Serial1/0 12.1.1.3
*Aug 14 15:12:57.447: OSPF: End of hello processing
224.0.0.5这个组播地址发送数据
Type5---- Point-to-MultipointNon_Broadcast
改变接口类型为Point-to-Multipoint(Non_Broadcast)
R2(config-if)#ip ospf network point-to-multipoint non-broadcast
R3(config-if)#ip ospf network point-to-multipoint non-broadcast
这个时候邻居没有被自动发现。我们在R2上手动指定邻居
R2(config-if)#router ospf 10
R2(config-router)#neighbor 12.1.1.3
R2(config-router)#
*Aug 14 15:18:38.955: %OSPF-5-ADJCHG: Process 10, Nbr 3.3.3.3 on Serial1/0 from LOADING to FULL, Loading Done
邻居只要在一边指定即可。说明在这种网络类型下邻居需要手动指定。
R2#sho ip ospf nei
 
Neighbor ID     Pri   State           Dead Time   Address         Interface
3.3.3.3           0   FULL/  -        00:01:57    12.1.1.3        Serial1/0
同样没有DRBDR的选取
R2#sho ip ospf int
Serial1/0 is up, line protocol is up
  Internet Address 12.1.1.2/24, Area 0
  Process ID 10, Router ID 2.2.2.2, Network Type POINT_TO_MULTIPOINT, Cost: 64
  Transmit Delay is 1 sec, State POINT_TO_MULTIPOINT,
  Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5
Hello时间间隔为30s
R2#
*Aug 14 15:21:03.099: OSPF: Send hello to 12.1.1.3 area 0 on Serial1/0 from 12.1.1.2
*Aug 14 15:21:03.295: OSPF: Rcv hello from 3.3.3.3 area 0 from Serial1/0 12.1.1.3
*Aug 14 15:21:03.299: OSPF: End of hello processing
使用单播传送OSPF数据
 
 
总结:在NBMA网络下5种网络类型具体情况如下表所示:
网络类型
邻居自动发现
有无DR选举
Hello间隔
传输方式
Non_broadcast
30s
单播
Broadcast
10s
组播
Point-to-Point
10s
组播
Point-to-Multipoint
30s
组播
Point-to-Multipoint(非广播)
30s
单播