一、场景设置
 
      R1、R2、R3通过Frame-relay相连,形成hub and spoke网络,R1hub路由器,在R1、R2、R3上启用OSPF
 
二、具体配置
 
1、R1的配置如下:
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Router(config)#hostname R1

R1(config)#interface Loopback0

R1(config-if)#ip address 100.100.100.100 255.255.255.0

R1(config-if)#ip ospf network point-to-point

R1(config-if)#exit

R1(config)#interface Loopback1

R1(config-if)#ip address 192.168.1.1 255.255.255.0

R1(config-if)#ip ospf network point-to-point

R1(config-if)#exit

R1(config)#interface Seria0/0

R1(config-if)#ip address 199.99.1.1 255.255.255.0

R1(config-if)#encapsulation frame-relay

R1(config-if)#frame-relay map ip 199.99.1.1 102 broadcast

R1(config-if)#frame-relay map ip 199.99.1.2 102 broadcast

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

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

R1(config-if)#no shutdown

R1(config-if)#exit

R1(config)#router ospf 1

R1(config-router)#router-id 100.100.100.100

R1(config-router)#log-adjacency-changes

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

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

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

R1(config-router)#neighbor 199.99.1.2

R1(config-router)#neighbor 199.99.1.3

R1(config-router)#exit
 
2、R2的配置如下:
Router(config)#hostname R2

R2(config)#interface Loopback0

R2(config-if)#ip address 2.2.2.2 255.255.255.0

R2(config-if)#ip ospf network point-to-point

R2(config-if)#exit

R2(config)#interface Loopback1

R2(config-if)#ip address 192.168.2.1 255.255.255.0

R2(config-if)#ip ospf network point-to-point

R2(config-if)#exit

R2(config)#interface Serial1/0

R2(config-if)#ip address 199.99.1.2 255.255.255.0

R2(config-if)#encapsulation frame-relay

R2(config-if)#serial restart-delay 0

R2(config-if)#frame-relay map ip 199.99.1.1 201 broadcast

R2(config-if)#frame-relay map ip 199.99.1.3 201 broadcast

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

R2(config-if)#no shutdown

R2(config-if)#exit

R2(config)#router ospf 1

R2(config-router)#router-id 2.2.2.2

R2(config-router)#log-adjacency-changes

R2(config-router)#network 2.2.2.0 0.0.0.255 area 0

R2(config-router)#network 192.168.2.0 0.0.0.255 area 0

R2(config-router)#network 199.99.1.0 0.0.0.255 area 0

R2(config-router)#neighbor 199.99.1.1

R2(config-router)#exit

 

3、R3的配置如下:
Router(config)#hostname R3

R3(config)#interface Loopback0

R3(config-if)#ip address 3.3.3.3 255.255.255.0

R3(config-if)#ip ospf network point-to-point

R3(config-if)#exit

R3(config)#interface Loopback1

R3(config-if)#ip address 192.168.3.1 255.255.255.0

R3(config-if)#ip ospf network point-to-point

R3(config-if)#exit

R3(config)#interface Serial1/0

R3(config-if)#ip address 199.99.1.3 255.255.255.0

R3(config-if)#encapsulation frame-relay

R3(config-if)#serial restart-delay 0

R3(config-if)#frame-relay map ip 199.99.1.1 301 broadcast

R3(config-if)#frame-relay map ip 199.99.1.2 301 broadcast

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

R3(config-if)#no shutdown

R3(config-if)#exit

R3(config)#router ospf 1

R2(config-router)#router-id 3.3.3.3

R2(config-router)#log-adjacency-changes

R2(config-router)#network 3.3.3.0 0.0.0.255 area 0

R2(config-router)#network 192.168.3.0 0.0.0.255 area 0

R2(config-router)#network 199.99.1.0 0.0.0.255 area 0

R2(config-router)#neighbor 199.99.1.1
R2(config-router)#exit
 
###NBMA环境下,邻居关系是不会自动建立的,所以要手动添加邻居,这样在建立邻居关系的时候发送的不是组播,而是单播。
 
三、验证配置:
 
1、使用show ip ospf interface 查看接口:

R1#show ip ospf interface

