OSPF - 默认路由不会被通告到所有区域

网络工程 思科 ospf 数据包追踪器
2021-07-08 07:40:05

我试图找出 R1 在他的路由表中没有由我的 Internet-PAT-Router 传播和生成的默认路由的原因。奇怪的是,R2 实际上有一个默认路由的条目!

如果这是一个很容易找到的非常奇怪的简单错误,我很抱歉,但我就是找不到它(即使经过长时间的谷歌搜索和比较 R1 和 R2)。

我可以这样 ping:

PC -----> R1
R1 -----> ABR
PC --!--> ABR
R1 --!--> Internet (I have simulated the Internet with a simple webserver)
R2 -----> Internet 
Router in the area down below the area 45 -----> Internet 

千兆接口用于配置为被动接口的 LAN 网络。

这是我的网络概述:

在此处输入图片说明

R1的配置:

en
 conf t
 no ip domain-lookup
 ipv6 unicast-routing

 int loopback 0
  ip address 1.1.1.1 255.255.255.255
  exit

 ipv6 router ospf 1
  router-id 1.1.1.1
  auto-cost reference-bandwidth 100000
  passive-interface g0/0
  area 45 range 2001:db8:18:4565::/56
  exit

 router ospf 1
  auto-cost reference-bandwidth 100000
  passive-interface g0/0
  area 45 range 10.45.65.0 255.255.255.0
  exit

 int s0/0/0
  ip address 10.45.0.6 255.255.255.252
  ipv6 address 2001:db8:18:4502::2/64
  ipv6 ospf 1 area 45
  ip ospf 1 area 45
  ip ospf hello-interval 3
  ipv6 ospf hello-interval 3
  no sh

 int g0/0
  ip address 10.45.65.1 255.255.255.0
  ipv6 add 2001:db8:18:4565::1/64
  no sh

  exit

 access-list 100 deny ip any host 224.0.0.5
 access-list 100 deny ip any host 244.0.0.6
 access-list 100 permit ip any any

 int g0/0
  ip access-group 100 in
 exit

R2的配置:

en
 conf t
 no ip domain-lookup
 ipv6 unicast-routing

 int loopback 0
  ip address 1.1.1.1 255.255.255.255
  exit

 ipv6 router ospf 1
  router-id 1.1.1.1
  auto-cost reference-bandwidth 100000
  exit

 router ospf 1
  auto-cost reference-bandwidth 100000
  network 10.45.0.0 0.0.0.3 area 45
  exit

 int s0/0/0
  ip address 10.45.0.2 255.255.255.252
  ipv6 address 2001:db8:18:4501::2/64
  ipv6 ospf 1 area 45
  ip ospf hello-interval 3
  ipv6 ospf hello-interval 3
  no sh

 int g0/0
  ip address 10.45.64.1 255.255.255.0
  ipv6 add 2001:db8:18:4564::1/64
  ipv6 ospf 1 area 45
  ip ospf hello-interval 3
  ipv6 ospf hello-interval 3
  no sh

  exit
  exit

ABR的配置:

en
 conf t
 no ip domain-lookup
 ipv6 unicast-routing

 int loopback 0
  ip address 2.2.1.1 255.255.255.255
  exit

 ipv6 router ospf 1
  area 45 range 2001:db8:18:4500::/56
  auto-cost reference-bandwidth 100000
  router-id 2.2.1.1
  exit

 router ospf 1
  area 45 range 10.45.0.0 255.255.0.0
  area 0 range 10.0.0.0 255.255.0.0
  auto-cost reference-bandwidth 100000
  network 10.45.0.0 0.0.0.255 area 45
  network 10.0.0.0 0.0.0.255 area 0

 int s0/1/0
  ip add 10.45.0.1 255.255.255.252
  ipv6 add 2001:db8:18:4501::1/64
  ipv6 ospf 1 area 45
  ip ospf hello-interval 3
  ipv6 ospf hello-interval 3
  no sh

 int s0/1/1
  ip add 10.45.0.5 255.255.255.252
  ipv6 add 2001:db8:18:4502::1/64
  ipv6 ospf 1 area 45
  ip ospf hello-interval 3
  ipv6 ospf hello-interval 3
  no sh

 int s0/0/0
  ip add 10.0.0.2 255.255.255.252
  ipv6 add 2001:db8:18:0001::2/64
  ipv6 ospf 1 area 0
  ip ospf hello-interval 3
  ipv6 ospf hello-interval 3
  no sh

 int s0/0/1
  ip add 10.0.0.6 255.255.255.252
  ipv6 add 2001:db8:18:0002::2/64
  ipv6 ospf 1 area 0
  ip ospf hello-interval 3
  ipv6 ospf hello-interval 3
  no sh

  exit

