实验拓扑:
 

实验步骤:
配置 FR 帧中继:
FR(config)# frame-relay switching
FR(config)#in
FR(config)#interface s1/2
FR(config-if)#encapsulation frame-relay
FR(config-if)#frame-relay intf-type dce
FR(config-if)#
FR(config-if)#
FR(config-if)#frame-relay route 102 interface s1/3 201
FR(config-if)#
00:04:22: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/2, changed state to down
FR(config-if)#exit
FR(config)#in
FR(config)#interface s1/3
FR(config-if)#no shu
FR(config-if)#encapsulation frame-relay
FR(config-if)#frame-relay intf-type dce
FR(config-if)#frame-relay route 201 interface s1/2 102
FR(config-if)#exit
00:05:35: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/3, changed state to down
FR(config)#
 
R2 R3 的配置:
R2(config)#interface s1/2
R2(config-if)#no shu
00:07:02: %LINK-3-UPDOWN: Interface Serial1/2, changed state to up
00:07:03: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/2, changed state to up
R2(config-if)#ip add 21.1.1.1 255.255.255.0
R2(config-if)#
R2(config-if)#encapsulation frame-relay
R2(config-if)#no frame-relay inverse-arp
R2(config-if)#frame-relay map ip 21.1.1.2 102 b
R2(config-if)#exit
R2(config)#in
R2(config)#interface lo0
R2(config-if)#ip add 2.2.2.2 255.255.255.0
R2(config-if)#exit
R2(config)#
R2(config)#router os 100
R2(config-router)#router   
R2(config-router)#router-id 2.2.2.2
R2(config-router)#net 21.1.1.0 0.0.0.255 a 8
R2(config-router)#net
R2(config-router)#network 2.2.2.0 0.0.0.255 a 8
R2(config-router)#exit
 
 
R3(config)#interface s1/3
R3(config-if)#no shu
R3(config-if)#
R3(config-if)#ip add 21.1.1.2 255.255.255.0
R3(config-if)#
00:08:32: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/3, changed state to down
R3(config-if)#encapsulation frame-relay
R3(config-if)#no frame-relay inverse-arp
R3(config-if)#frame-relay map ip 21.1.1.1 201 b
R3(config-if)#exit
R3(config)#interface lo0
R3(config-if)#ip add 3.3.3.3 255.255.255.0
R3(config-if)#exit
R3(config)#router os 100
R3(config-router)#router
R3(config-router)#router-id 3.3.3.3
R3(config-router)#net 3.3.3.0 0.0.0.255 a 8
R3(config-router)#net 21.1.1.0 0.0.0.255 a 8
R3(config-router)#exit
 
第一种默认为: Non_Broadcast
R2 show ip ospf neighbor ,发现没有邻居。说明在这种情况下邻居需要手动配置!配置如下:
R2(config)#router os 100
R2(config-router)#ne
R2(config-router)#nei
R2(config-router)#neighbor 21.1.1.2
R2(config-router)#exit
 
 
R3(config)#router os 100
R3(config-router)#nei
R3(config-router)#neighbor 21.1.1.1
00:18:02: %OSPF-5-ADJCHG: Process 100, Nbr 2.2.2.2 on Serial1/3 from LOADING to FULL, Loading Done
R3(config-router)#neighbor 21.1.1.1
R3(config-router)#exit

发现有DR和BDR的选举,DR为R3
R3(config)#
R3(config)#exit
 
R2#show ip ospf nei
 
Neighbor ID     Pri   State           Dead Time   Address         Interface
3.3.3.3           1   FULL/DR         00:01:49    21.1.1.2        Serial1/2
 
 
R2# show ip ospf interface
Loopback0 is up, line protocol is up
 Internet Address 2.2.2.2/24, Area 8

 

                                                                      默认情况
 Process ID 100, Router ID 2.2.2.2, Network Type LOOPBACK, Cost: 1
 Loopback interface is treated as a stub Host
Serial1/2 is up, line protocol is up
 Internet Address 21.1.1.1/24, Area 8
 Process ID 100, 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 21.1.1.2
 Backup Designated router (ID) 2.2.2.2, Interface address 21.1.1.1
 Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5
    Hello due in 00:00:04
 Index 1/1, flood queue length 0
 Next 0x0(0)/0x0(0)
 Last flood scan length is 1, maximum is 1
 Last flood scan time is 0 msec, maximum is 0 msec
 Neighbor Count is 1, Adjacent neighbor count is 1
    Adjacent with neighbor 3.3.3.3 (Designated Router)
 Suppress hello for 0 neighbor(s)
 
第二种 Point-to-Multipoint Non_Broadcast
R2 R3 上修改类型:
R2(config)#interface s1/2
R2(config-if) #ip ospf network point-to-multipoint non-broadcast
 
R3(config)#interface s1/3
R3(config-if)# ip ospf network point-to-multipoint non-broadcast

 
  R2#show ip ospf nei

Neighbor ID     Pri   State           Dead Time   Address         Interface

3.3.3.3           1   FULL/ -        00:01:45    21.1.1.2        Serial1/2
 这 种类型也需手动指定邻居,但没有DR和BDR的选举
R2 #show ip ospf interface
Serial1/2 is up, line protocol is up
  Internet Address 21.1.1.1/24, Area 8
 Process ID 100, 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 due in 00:00:00
 Index 1/1, flood queue length 0
 Next 0x0(0)/0x0(0)
 Last flood scan length is 1, maximum is 1
 Last flood scan time is 0 msec, maximum is 0 msec
 Neighbor Count is 1, Adjacent neighbor count is 1
    Adjacent with neighbor 3.3.3.3
 Suppress hello for 0 neighbor(s)