Loopback0 is up, line protocol is up

  Internet Address 100.100.100.100/24, Area 0

  Process ID 1, Router ID 100.100.100.100, Network Type POINT_TO_POINT, Cost: 1

  Transmit Delay is 1 sec, State POINT_TO_POINT,

  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5

    oob-resync timeout 40

  Supports Link-local Signaling (LLS)

  Index 3/3, flood queue length 0

  Next 0x0(0)/0x0(0)

  Last flood scan length is 0, maximum is 0

  Last flood scan time is 0 msec, maximum is 0 msec

  Neighbor Count is 0, Adjacent neighbor count is 0

  Suppress hello for 0 neighbor(s)

Loopback1 is up, line protocol is up

  Internet Address 192.168.1.1/24, Area 0

  Process ID 1, Router ID 100.100.100.100, Network Type POINT_TO_POINT, Cost: 1

  Transmit Delay is 1 sec, State POINT_TO_POINT,

  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5

    oob-resync timeout 40

  Supports Link-local Signaling (LLS)

  Index 2/2, flood queue length 0

  Next 0x0(0)/0x0(0)

  Last flood scan length is 0, maximum is 0

  Last flood scan time is 0 msec, maximum is 0 msec

  Neighbor Count is 0, Adjacent neighbor count is 0

  Suppress hello for 0 neighbor(s)

Serial1/0 is up, line protocol is up

  Internet Address 199.99.1.1/24, Area 0

  Process ID 1, Router ID 100.100.100.100, Network Type NON_BROADCAST, Cost: 64

  Transmit Delay is 1 sec, <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />
State DR
, Priority 1

  Designated Router (ID) 100.100.100.100, Interface address 199.99.1.1              #DR和BDR的选举!

  Backup Designated router (ID) 3.3.3.3, Interface address 199.99.1.3

  Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5

    oob-resync timeout 120

    Hello due in 00:00:28

  Supports Link-local Signaling (LLS)

  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 4 msec

  Neighbor Count is 2, Adjacent neighbor count is 2

    Adjacent with neighbor 2.2.2.2

    Adjacent with neighbor 3.3.3.3  (Backup Designated Router)

  Suppress hello for 0 neighbor(s)

 

R2#show ip ospf interface

Loopback0 is up, line protocol is up

  Internet Address 2.2.2.2/24, Area 0

  Process ID 1, Router ID 2.2.2.2, Network Type POINT_TO_POINT, Cost: 1

  Transmit Delay is 1 sec, State POINT_TO_POINT,

  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5

    oob-resync timeout 40

  Supports Link-local Signaling (LLS)

  Index 3/3, flood queue length 0

  Next 0x0(0)/0x0(0)

  Last flood scan length is 0, maximum is 0

  Last flood scan time is 0 msec, maximum is 0 msec

  Neighbor Count is 0, Adjacent neighbor count is 0

  Suppress hello for 0 neighbor(s)

Loopback1 is up, line protocol is up

  Internet Address 192.168.2.1/24, Area 0

  Process ID 1, Router ID 2.2.2.2, Network Type POINT_TO_POINT, Cost: 1

  Transmit Delay is 1 sec, State POINT_TO_POINT,

  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5

    oob-resync timeout 40

  Supports Link-local Signaling (LLS)

  Index 2/2, flood queue length 0

  Next 0x0(0)/0x0(0)

  Last flood scan length is 0, maximum is 0

  Last flood scan time is 0 msec, maximum is 0 msec

  Neighbor Count is 0, Adjacent neighbor count is 0

  Suppress hello for 0 neighbor(s)

Serial1/0 is up, line protocol is up

  Internet Address 199.99.1.2/24, Area 0

  Process ID 1, Router ID 2.2.2.2, Network Type NON_BROADCAST, Cost: 64

  Transmit Delay is 1 sec, State BDR, Priority 1

  Designated Router (ID) 100.100.100.100, Interface address 199.99.1.1             #DR和BDR的选举!

  Backup Designated router (ID) 2.2.2.2, Interface address 199.99.1.2

  Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5

    oob-resync timeout 120

    Hello due in 00:00:03

  Supports Link-local Signaling (LLS)

  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 100.100.100.100  (Designated Router)

  Suppress hello for 0 neighbor(s)

 

R3#show ip ospf interface

