Vyos 1.4 ospf can redistribute bgp,bgp can not redistribute ospf!

In my lab ospf mix bgp ,i find ospf can redistribute bgp,bu bgp can not redistribute ospf !

in vrouter01b
vrouter01b have bgp and ospf !
this is manually add to bgp
10.110.11.0/24
10.110.12.0/24
this is ospf network
10.110.13.0/24

vrouter01b bgp config

set protocols bgp address-family ipv4-unicast network 10.110.11.0/24
set protocols bgp address-family ipv4-unicast network 10.110.12.0/24
set protocols bgp address-family ipv4-unicast network 172.16.250.0/24
set protocols bgp address-family ipv4-unicast network 172.16.252.0/24
set protocols bgp address-family ipv4-unicast network 172.16.253.0/24
set protocols bgp address-family ipv4-unicast network 172.16.254.0/24
set protocols bgp address-family ipv4-unicast redistribute connected
set protocols bgp address-family ipv4-unicast redistribute ospf metric ‘1’
set protocols bgp address-family ipv4-unicast redistribute ospf route-map ‘2’
set protocols bgp local-as ‘65000’
set protocols bgp neighbor 172.16.250.1 ebgp-multihop ‘2’
set protocols bgp neighbor 172.16.250.1 remote-as ‘65000’
set protocols bgp neighbor 172.16.250.1 update-source ‘172.16.250.2’
set protocols bgp parameters router-id ‘172.16.253.1’

in vrouter01a
no 10.110.13.0/24 in route table

vrouter01a.txt (3.6 KB)
vrouter01b.txt (4.0 KB)

Hi @crazycen .
In routerA you have

protocols bgp address-family ipv4-unicast network 172.16.253.0/24

And that network if from routerB, so it shoudn’t be advertise on routerA.
I made a lab, with this config on both routers:

RouterA

vyos@vrouter01a# run show config comm | grep bgp
set protocols bgp address-family ipv4-unicast network 172.16.250.0/24
set protocols bgp address-family ipv4-unicast network 172.16.252.0/24
set protocols bgp address-family ipv4-unicast network 172.16.254.0/24
set protocols bgp address-family ipv4-unicast redistribute ospf
set protocols bgp local-as '65000'
set protocols bgp neighbor 172.16.250.2 ebgp-multihop '2'
set protocols bgp neighbor 172.16.250.2 remote-as '65000'
set protocols bgp neighbor 172.16.250.2 update-source '172.16.250.1'
set protocols bgp neighbor 172.16.252.2 remote-as '65001'
set protocols bgp neighbor 172.16.252.2 update-source '172.16.252.1'
set protocols bgp neighbor 172.16.252.3 remote-as '65001'
set protocols bgp neighbor 172.16.252.3 update-source '172.16.252.1'
set protocols bgp parameters router-id '172.16.252.1'

RouterB:

vyos@vyos# run show config comm | grep bgp
set protocols bgp address-family ipv4-unicast network 10.110.11.0/24
set protocols bgp address-family ipv4-unicast network 10.110.12.0/24
set protocols bgp address-family ipv4-unicast redistribute connected
set protocols bgp address-family ipv4-unicast redistribute ospf
set protocols bgp local-as '65000'
set protocols bgp neighbor 172.16.250.1 ebgp-multihop '2'
set protocols bgp neighbor 172.16.250.1 remote-as '65000'
set protocols bgp neighbor 172.16.250.1 update-source '172.16.250.2'
set protocols bgp parameters router-id '172.16.253.1'
set protocols ospf redistribute bgp

vyos@vyos# run show config comm | grep ospf
set protocols bgp address-family ipv4-unicast redistribute ospf
set protocols ospf area 0 area-type normal
set protocols ospf default-information originate always
set protocols ospf default-information originate metric '10'
set protocols ospf default-information originate metric-type '2'
set protocols ospf default-information originate route-map '1'
set protocols ospf interface eth2 area '0'
set protocols ospf log-adjacency-changes
set protocols ospf neighbor 172.16.253.2
set protocols ospf parameters router-id '172.16.253.1'
set protocols ospf redistribute bgp
set protocols ospf redistribute connected

Routing Table on router B (where network 10.110.13.0/24 was learned via OSPF:

vyos@vyos# run show ip route | grep "B\|O"
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup
O>* 0.0.0.0/0 [110/10] via 172.16.253.2, eth2, weight 1, 00:27:33
O>* 10.110.13.0/24 [110/20] via 172.16.253.2, eth2, weight 1, 00:25:32
B>* 172.16.252.0/24 [200/0] via 172.16.250.1, vti10, weight 1, 00:35:51
O   172.16.253.0/24 [110/1] is directly connected, eth2, weight 1, 00:37:54
B   172.16.254.0/24 [200/0] via 172.16.250.1, vti10, weight 1, 00:35:51

Then, on routerA you can see that route to 10.110.13.0/24 was learned via BGP:

vyos@vrouter01a# run show ip bgp
BGP table version is 11, local router ID is 172.16.252.1, vrf id 0
Default local pref 100, local AS 65000
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*>i0.0.0.0/0        172.16.253.2            10    100      0 ?
*>i10.110.11.0/24   172.16.250.2             0    100      0 i
*>i10.110.12.0/24   172.16.250.2             0    100      0 i
*>i10.110.13.0/24   172.16.253.2            20    100      0 ?

u are right ! thanks a lot ! :hugs:

now bgp and ospf can redistribute each other