首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >BGP-OSPF路由注入无效

BGP-OSPF路由注入无效
EN

Network Engineering用户
提问于 2021-04-07 10:28:28
回答 3查看 276关注 0票数 0

背景: BGP功能齐全,工作正常,无需担心,问题是HK_Office <> HK2和LON1 <> LON_Office之间的路由注入,正如您在HK_Office和LON_Office下面的“显示ip路由”一节中所看到的那样,它无法看到路由在--例如,在HK_Office中,它不包含到10.10.20.0/24或192.168.20.0/24的路由,反之亦然,我应该如何正确地将这些子网正确地注入到HK_Office和LON_Office中,以便两端都能看到彼此的子网呢?

备注:这实际上是在我的实验室内运行,因为我们必须在现场进行测试;我正在采用快捷方式使用回环接口IP来模仿将来应该注入OSPF/BGP的子网,在生产环境中不应该使用回送接口。我们正在使用BGP中间,因为交通工程,请不要试图提出其他的东西,因为它不在我的控制范围内。

========================

配置部分,

HK_Office:

代码语言:javascript
复制
interface Loopback0
 ip address 10.10.0.1 255.255.255.0
interface Loopback1
 ip address 192.168.10.1 255.255.255.0
interface FastEthernet1/0
 ip address 172.16.0.1 255.255.255.0
 duplex auto
 speed auto
router ospf 10
 log-adjacency-changes
 redistribute connected
 passive-interface default
 no passive-interface FastEthernet1/0
 network 10.10.0.0 0.0.0.255 area 0
 network 172.16.0.0 0.0.0.255 area 0
 network 192.168.10.0 0.0.0.255 area 0

HK2:

代码语言:javascript
复制
interface FastEthernet0/0
 description VIP Network
 ip address 10.0.0.1 255.255.255.0
 duplex auto
 speed auto
interface FastEthernet0/1
 description General network
 ip address 192.168.0.1 255.255.255.0
 duplex auto
 speed auto
interface FastEthernet1/0
 ip address 172.16.0.2 255.255.255.0
 duplex auto
 speed auto

router ospf 10
 log-adjacency-changes
 redistribute connected subnets
 redistribute bgp 64512 metric-type 1 subnets
 passive-interface default
 no passive-interface FastEthernet1/0
 network 172.16.0.0 0.0.0.255 area 0
  redistribute ospf 10

router bgp 64512
 bgp log-neighbor-changes
 neighbor 10.0.0.2 remote-as 64512
 neighbor 192.168.0.2 remote-as 64512
 address-family ipv4
  redistribute connected
  redistribute ospf 10
  neighbor 10.0.0.2 activate
  neighbor 10.0.0.2 next-hop-self
  neighbor 10.0.0.2 route-map VIP_NET out
  neighbor 192.168.0.2 activate
  neighbor 192.168.0.2 next-hop-self
  neighbor 192.168.0.2 route-map General_NET out
  no auto-summary
  no synchronization
  network 10.0.0.0
  network 172.16.0.0
  network 192.168.0.0
 exit-address-family
route-map VIP_NET permit 10
 match ip address prefix-list PREFIX-TO-HK-VIP-NETWORK
 set local-preference 50
route-map VIP_NET permit 20
 match ip address prefix-list PREFIX-TO-HK-GENERAL-NETWORK
 set local-preference 5000
route-map VIP_NET permit 10
 match ip address prefix-list PREFIX-TO-HK-VIP-NETWORK
 set local-preference 5000
route-map VIP_NET permit 20
 match ip address prefix-list PREFIX-TO-HK-GENERAL-NETWORK
 set local-preference 50

LON1:

代码语言:javascript
复制
interface FastEthernet0/0
 description VIP Network
 ip address 10.0.0.2 255.255.255.0
 duplex auto
 speed auto
interface FastEthernet0/1
 description General network
 ip address 192.168.0.2 255.255.255.0
 duplex auto
 speed auto
interface FastEthernet1/0
 ip address 172.16.20.2 255.255.255.0
 duplex auto
 speed auto

router ospf 10
 log-adjacency-changes
 redistribute connected subnets
 redistribute bgp 64512 metric-type 1 subnets
 passive-interface default
 no passive-interface FastEthernet1/0
 network 172.16.20.0 0.0.0.255 area 0
  redistribute ospf 10

