Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: add support for specifying interface with glob #58

Open
NickCao opened this issue Apr 22, 2020 · 14 comments
Open

feature request: add support for specifying interface with glob #58

NickCao opened this issue Apr 22, 2020 · 14 comments

Comments

@NickCao
Copy link

NickCao commented Apr 22, 2020

In my particular deployment of babeld together with wireguard, to work around the limitation of the wireguard routing model, namely AllowedIPs, I had to create an interface for each peer. Thus for the addition and removal of peers, I can only regenerate the configuration file for babeld then restart it, leaving an annoying time window before the routes converge again. I think it would be nice if support for specifying interface with glob can be added to babeld, especially for the growing deployments of wireguard .

@jech
Copy link
Owner

jech commented Sep 22, 2020

I'd much rather we had babeld support Wireguard out of the box. The plan is the following:

  • support a mode of operation where no automatic discovery happens;
  • monitor peers discovered by Wireguard, and add them automatically to the neighbours table with the right parameters.

It's number 4 on my todo list, so please don't hold your breath.

@NickCao
Copy link
Author

NickCao commented Sep 25, 2020

Due to the cryptokey routing nature of wireguard, it's bound to be a tough task to integrate any routing daemon with wireguard without efforts from their side. I checked the documents from freifunk and nycmesh, which should be among the largest mesh networks utilizing wireguard, and found no better solution other than creating a separated interface for each peer and set ::/0 and 0/0 as the allowed ips. Despite that this approach takes a whole range of udp ports, it works flawlessly, not needing any changes from routing daemons. Thus, for now, I think it might be easier to implement dynamic interfaces and wait for the required efforts to be poured into wireguard. Still, maybe we can just formalize the local configuration interface of babeld, and let external helpers do the heavy lifting.

@jech
Copy link
Owner

jech commented Sep 27, 2020

Please propose a patch, it's difficult to discuss stuff in a void.

Still, maybe we can just formalize the local configuration interface of babeld, and let external helpers do the heavy lifting.

We already have — see the -G command-line option.

Still, I think that Wireguard is an important piece of infrastructure, and I'd be quite willing to accept ad-hoc support for it in babeld. The best thing would be to disable neighbour discovery in babeld, and use Wireguard to inform us about new neighbours (we'd still be doing link quality estimation, of course). Let me know if you wish to work on that.

@NickCao
Copy link
Author

NickCao commented Sep 27, 2020

For the configuration interface part, forgive me for not clarifying, as all required is a specification for the protocol, especially the response, so that writing interoperable software involves less guesswork. I'll take time to give it a shot.

And for the integration with wireguard, I'm aware of some ongoing works which might be of interest.

  1. wg-lla an algorithm for mapping wireguard public keys to linklocal addresses (then the list of peers can be directly converted to the list of neighbors)
  2. Introduce Wireguard support to bird a patch set that enables bird to update allowed ips according to the routing table (there's still room for improvement in terms of performance, and asymmetrical routes won't work)

I'm currently tinkering with wireguard to find a solution for the second part, may not be able to spare effort for the first part though.

@snh
Copy link

snh commented Oct 5, 2020

+1 to this feature request.

As someone who has a lot of experience using babeld with WireGuard, with the same topology as @NickCao (multiple WireGuard interfaces, each with a single peer), support for specifying interfaces with a glob would be very useful, and negate the need to update the babeld configuration whenever a new interface is added.

As I mentioned in #64 (comment), I don't think the approach in #64 is workable with WireGuard unless deep integration and control of the WireGuard cryptokey routing table was to occur. Even then, there are cases where a separate WireGuard interface per peer (and therefore glob support in babeld) has its advantages I suspect.

@MisterDA
Copy link
Contributor

MisterDA commented Oct 5, 2020

Could we use network namespaces and use Wireguard support for netns to have all of WireGuard interfaces added to a single namespace, then add all other wanted interfaces to the namespace, and specify to babeld the network namespace instead of a list of interfaces? Babeld would use all of the interfaces of the namespace.
Of course that is a Linux-only feature.

@snh
Copy link

snh commented Oct 5, 2020

@MisterDA Using a network namespace for the WireGuard interfaces introduces problems of its own, in particular the fact that you then need to bind any services you want accessible to that namespace too, as well as the fact an interface can only live in a single namespace, reducing flexibility. My preference would stick with being able to specify a glob to cover in my case wg*.

@jech
Copy link
Owner

jech commented Oct 5, 2020 via email

@jech
Copy link
Owner

jech commented Oct 5, 2020 via email

@jech jech mentioned this issue Feb 9, 2021
@neutron-ah
Copy link

Wireguard is a special case. In our installation we use ipsec/vti interfaces. It would be convenient for us to use a glob for the interface name, including for redistribution. For example:
interface vti-gw*
redistribute if vmbr*

At the moment, when adding the vti interface, we have to update the configuration file and restart babeld. We cannot use the -G option for security reasons.

@jech
Copy link
Owner

jech commented Aug 2, 2021

The -G option can take a Unix domain socket, which obeys the filesystem permissions.

@jue89
Copy link

jue89 commented Feb 10, 2022

I'd say the glob is the cleanest solution. Integrating wireguard-specific stuff into babeld feels a little bit wrong to me. I love babeld for its simplicity - it just needs network connection that talks IP. It will find its neighbors on its own without the need to specify any remote babeld routers.

@NickCao
Copy link
Author

NickCao commented Feb 10, 2022

I've been syncing interfaces with a custom daemon, and it works pretty well. I believe that a simple shell script can also do the trick. Specifying interfaces with glob or regex truly is a useful feature anyway, but it still leave other use cases like dynamic interface discovery uncovered.

@NickCao
Copy link
Author

NickCao commented Feb 10, 2022

The main reason that people do not want to generate a new config and simply do a restart is that it would disrupt traffics and cause route flapping. If some sort of reload functionality can be implemented, then that will also be a viable solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants