-
Notifications
You must be signed in to change notification settings - Fork 187
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
Allow to use multiple addresses and added IPv6 support #174
Conversation
Thanks for the PR! Looks promising 😉 I'll try to test it within the next two or three days. Being backward compatible is one of my main concerns because I don't want to kill my own Wireguard setup 😄 |
@DiscowZombie Sorry for getting back this late. The PR works fine for me. So |
Happy to see this notification! I will update the |
FYI: I just released |
Hosts can now have one IPv6, by specifying 'wireguard_address_v6' variable. This IP is added to peer's AllowedIPs. Future plans : - Support IPv6 only hosts (No 'wireguard_address') - Allow the endpoint to be an IPv6 address
Added the 'wireguard_addresses' variable to specify an array of IPv4 and IPv6. The old 'wireguard_address' variable can be deprecated even she still work to specify one IPv4. The 'wireguard_address_v6' from last commit was deleted.
@DiscowZombie Is this ready to be merged? Please also add an entry to CHANGELOG e.g.:
|
Everything is ready 🚀 |
* Basic IPv6 support Hosts can now have one IPv6, by specifying 'wireguard_address_v6' variable. This IP is added to peer's AllowedIPs. Future plans : - Support IPv6 only hosts (No 'wireguard_address') - Allow the endpoint to be an IPv6 address * Added 'wireguard_addresses' to use multiple IPs Added the 'wireguard_addresses' variable to specify an array of IPv4 and IPv6. The old 'wireguard_address' variable can be deprecated even she still work to specify one IPv4. The 'wireguard_address_v6' from last commit was deleted. * Updating the README to use `wireguard_addresses` * 13.0.0 changelog
First of all, thanks for the great work, this role was really useful for one of my project.
Current limitations
Until now, it has been impossible for a host to have multiple IPs inside the VPN. This prevents a lot of use-cases, especially dual-stack network (one IPv4 and one IPv6). Furthermore, putting an IPv6 inside the
wireguard_address
produced an invalid configuration file, since the IP got suffixed by the/32
mask :ansible-role-wireguard/templates/etc/wireguard/wg.conf.j2
Line 56 in f6a6e46
This PR aims to fix IPv6 support and allow using multiple IPs.
To do this, the PR implements the
wireguard_addresses
variable. This variable can contain an array of IPv4 or IPv6 addresses to be used inside the Wireguard network. The old way of specifying one IPv4 (through thewireguard_address
variable) is still supported, even I recommend migrating to the newwireguard_addresses
variable.Examples
Consider three nodes,
ansible1
,ansible2
andansible3
.IPv4 only network
Old way (still working)
hosts.yaml
New way
hosts.yaml
Dual-stack network
hosts.yaml
Complex network
A more complex network example.
hosts.yaml
Testing and other notes
All those setups have been tested with multipass. If I have time, I will be happy to experiment with molecule too. I would be happy if some could experiment on their side too (and give inputs).
All the changes have been designed to be backward compatible.
If you plan merging this PR, let me know, since the readme will benefit from an update to explain the new variable too.
FYI: During my testing, I tried using an IPv6 as
Endpoint
and can confirm it (already) work.