Thursday, June 01, 2023

Re: Multi path routing with BGPD

Hi Claudio,

Thanks for your reply. I think this is the saddest news lately.
At this point, I have a question:
This should not be a kernel issue, right?
So, can I use an alternative like bird until this feature is developed?
________________________________
From: Claudio Jeker <cjeker@diehard.n-r-g.com>
Sent: Thursday, June 1, 2023 19:34
To: Valdrin MUJA <valdrin_muja@outlook.com>
Cc: MISC@openbsd.org <MISC@openbsd.org>
Subject: Re: Multi path routing with BGPD

On Mon, May 29, 2023 at 07:29:14PM +0000, Valdrin MUJA wrote:
> Hello,
>
> I try to setup multipath routing environment with OpenBSD's bgpd.

multipath != add-path. OpenBGPD currently does not do multipath routing.
It only uses the best path for the FIB and the nexthops are only resolved
to one gateway.

> As I understand from man page the keyword is add-path.
> Here is my environmental report:
>
> 1. In my lab I simulate two wan links for each device.
> 2. Each device also has a LAN network to announce.
> 3. In the middle of these two devices there is another OpenBSD acting as Router.
>
> Device 1 :
> WAN1 : 192.168.10.2/24
> WAN2: 10.1.1.2/24
> LAN : 172.16.1.1/24
> GRE1 : 172.31.1.1 -> 172.31.1.2 netmask /24 (over wan1)
> GRE2 : 172.31.2.1 -> 172.31.2.2 netmask /24 (over wan2)
>
> Device 2 :
> WAN1 : 192.168.20.2/24
> WAN2: 10.1.2.2/24
> LAN : 172.16.2.1/24
> GRE1 : 172.31.1.2 -> 172.31.1.1 netmask /24 (over wan1)
> GRE2 : 172.31.2.2 -> 172.31.2.1 netmask /24 (over wan2)
>
>
> Router :
> 192.168.10.1/24
> 192.168.20.1/24
> 10.1.1.1/24
> 10.1.2.1/24
>
> ---------
>
> Here bgpd.conf file contents :
>
> Device1# cat /etc/bgpd.conf
> AS 100
> network 172.16.1.0/24
> neighbor 172.31.1.2 {
>       remote-as 100
>       log updates
>       announce IPv4 unicast
> announce add-path recv yes
> announce add-path send best
> }
> neighbor 172.31.2.2 {
>       remote-as 100
>       log updates
>       announce IPv4 unicast
>       announce add-path recv yes
>       announce add-path send best
> }
> allow quick from { ibgp }
> allow quick to { ibgp }
>
> Device2# cat /etc/bgpd.conf
> AS 100
> network 172.16.2.0/24
> neighbor 172.31.1.1 {
>       remote-as 100
>       log updates
>       announce IPv4 unicast
> announce add-path recv yes
> announce add-path send best
> }
> neighbor 172.31.2.1 {
>       remote-as 100
>       log updates
>       announce IPv4 unicast
> announce add-path recv yes
> announce add-path send best
> }
> allow quick from { ibgp }
> allow quick to { ibgp }
>
> Here bgpctl show outputs:
>
> #bgp connection is OK
>
> Device1# bgpctl show
> Neighbor AS MsgRcvd MsgSent OutQ Up/Down State/PrfRcvd
> 172.31.1.2 100 9 9 0 00:02:34 1
> 172.31.2.2 100 9 9 0 00:02:34 1
>
> # we can see rib tables are ready
>
> Device1# bgpctl show rib
> flags: * = Valid, > = Selected, I = via IBGP, A = Announced,
> S = Stale, E = Error
> origin validation state: N = not-found, V = valid, ! = invalid
> origin: i = IGP, e = EGP, ? = Incomplete
>
> flags ovs destination gateway lpref med aspath origin
> AI*> N 172.16.1.0/24 0.0.0.0 100 0 i
> I*> N 172.16.2.0/24 172.31.1.2 100 0 i
> I*m N 172.16.2.0/24 172.31.2.2 100 0 i
>
> Device2# bgpctl show rib
> flags: * = Valid, > = Selected, I = via IBGP, A = Announced,
> S = Stale, E = Error
> origin validation state: N = not-found, V = valid, ! = invalid
> origin: i = IGP, e = EGP, ? = Incomplete
>
> flags ovs destination gateway lpref med aspath origin
> I*> N 172.16.1.0/24 172.31.1.1 100 0 i
> I*m N 172.16.1.0/24 172.31.2.1 100 0 i
> AI*> N 172.16.2.0/24 0.0.0.0 100 0 i
>
>
> But there is only one path in FIB table:
>
> Device1# bgpctl show fib | grep B
> flags: B = BGP, C = Connected, S = Static
> N = BGP Nexthop reachable via this route
> B 48 172.16.2.0/24 172.31.1.2
>
> Device2# bgpctl show fib | grep B
> flags: B = BGP, C = Connected, S = Static
> N = BGP Nexthop reachable via this route
> B 48 172.16.1.0/24 172.31.1.1
>
> Also my sysctl.conf is ok (net.inet.ip.multipath=1)
> I just wanna add multpath routes for my networks as dynamic.
>
> It's ok with static routing(*) but I would like to achieve it as dynamically with bgpd.
> What is wrong with my configuration? Can you please help me.
> Thanks.
>
> (*)
> Device1# route add 172.16.2.0/24 172.31.1.2 -mpath
> add net 172.16.2.0/24: gateway 172.31.1.2
> Device1# route add 172.16.2.0/24 172.31.2.2 -mpath
> add net 172.16.2.0/24: gateway 172.31.2.2
> Device1# netstat -rnf inet | grep 172.16.2
> 172.16.2/24 172.31.1.2 UGSP 0 0 - 8 gre1
> 172.16.2/24 172.31.2.2 UGSP 0 0 - 8 gre2
>
> Device2# route add 172.16.1.0/24 172.31.1.1 -mpath
> add net 172.16.1.0/24: gateway 172.31.1.1
> Device2# route add 172.16.1.0/24 172.31.2.1 -mpath
> add net 172.16.1.0/24: gateway 172.31.2.1
> Device2# netstat -rnf inet | grep 172.16.1
> 172.16.1/24 172.31.1.1 UGSP 0 0 - 8 gre1
> 172.16.1/24 172.31.2.1 UGSP 0 0 - 8 gre2
>

You don't need add-path for your setup (also you did only send the best
path and not the best path plus an alternative). You want to use both the
path from router 172.31.1.1 and the one from 172.31.2.1.

As mentioned above bgpd currently does not do multipath. It is on the
todo list but don't hold your breath I have a few other things I need to
tackle first.

--
:wq Claudio

No comments:

Post a Comment