Hi, There is no reason to set gw attribute in the export filter, because this attribute is not exported over bgp. bgp_next_hop is what you want. You should also consider the "next hop self" option.
On Mon, Nov 2, 2020 at 5:53 PM ico <[email protected]> wrote: > > Hello, > > I'm trying to to export some routes from our internal OSPF to BGP , both > running in the same bird instance. I am able to filter those routes via > BGP just fine (some tables connected via pipe). The problem is that all > exported routes have private gw addresses (10.x.x.x). I am unable to > configure bird to change gw of routes before then get sent to neighbors. > Neighbors see original gateways from 10.0.0.0/8 range which is > invalid/unreachable from outside of course. > > Here is also some simplyfied example, not showing OSPF setup etc. In > this example I also don't show the pipes between tables. All of those > doesn't seem to be important in this case. > > ######## > router id 1.1.1.2; > > protocol kernel krnl4 { > ipv4 { > export all; > import all; # route 2.2.2.0/24 gets into bird here > }; > learn; > } > protocol device { > } > > protocol bgp { > local 1.1.1.2 as 65000; > neighbor 1.1.1.1 as 65000; > strict bind; > ipv4 { > import none; > export filter { > # here I want to export routes with changed gateways > bgp_next_hop = 1.1.1.5; # sets next hop but not gw > gw = 1.1.1.5; # <ERR> filters, line XY: Invalid gw address > print "export bgp ", net, " gw ", gw, " bnh ", bgp_next_hop; > # <INFO> export bgp 2.2.2.0/24 gw 1.1.1.5 bnh 1.1.1.5 > accept; > }; > }; > } > ######## > > With similar setup in a lab I was able to change those gw attributes on > RECEIVING side in import filter to any arbitrary value I wanted. In real > life I don't manage those BGP routers so I need to make sure to send > correct routes. > > The example config prints changed gw but BGP peer sees the original gw. > In some tests I got error "Invalid gw address" but now I don't have that > config. Here it just ignores changed gw. > > Is there a configuration to achieve this? > > Thanks > > ico