Loopback0 is up, line protocol is up
 Internet Address 2.2.2.2/24, Area 8
 Process ID 100, Router ID 2.2.2.2, Network Type LOOPBACK, Cost: 1
 Loopback interface is treated as a stub Host
 
第三种 广播 (broadcast)
 
删除 R2 R3 上的邻居,并修改网络类型为 broadcast
R2(config)#router ospf 100

说明广播型不要手动指定邻居,会自动学习。
R2(config-router) #no neighbor 21.1.1.2
R2(config)#interface s1/2
R2(config-if)# ip ospf network broadcast
R2(config)#
R2(config)#
00:48:26: %OSPF-5-ADJCHG: Process 100, Nbr 3.3.3.3 on Serial1/2 from LOADING to FULL, Loading Done
R2(config)#
 
R3(config)#router ospf 100
R3(config-router)# no neighbor 21.1.1.1
R3(config-router)#exit
R3(config)#interface s1/3
R3(config-if) #ip ospf network broadcast
R3(config-if)#
00:45:56: %OSPF-5-ADJCHG: Process 100, Nbr 2.2.2.2 on Serial1/3 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/BDR         00:00:33    21.1.1.2        Serial1/2

有DR和BDR的选举
  R2#show ip ospf in
R2#show ip ospf interface
Serial1/2 is up, line protocol is up
 Internet Address 21.1.1.1/24, Area 8
 Process ID 100, Router ID 2.2.2.2, Network Type BROADCAST, Cost: 64
  Transmit Delay is 1 sec, State DR, Priority 1
 Designated Router (ID) 2.2.2.2, Interface address 21.1.1.1
 Backup Designated router (ID) 3.3.3.3, Interface address 21.1.1.2
 Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    Hello due in 00:00:00
 Index 1/1, flood queue length 0
 Next 0x0(0)/0x0(0)
 Last flood scan length is 1, maximum is 1
 Last flood scan time is 0 msec, maximum is 0 msec
 Neighbor Count is 1, Adjacent neighbor count is 1
    Adjacent with neighbor 3.3.3.3 (Backup Designated Router)
 Suppress hello for 0 neighbor(s)
Loopback0 is up, line protocol is up
 Internet Address 2.2.2.2/24, Area 8
 Process ID 100, Router ID 2.2.2.2, Network Type LOOPBACK, Cost: 1
 Loopback interface is treated as a stub Host
 
第四种 Point-to-Point
R2 R3 上修改网络类型为 Point-to-Point
R3(config)#interface s1/3
R3(config-if)#ip ospf network point-to-p
 
R2(config)#interface s1/2
R2(config-if)#ip ospf network point-to-point
  查看
R2#show ip ospf nei
 
Neighbor ID     Pri   State           Dead Time   Address         Interface

说明这种类型不需要手动指定邻居,但没有DR和BDR的选举
3.3.3.3           1   FULL/ -        00:00:38    21.1.1.2        Serial1/2
R2#show ip ospf in
R2#show ip ospf interface
Serial1/2 is up, line protocol is up
 Internet Address 21.1.1.1/24, Area 8
 Process ID 100, 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 due in 00:00:01
 Index 1/1, flood queue length 0
 Next 0x0(0)/0x0(0)
 Last flood scan length is 1, maximum is 1
 Last flood scan time is 0 msec, maximum is 0 msec
 Neighbor Count is 1, Adjacent neighbor count is 1
    Adjacent with neighbor 3.3.3.3
 Suppress hello for 0 neighbor(s)
Loopback0 is up, line protocol is up
 Internet Address 2.2.2.2/24, Area 8
 Process ID 100, Router ID 2.2.2.2, Network Type LOOPBACK, Cost: 1
 Loopback interface is treated as a stub Host
 
第五种 Point-to-Multipoint
R2 R3 上修改网络类型为 Point-to-Multipoint
R2(config)#interface s1/2
R2(config-if) #ip ospf network point-to-multipoint
R2(config-if)#
R2(config-if)#
01:08:23: %OSPF-5-ADJCHG: Process 100, Nbr 3.3.3.3 on Serial1/2 from LOADING to FULL, Loading Done
 

说明不需手动指定邻居。
R3(config)#interface s1/3
R3(config-if) #ip ospf network point-to-multipoint
R3(config-if)#
R3(config-if)#
01:05:52: %OSPF-5-ADJCHG: Process 100, Nbr 2.2.2.2 on Serial1/3 from LOADING to FULL, Loading Done
 

没有DR 和BDR的选举
R2 上查看
R2#show ip ospf nei
 
Neighbor ID     Pri   State           Dead Time   Address         Interface
3.3.3.3           1   FULL/ -        00:01:35    21.1.1.2        Serial1/2
R2#show ip ospf in
R2#show ip ospf interface
Serial1/2 is up, line protocol is up
 Internet Address 21.1.1.1/24, Area 8
 Process ID 100, Router ID 2.2.2.2, Network Type POINT_TO_MULTIPOIN T, Cost: 64
 Transmit Delay is 1 sec, State POINT_TO_MULTIPOINT,
 Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5
    Hello due in 00:00:25
 Index 1/1, flood queue length 0
 Next 0x0(0)/0x0(0)
 Last flood scan length is 1, maximum is 1
 Last flood scan time is 0 msec, maximum is 0 msec
 Neighbor Count is 1, Adjacent neighbor count is 1
    Adjacent with neighbor 3.3.3.3
 Suppress hello for 0 neighbor(s)
Loopback0 is up, line protocol is up
 Internet Address 2.2.2.2/24, Area 8
 Process ID 100, Router ID 2.2.2.2, Network Type LOOPBACK, Cost: 1
 Loopback interface is treated as a stub Host