为什么OSPF路由器没有邻居?

网络工程 思科 路由器 ospf
2022-03-03 05:45:31

我在 Cisco Packet Tracer 中有两个路由器:

在此处输入图像描述

Router2-1、Router2-2、Router2-3 都有自己的环回 0,IP 地址1.1.1.1为 , 2.2.2.2, 3.3.3.3.

我只在Router2-1的Gig0/0/0端口启动了OSPF进程,并通告了。

里面有running-config

......
!
router ospf 1
 log-adjacency-changes
 network 0.0.0.0 0.0.0.0 area 0
!
......

没有邻居Router2-1

Router#show ip ospf neighbor 

Router#

从逻辑上讲,Router2-2应该有邻居,为什么没有。


EDIT-01

但是,当我在Router2-2 中启动OSPF 1 后Gig0/0/0,Router2-1 仍然找不到OSPF 邻居。

Router#show ip ospf neighbor 

Router#

并且,在 Router2-2 中running-configuration

...
router ospf 1
 log-adjacency-changes
 network 0.0.0.0 0.0.0.0 area 0
!
...

我怎么知道是哪个界面启动的ospf 1

Router2-1 ospf 数据库:

Router#show ip ospf database 
            OSPF Router with ID (1.1.1.1) (Process ID 1)

                Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1.1         1.1.1.1         34          0x80000001 0x00510c 0

Router2-2 ospf 数据库:

Router#show ip ospf database 
            OSPF Router with ID (2.2.2.2) (Process ID 1)

                Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
2.2.2.2         2.2.2.2         325         0x80000001 0x000550 0

但彼此显示 ospf 邻居都得到空结果。

Router#show ip ospf neighbor 

Router#

EDIT-02

在我的Router2-2中,接口:

Router>show ip interface brief 
Interface              IP-Address      OK? Method Status                Protocol 
GigabitEthernet0/0/0   192.168.1.1     YES manual up                    up 
GigabitEthernet0/0/1   192.168.2.1     YES manual up                    up 
Loopback0              2.2.2.2         YES manual up                    up 
Vlan1                  unassigned      YES unset  administratively down down
3个回答

如果您在路由器的接口上正确配置了 IP 地址,那么您应该一切顺利。但!将OSPF 部分中的网络配置更改为:

router ospf 1
 network 0.0.0.0 255.255.255.255 area 0

OSPF 网络语句使用通配符,而不是网络掩码。

[编辑]

正如Ron Maupin所说,真实设备能够检测用户意图并建立邻居关系network 0.0.0.0 0.0.0.0 area 0

证明:

在此处输入图像描述

interface Loopback0
 ip address 1.1.1.1 255.255.255.255
!
interface FastEthernet0/0
 ip address 10.1.1.1 255.255.255.0
 duplex full
!
router ospf 1
 network 0.0.0.0 255.255.255.255 area 0


R1#sh ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.2           1   FULL/DR         00:00:26    10.1.1.2        FastEthernet0/0


R1#sh ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       + - replicated route, % - next hop override

Gateway of last resort is not set

      1.0.0.0/32 is subnetted, 1 subnets
C        1.1.1.1 is directly connected, Loopback0
      2.0.0.0/32 is subnetted, 1 subnets
O        2.2.2.2 [110/2] via 10.1.1.2, 00:14:28, FastEthernet0/0
      10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        10.1.1.0/24 is directly connected, FastEthernet0/0
L        10.1.1.1/32 is directly connected, FastEthernet0/0

PacketTracer无法识别情况:

在此处输入图像描述

R2#sh ip ospf neighbor 

R2#

OSPF 是一种路由协议,即。参与 OSPF的路由器使用它来交换它们的路由和链路状态。如果网络中只有一个路由器配置为使用 OSPF,则没有邻居。

网络 0.0.0.0 255.255.255.255 区域 0