router bgp 64512
 bgp log-neighbor-changes
 neighbor 10.0.0.1 remote-as 64512
 neighbor 192.168.0.1 remote-as 64512
 address-family ipv4
  redistribute connected
  redistribute ospf 10
  neighbor 10.0.0.1 activate
  neighbor 10.0.0.1 next-hop-self
  neighbor 10.0.0.1 route-map VIP_NET out
  neighbor 192.168.0.1 activate
  neighbor 192.168.0.1 next-hop-self
  neighbor 192.168.0.1 route-map General_NET out
  no auto-summary
  no synchronization
  network 10.0.0.0
  network 192.168.0.0
 exit-address-family
route-map GENERALNET permit 20
 match ip address prefix-list PREFIX-TO-LON-OFFICE-GENERAL-NETWORK
 set local-preference 5000
!
route-map VIP_NET permit 10
 match ip address prefix-list PREFIX-TO-LON-OFFICE-VIP-NETWORK
 set local-preference 5000
!
route-map VIP_NET permit 20
 match ip address prefix-list PREFIX-TO-LON-OFFICE-GENERAL-NETWORK
 set local-preference 50

LON_Office:

代码语言:javascript
复制
interface Loopback0
 ip address 10.10.20.1 255.255.255.0
interface Loopback1
 ip address 192.168.20.1 255.255.255.0
interface FastEthernet1/0
 ip address 172.16.20.1 255.255.255.0
 duplex auto
 speed auto
router ospf 10
 log-adjacency-changes
 redistribute connected
 passive-interface default
 no passive-interface FastEthernet1/0
 network 10.10.20.0 0.0.0.255 area 0
 network 172.16.20.0 0.0.0.255 area 0
 network 192.168.20.0 0.0.0.255 area 0

========================

“显示ip路线”部分,

HK_Office:

代码语言:javascript
复制
C    192.168.10.0/24 is directly connected, Loopback1
     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.0.0 is directly connected, FastEthernet1/0
     10.0.0.0/24 is subnetted, 2 subnets
C       10.10.0.0 is directly connected, Loopback0
O E2    10.0.0.0 [110/20] via 172.16.0.2, 2d00h, FastEthernet1/0
O E2 192.168.0.0/24 [110/20] via 172.16.0.2, 2d00h, FastEthernet1/0

HK2:

代码语言:javascript
复制
     192.168.10.0/32 is subnetted, 1 subnets
O       192.168.10.1 [110/2] via 172.16.0.1, 2d00h, FastEthernet1/0
     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.0.0 is directly connected, FastEthernet1/0
     192.168.20.0/32 is subnetted, 1 subnets
B       192.168.20.1 [200/2] via 192.168.0.2, 00:33:23
     10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O       10.10.0.1/32 [110/2] via 172.16.0.1, 2d00h, FastEthernet1/0
C       10.0.0.0/24 is directly connected, FastEthernet0/0
B       10.10.20.1/32 [200/2] via 10.0.0.2, 00:33:24
C    192.168.0.0/24 is directly connected, FastEthernet0/1

LON1:

代码语言:javascript
复制
     192.168.10.0/32 is subnetted, 1 subnets
B       192.168.10.1 [200/2] via 192.168.0.1, 00:29:20
     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.20.0 is directly connected, FastEthernet1/0
     192.168.20.0/32 is subnetted, 1 subnets
O       192.168.20.1 [110/2] via 172.16.20.1, 01:28:43, FastEthernet1/0
     10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
B       10.10.0.1/32 [200/2] via 10.0.0.1, 00:29:20
C       10.0.0.0/24 is directly connected, FastEthernet0/0
O       10.10.20.1/32 [110/2] via 172.16.20.1, 01:28:44, FastEthernet1/0
C    192.168.0.0/24 is directly connected, FastEthernet0/1

LON_Office:

代码语言:javascript
复制
     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.20.0 is directly connected, FastEthernet1/0
C    192.168.20.0/24 is directly connected, Loopback1
     10.0.0.0/24 is subnetted, 2 subnets
O E2    10.0.0.0 [110/20] via 172.16.20.2, 00:42:44, FastEthernet1/0
C       10.10.20.0 is directly connected, Loopback0
O E2 192.168.0.0/24 [110/20] via 172.16.20.2, 00:42:44, FastEthernet1/0

==================================================

