Huawei BGP和OSPF双边界重分布(二)

时间:2022-09-19 09:01:10

网络拓扑:

Huawei BGP和OSPF双边界重分布(二)

本例主要配置和例一致,主要是在AR3260-AR1和AR3260-AR2的路由域的边界上,从AR3260-AR1上重分布进BGP 65001的路由的时候打tag 650011,在AR3260-AR2上重分布进BGP 65001的路由的时候打tag 650012 ,然后在AR3260-AR1上将OSPF 100的路由重分布进BGP 65000的时候过滤掉打了tag 650012的路由,在AR3260-AR2上过滤掉tag 650011的路由。

AR3260-AR1

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

bgp 65000
router-id 10.185.1.3
peer 10.185.1.4 as-number 65000
peer 10.185.1.4 connect-interface LoopBack0
peer 10.201.1.2 as-number 65001
peer 10.201.1.2 bfd enable
#
ipv4-family unicast
undo synchronization
import-route ospf 100 route-policy ospf-to-bgp
peer 10.185.1.4 enable
peer 10.185.1.4 next-hop-local
peer 10.201.1.2 enable
#
ospf 100 router-id 10.185.1.3
import-route bgp route-policy bgp-to-ospf
area 0.0.0.0
network 10.10.1.0 0.0.0.3
network 10.10.1.8 0.0.0.3
network 10.185.1.3 0.0.0.0
#
route-policy bgp-to-ospf permit node 10
apply tag 650011
#
route-policy ospf-to-bgp deny node 10
if-match tag 650012
#
route-policy ospf-to-bgp permit node 20
#

AR3260-AR2

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

#
bgp 65000
router-id 10.185.1.4
peer 10.185.1.3 as-number 65000
peer 10.185.1.3 connect-interface LoopBack0
peer 10.201.1.6 as-number 65001
peer 10.201.1.6 bfd enable
#
ipv4-family unicast
undo synchronization
import-route ospf 100 route-policy ospf-to-bgp
peer 10.185.1.3 enable
peer 10.185.1.3 next-hop-local
peer 10.201.1.6 enable
#
ospf 100 router-id 10.185.1.4
import-route bgp route-policy bgpt-to-ospf
area 0.0.0.0
network 10.10.1.4 0.0.0.3
network 10.10.1.8 0.0.0.3
network 10.185.1.4 0.0.0.0
#
route-policy bgpt-to-ospf permit node 10
apply tag 650012
#
route-policy ospf-to-bgp deny node 10
if-match tag 650011
#
route-policy ospf-to-bgp permit node 20
#

在S5700-LSW1上查看打了tag 的路由10.136.1.0/24

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

[S5700-LSW1]display ip routing-table 10.136.1.0 verbose
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Table : Public
Summary Count : 1

Destination: 10.136.1.0/24
Protocol: O_ASE Process ID: 100
Preference: 150 Cost: 1
NextHop: 10.10.1.2 Neighbour: 0.0.0.0
State: Active Adv Age: 00h16m51s
Tag: 650011 Priority: low
Label: NULL QoSInfo: 0x0
IndirectID: 0x0
RelayNextHop: 0.0.0.0 Interface: Vlanif50
TunnelID: 0x0 Flags: D