Loopback0 is up, line protocol is up

  Internet Address 3.3.3.3/24, Area 0

  Process ID 1, Router ID 3.3.3.3, Network Type POINT_TO_POINT, Cost: 1

  Transmit Delay is 1 sec, State POINT_TO_POINT,

  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5

    oob-resync timeout 40

  Supports Link-local Signaling (LLS)

  Index 3/3, flood queue length 0

  Next 0x0(0)/0x0(0)

  Last flood scan length is 0, maximum is 0

  Last flood scan time is 0 msec, maximum is 0 msec

  Neighbor Count is 0, Adjacent neighbor count is 0

  Suppress hello for 0 neighbor(s)

Loopback1 is up, line protocol is up

  Internet Address 192.168.3.1/24, Area 0

  Process ID 1, Router ID 3.3.3.3, Network Type POINT_TO_POINT, Cost: 1

  Transmit Delay is 1 sec, State POINT_TO_POINT,

  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5

    oob-resync timeout 40

  Supports Link-local Signaling (LLS)

  Index 2/2, flood queue length 0

  Next 0x0(0)/0x0(0)

  Last flood scan length is 0, maximum is 0

  Last flood scan time is 0 msec, maximum is 0 msec

  Neighbor Count is 0, Adjacent neighbor count is 0

  Suppress hello for 0 neighbor(s)

Serial1/0 is up, line protocol is up

  Internet Address 199.99.1.3/24, Area 0

  Process ID 1, Router ID 3.3.3.3, Network Type NON_BROADCAST, Cost: 64

  Transmit Delay is 1 sec, State BDR, Priority 1

  Designated Router (ID) 100.100.100.100, Interface address 199.99.1.1        #DR和BDR的选举!

  Backup Designated router (ID) 3.3.3.3, Interface address 199.99.1.3

  Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5

    oob-resync timeout 120

    Hello due in 00:00:25

  Supports Link-local Signaling (LLS)

  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 100.100.100.100  (Designated Router)

  Suppress hello for 0 neighbor(s)

 
2、使用show ip ospf nerghbor 查看邻居关系:
R1#show ip ospf neighbor

 

Neighbor ID     Pri   State           Dead Time   Address         Interface

2.2.2.2           1   FULL/DROTHER    00:01:50    199.99.1.2      Serial1/0

3.3.3.3           1   FULL/BDR        00:01:47    199.99.1.3      Serial1/0

 

 

R2#show ip ospf neighbor

 

Neighbor ID     Pri   State           Dead Time   Address         Interface

100.100.100.100   1   FULL/DR         00:01:38    199.99.1.1      Serial1/0

 

 

R3#show ip ospf neighbor

 

Neighbor ID     Pri   State           Dead Time   Address         Interface

100.100.100.100   1   FULL/DR         00:01:33    199.99.1.1      Serial1/0
 
###可以发现有DR/BDR的选举!
 
3、使用show ip route ospf 查看路由表:
R1#show ip route ospf
O       2.2.2.0 [110/65] via 199.99.1.2, 00:01:40, Serial1/0

O       3.3.3.0 [110/65] via 199.99.1.3, 00:01:40, Serial1/0

O    192.168.2.0/24 [110/65] via 199.99.1.2, 00:01:40, Serial1/0

O    192.168.3.0/24 [110/65] via 199.99.1.3, 00:01:40, Serial1/0

 

R2#show ip route ospf
O       100.100.100.0 [110/65] via 199.99.1.1, 00:01:45, Serial1/0

O       3.3.3.0 [110/65] via 199.99.1.3, 00:01:45, Serial1/0

O    192.168.1.0/24 [110/65] via 199.99.1.1, 00:01:45, Serial1/0

O    192.168.3.0/24 [110/65] via 199.99.1.3, 00:01:45, Serial1/0

 

R3#show ip route ospf
O       2.2.2.0 [110/65] via 199.99.1.2, 00:01:41, Serial1/0

O       100.100.100.0 [110/65] via 199.99.1.1, 00:01:41, Serial1/0

O    192.168.1.0/24 [110/65] via 199.99.1.1, 00:01:41, Serial1/0

O    192.168.2.0/24 [110/65] via 199.99.1.2, 00:01:41, Serial1/0
 
总结:NBMA环境下面,接口默认的网络类型为NBMA,邻居关系不会自动建立,需要手动添加邻居,并且有DR/BDR的选举,默认的HELLO时间间隔为30秒,等待时间和死亡时间为HELLO时间间隔的4倍,120秒。