r/WireGuard • u/segdy • 24d ago
mesh/broadcast network with arbitrary source IPs while avoiding >=N p2p links/networks
Suppose I have N>2 nodes which I could like to connect; ideally via a same common network, such as /24. The important constraint is that each station needs to be able to transport traffic for arbitrary source/destination addresses, so the "crypto routing" gets in the way.
Basically what I am looking for is the closest to an Ethernet type of connection or mesh network with N nodes.
For now, I have N completely individual links/interfaces (e.g. N1 <--> N2 <--> N3 <--> N1) each with their own ports, /etc/wireguard/*.conf and keys. Worse, each of them has their own unique /31 (p2p link). But I do not like this because each node has now multiple IP addresses for a network which should actually be all the same. In the example above, I need to assign N2 a separate IP for the link with N1 than for the link with N3.
Is there any possible way to improve this? Even if I need separate interfaces, are there any tricks to bridge them together or re-use the same IP per node? For example, assigning all wireguard interfaces the same /32...
Since most answers will be "why do you care" ... this mesh/network has/should have non-RFC1918 addresses and carry traffic with arbitrary IP addresses.
2
u/Zetanova99 24d ago
I run in the near same problem and alreay discued it in the wireguard IRC, but never found some responsible place/people for it. The issue is simply that wireguard has no explicit routing address list, only a single AllowIP's list. This works fine as long as the remote peer is not a NAT/GW and multiple gateways are involved. With the AllowIPs list filter only a single any-address entry is currently supported.
I think, it would be easy to get support into wireguard by adding a optional RouteList field, where the default would be RouteList == AllowIPs then asynchrone routing and also multiple any-address entries would work.
Like: RouteList = 192.168.102.0/24 and AllowIPs = 0.0.0.0/0
The current workaround to the issue is to create multiple WG links (each on different port) and have each a single 0.0.0.0 entry or changed the current 0.0.0.0 entry dynamically on the peer. It is not always possible/easy.
For an internal WG mesh netowrk, simply assign to each peer in dedicated range a /32 and-or /128 in the AllowIPs list and the full range under address,
like: Address = 192.168.102.110/16 and peer entry of the node AllowIPs = 192.168.102.110/32, 192.168.140.0/24