这是 ABR 上的“show ip ospf int”命令

Serial0/1/0 is up, line protocol is up
  Internet address is 10.45.0.1/30, Area 45
  Process ID 1, Router ID 2.2.1.1, Network Type POINT-TO-POINT, Cost: 64
  Transmit Delay is 1 sec, State POINT-TO-POINT, Priority 0
  No designated router on this network
  No backup designated router on this network
  Timer intervals configured, Hello 3, Dead 40, Wait 40, Retransmit 5
    Hello due in 00:00:02
  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 1.1.1.1
  Suppress hello for 0 neighbor(s)
Serial0/1/1 is up, line protocol is up
  Internet address is 10.45.0.5/30, Area 45
  Process ID 1, Router ID 2.2.1.1, Network Type POINT-TO-POINT, Cost: 64
  Transmit Delay is 1 sec, State POINT-TO-POINT, Priority 0
  No designated router on this network
  No backup designated router on this network
  Timer intervals configured, Hello 3, Dead 40, Wait 40, Retransmit 5
    Hello due in 00:00:02
  Index 2/2, 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
  Suppress hello for 0 neighbor(s)
Serial0/0/0 is up, line protocol is up
  Internet address is 10.0.0.2/30, Area 0
  Process ID 1, Router ID 2.2.1.1, Network Type POINT-TO-POINT, Cost: 64
  Transmit Delay is 1 sec, State POINT-TO-POINT, Priority 0
  No designated router on this network
  No backup designated router on this network
  Timer intervals configured, Hello 3, Dead 40, Wait 40, Retransmit 5
    Hello due in 00:00:02
  Index 3/3, 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)
Serial0/0/1 is up, line protocol is up
  Internet address is 10.0.0.6/30, Area 0
  Process ID 1, Router ID 2.2.1.1, Network Type POINT-TO-POINT, Cost: 64
  Transmit Delay is 1 sec, State POINT-TO-POINT, Priority 0
  No designated router on this network
  No backup designated router on this network
  Timer intervals configured, Hello 3, Dead 40, Wait 40, Retransmit 5
    Hello due in 00:00:02
  Index 4/4, 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 4.4.4.4
  Suppress hello for 0 neighbor(s)

R1 上的命令没有显示任何内容。

2个回答

1.

第一个问题是您router-id 1.1.1.1为区域 45 中的 R1 和 R2配置了相同的路由器 ID (RID)

所有 OSPF 路由器在整个 OSPF 网络域中都应该具有不同的 RID。

2.

而 PC1 无法到达 ABR(网络中的其他 OSPF 路由器也无法到达 R1 的 g0/0 接口的 IPv4 和 IPv6 地址)的原因是您没有在 R1 的接口 g0/0 上启用 OSPFv2 或 OSPFv3,因此网络中的其他 OSPF 路由器不知道 IPv4 子网 10.45.65.0/24 和 IPv6 网络 2001:DB8:18:4565::/64:

 #On R1#
 !
 ipv6 router ospf 1
  router-id 1.1.1.1
  auto-cost reference-bandwidth 100000
  passive-interface g0/0
  area 45 range 2001:db8:18:4565::/56
  exit
 !
 router ospf 1
  auto-cost reference-bandwidth 100000
  passive-interface g0/0
  area 45 range 10.45.65.0 255.255.255.0
  exit
 !
 int g0/0
  ip address 10.45.65.1 255.255.255.0
  ipv6 add 2001:db8:18:4565::1/64
  no sh

该命令area 45 range ...是对这个范围内更具体的路由/前缀进行汇总,只能在ABR上使用。

要解决此问题,您可以像在接口 s0/0/0 上一样在 R1 的接口 g0/0 上启用 OSPFv2 和/或 OSPFv3:

 int g0/0
  ...
  ...
  ipv6 ospf 1 area 45
  ip ospf 1 area 45
  no sh

最后但并非最不重要的一点是,您需要确保在整个网络中(在必要的接口上)一致地运行 OSPFv2 和/或 OSPFv3。

错误是,我在 R1 和 R2 上配置了相同的路由器 ID,但不起作用!

两个路由器可以具有相同的 touter-id,但不能同时具有相同的邻居!路由器不能通过与两个具有相同路由器 ID 的路由器连接来“执行 OSPF”!

然而,正如@Karl 指出的那样,在两个或多个路由器上配置相同的路由器 ID 始终是一个问题,因为 LSA 包含了广告路由器的路由器 ID。除此之外,可能会出现更多问题。

但是,连接到 R1 的 PC1 仍然无法 ping 通 ABR...