更新:在我对LON1和HK2路由器做了一些配置更改之后,最终两个办公室都可以从“显示ip路由”中看到这些路由,但是!路由仍然有问题,让我们看看下面..。

HK_Office“显示ip路由”:

代码语言:javascript
复制
C    192.168.10.0/24 is directly connected, Loopback1
     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.0.0 is directly connected, FastEthernet1/0
     192.168.20.0/32 is subnetted, 1 subnets
O E2    192.168.20.1 [110/1] via 172.16.0.2, 00:39:33, FastEthernet1/0
     10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       10.10.0.0/24 is directly connected, Loopback0
O E2    10.10.20.1/32 [110/1] via 172.16.0.2, 00:39:33, FastEthernet1/0
O E2 192.168.0.0/24 [110/1] via 172.16.0.2, 01:43:34, FastEthernet1/0

LON_Office“显示ip路由”:

代码语言:javascript
复制
     192.168.10.0/32 is subnetted, 1 subnets
O E2    192.168.10.1 [110/1] via 172.16.20.2, 00:42:52, FastEthernet1/0
     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.20.0 is directly connected, FastEthernet1/0
C    192.168.20.0/24 is directly connected, Loopback1
     10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
O E2    10.10.0.1/32 [110/1] via 172.16.20.2, 00:42:52, FastEthernet1/0
C       10.10.20.0/24 is directly connected, Loopback0
O E2 192.168.0.0/24 [110/1] via 172.16.20.2, 00:45:09, FastEthernet1/0

LON_Office traceroute到HK_Office:

代码语言:javascript
复制
  1 172.16.20.2 8 msec 12 msec 8 msec
  2  *  *  * 
  3  *  *  * 

HK_Office traceroute到LON_Office:

代码语言:javascript
复制
  1 172.16.0.2 8 msec 8 msec 12 msec
  2  *  *  * 
  3  *  *  * 

LON1配置:

代码语言:javascript
复制
router ospf 10
 log-adjacency-changes
 redistribute bgp 64512 subnets
 passive-interface default
 no passive-interface FastEthernet1/0
 network 172.16.20.0 0.0.0.255 area 0
  redistribute ospf 10

router bgp 64512
 bgp log-neighbor-changes
 neighbor 10.0.0.1 remote-as 64512
 neighbor 192.168.0.1 remote-as 64512
 
 address-family ipv4
  redistribute ospf 10
  neighbor 10.0.0.1 activate
  neighbor 10.0.0.1 next-hop-self
  neighbor 10.0.0.1 route-map VIP_NET out
  neighbor 192.168.0.1 activate
  neighbor 192.168.0.1 next-hop-self
  neighbor 192.168.0.1 route-map General_NET out
  no auto-summary
  no synchronization
  bgp redistribute-internal
  network 10.0.0.0
  network 172.16.20.0
  network 192.168.0.0
 exit-address-family

HK2配置:

代码语言:javascript
复制
router ospf 10
 log-adjacency-changes
 redistribute bgp 64512 subnets
 passive-interface default
 no passive-interface FastEthernet1/0
 network 172.16.0.0 0.0.0.255 area 0
  redistribute ospf 10

router bgp 64512
 bgp log-neighbor-changes
 neighbor 10.0.0.2 remote-as 64512
 neighbor 192.168.0.2 remote-as 64512
 
 address-family ipv4
  redistribute ospf 10
  neighbor 10.0.0.2 activate
  neighbor 10.0.0.2 next-hop-self
  neighbor 10.0.0.2 route-map VIP_NET out
  neighbor 192.168.0.2 activate
  neighbor 192.168.0.2 next-hop-self
  neighbor 192.168.0.2 route-map General_NET out
  no auto-summary
  no synchronization
  bgp redistribute-internal
  network 10.0.0.0
  network 172.16.0.0
  network 192.168.0.0
 exit-address-family

==================================================

更新:我让它工作了,请检查我的答案。

EN

回答 3

Network Engineering用户

回答已采纳

发布于 2021-04-08 05:20:21

现在,我已经全部完成了,下面是配置:

HK_Office:

代码语言:javascript
复制
interface Loopback0
 ip address 10.10.0.1 255.255.255.0
!
interface Loopback1
 ip address 192.168.10.1 255.255.255.0
!
interface FastEthernet1/0
 ip address 172.16.0.1 255.255.255.0
 duplex auto
 speed auto
!
router ospf 10
 log-adjacency-changes
 passive-interface default
 no passive-interface FastEthernet1/0
 network 10.10.0.0 0.0.0.255 area 0
 network 172.16.0.0 0.0.0.255 area 0
 network 192.168.10.0 0.0.0.255 area 0
!
ip forward-protocol nd

HK2:

代码语言:javascript
复制
interface FastEthernet0/0
 description VIP Network
 ip address 10.0.0.1 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet0/1
 description General Network
 ip address 192.168.0.1 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet1/0
 ip address 172.16.0.2 255.255.255.0
 duplex auto
 speed auto
!
router ospf 10
 log-adjacency-changes
 redistribute bgp 64512 subnets
 passive-interface default
 no passive-interface FastEthernet1/0
 network 172.16.0.0 0.0.0.255 area 0
!
router bgp 64512
 bgp log-neighbor-changes
 neighbor 10.0.0.2 remote-as 64512
 neighbor 192.168.0.2 remote-as 64512
 !
 address-family ipv4
  redistribute ospf 10
  neighbor 10.0.0.2 activate
  neighbor 10.0.0.2 next-hop-self
  neighbor 10.0.0.2 route-map VIP_NET out
  neighbor 192.168.0.2 activate
  neighbor 192.168.0.2 next-hop-self
  neighbor 192.168.0.2 route-map General_NET out
  no auto-summary
  no synchronization
  bgp redistribute-internal
  network 10.0.0.0
  network 172.16.0.0
  network 192.168.0.0
 exit-address-family
!         
ip forward-protocol nd
!
ip prefix-list PREFIX-TO-HK-GENERAL-NETWORK seq 5 permit 192.168.10.1/32
ip prefix-list PREFIX-TO-HK-GENERAL-NETWORK seq 15 permit 172.16.0.0/24
!
ip prefix-list PREFIX-TO-HK-VIP-NETWORK seq 5 permit 10.10.0.1/32
ip prefix-list PREFIX-TO-HK-VIP-NETWORK seq 15 permit 172.16.0.0/24
!
route-map General_NET permit 10
 match ip address prefix-list PREFIX-TO-HK-VIP-NETWORK
 set local-preference 50
!
route-map General_NET permit 20
 match ip address prefix-list PREFIX-TO-HK-GENERAL-NETWORK
 set local-preference 5000
!
route-map VIP_NET permit 10
 match ip address prefix-list PREFIX-TO-HK-VIP-NETWORK
 set local-preference 5000
!
route-map VIP_NET permit 20
 match ip address prefix-list PREFIX-TO-HK-GENERAL-NETWORK
 set local-preference 50

LON1:

代码语言:javascript
复制
interface FastEthernet0/0
 description VIP Network
 ip address 10.0.0.2 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet0/1
 description General Network
 ip address 192.168.0.2 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet1/0
 ip address 172.16.20.2 255.255.255.0
 duplex auto
 speed auto
!
router ospf 10
 log-adjacency-changes
 redistribute bgp 64512 subnets
 passive-interface default
 no passive-interface FastEthernet1/0
 network 172.16.20.0 0.0.0.255 area 0
!
router bgp 64512
 bgp log-neighbor-changes
 neighbor 10.0.0.1 remote-as 64512
 neighbor 192.168.0.1 remote-as 64512
 !
 address-family ipv4
  redistribute ospf 10
  neighbor 10.0.0.1 activate
  neighbor 10.0.0.1 next-hop-self
  neighbor 10.0.0.1 route-map VIP_NET out
  neighbor 192.168.0.1 activate
  neighbor 192.168.0.1 next-hop-self
  neighbor 192.168.0.1 route-map General_NET out
  no auto-summary
  no synchronization
  bgp redistribute-internal
  network 10.0.0.0
  network 172.16.20.0
  network 192.168.0.0
 exit-address-family
!         
ip forward-protocol nd
!
ip prefix-list PREFIX-TO-LON-OFFICE-GENERAL-NETWORK seq 5 permit 192.168.20.1/32
ip prefix-list PREFIX-TO-LON-OFFICE-GENERAL-NETWORK seq 15 permit 172.16.20.0/24
!
ip prefix-list PREFIX-TO-LON-OFFICE-VIP-NETWORK seq 5 permit 10.10.20.1/32
ip prefix-list PREFIX-TO-LON-OFFICE-VIP-NETWORK seq 15 permit 172.16.20.0/24
no cdp log mismatch duplex
!
route-map General_NET permit 10
 match ip address prefix-list PREFIX-TO-LON-OFFICE-VIP-NETWORK
 set local-preference 50
!
route-map General_NET permit 20
 match ip address prefix-list PREFIX-TO-LON-OFFICE-GENERAL-NETWORK
 set local-preference 5000
!
route-map VIP_NET permit 10
 match ip address prefix-list PREFIX-TO-LON-OFFICE-VIP-NETWORK
 set local-preference 5000
!
route-map VIP_NET permit 20
 match ip address prefix-list PREFIX-TO-LON-OFFICE-GENERAL-NETWORK
 set local-preference 50

LON_Office:

代码语言:javascript
复制
interface Loopback0
 ip address 10.10.20.1 255.255.255.0
!
interface Loopback1
 ip address 192.168.20.1 255.255.255.0
!
interface FastEthernet1/0
 ip address 172.16.20.1 255.255.255.0
 duplex auto
 speed auto
!
router ospf 10
 log-adjacency-changes
 passive-interface default
 no passive-interface FastEthernet1/0
 network 10.10.20.0 0.0.0.255 area 0
 network 172.16.20.0 0.0.0.255 area 0
 network 192.168.20.0 0.0.0.255 area 0
!
ip forward-protocol nd

测试目标:测试链路故障转移

备注: BGP的收敛时间很慢,需要几分钟才能找到变化,BFD可以用来改进链路故障检测,但它超出了这个范围。

下面所有的traceroute都是从HK_Office路由器运行的,它也应该在LON_Office上运行。

代码语言:javascript
复制
Before link shut:

Type escape sequence to abort.
Tracing the route to 10.10.20.1

1 172.16.0.2 24 msec 16 msec 12 msec
2 10.0.0.2 16 msec 24 msec 16 msec
3 172.16.20.1 24 msec 36 msec 24 msec

Type escape sequence to abort.
Tracing the route to 192.168.20.1

1 172.16.0.2 28 msec 20 msec 20 msec
2 192.168.0.2 28 msec 44 msec 48 msec
3 172.16.20.1 64 msec 44 msec 56 msec

--------------------------------------------------------------

After link shut:

Tracing the route to 10.10.20.1

1 172.16.0.2 8 msec 20 msec 16 msec
2 192.168.0.2 40 msec 40 msec 40 msec
3 172.16.20.1 20 msec 40 msec 20 msec

Type escape sequence to abort.
Tracing the route to 192.168.20.1

1 172.16.0.2 28 msec 8 msec 8 msec
2 192.168.0.2 24 msec 36 msec 20 msec
3 172.16.20.1 40 msec 36 msec 40 msec

--------------------------------------------------------------

no shut the link again:

Type escape sequence to abort.
Tracing the route to 10.10.20.1

1 172.16.0.2 40 msec 20 msec 8 msec
2 10.0.0.2 16 msec 28 msec 16 msec
3 172.16.20.1 44 msec 36 msec 56 msec


Type escape sequence to abort.
Tracing the route to 192.168.20.1

1 172.16.0.2 36 msec 8 msec 12 msec
2 192.168.0.2 16 msec 20 msec 16 msec
3 172.16.20.1 20 msec 44 msec 40 msec
票数 1
EN

Network Engineering用户

发布于 2021-04-07 16:29:48

添加

代码语言:javascript
复制
no auto-summary

到您的BGP配置

票数 1
EN

Network Engineering用户

发布于 2021-04-07 15:49:40

您可以尝试创建路由映射,以便将BGP重新分发到OSPF,这也使您能够更好地控制重分发的内容。下面的配置来自于Arista,但是您应该能够将它映射到cisco。我试着在实验室里把这个旋转起来,看看我能找到什么。

HK2示例

路线-地图bgp_to_ospf许可证10

匹配ip地址访问列表bgp_to_ospf

-

ip访问列表标准bgp_to_ospf

许可证172.16.20.0 0.0.0.255

许可证192.168.20.0 0.0.0.255

-

路由器ospf 10

重新分发bgp路由-map bgp_to_ospf

票数 0
EN
页面原文内容由Network Engineering提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://networkengineering.stackexchange.com/questions/73381

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档