-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
Add support for IPv6 CIDR ranges as subnets #14
Conversation
A /64 subnet has 2^64 IP addresses which is way too many to fit in-memory for the simple-vpn server. To add IPv6 support, we initialize the server with at-most 2^20 IPs which translates to a /108 subnet. If we run out of IPs in the /108, we expand the subnet to /107 and so on.
Thanks for your submission. I've had a quick look and it looks good, but I'll want to test it over the weekend before I'm sure. (e.g. Do we need to add "-6" to the IP commands? I don't think so, but will need to test to be sure.) |
Sounds good. I did some basic testing
It's definitely a good idea to do some testing of your own to be sure. |
Yeah that's the kind of thing I'd do, but I'd connect and reconnect a number of machines and see that the IP-allocation makes sense. No leaks or gaps. Also test the static assignment via name too. |
OK, I think there's something else that needs to be done to setup routing correctly with |
Probably worth checking the IP commands that get run. Or exploring via the cli |
I tried |
I launched the server with this configuration-file:
The server launches and it shows:
Looks like the initial IP is bogus - notice how Same with the client. When the client connects the remote IP of the master is shown as "fefe::" To fix this manually you could, on the master run:
On the client something like this:
In short you're not allocating/iterating over the IPs correctly to assign the first to the master, and later ones to each client. Does that help? |
I don't think that's the issue. For IPv6, |
Good correction :)
Something wrong there. I don't expect client1<->master to work, nor client2<->master, but client1<->client2 should, and won't if they have the same IP. |
For reproducibility, I'm running the server on an ubuntu 18.04 VM in virtual box and running the clients in docker containers on the same VM. Client.cfg Here's my Dockerfile for the client:
To build: To run: Run the client: |
Thanks for the overview; I'm using real hosts. You've gotten me curious now, and I will be attacking this myself later in the day.
But I see nothing wrong with saying "max 256/1024 clients". Doing that will cut down on the allocations I think. I'll concentrate on the IP allocation, and I hope if/when that is right it'll just work. |
OK I'm happy with #15 to allocate IPs better. Routing fails. Looks like This is annoying and harder than it needs to be :/ |
I'd be curious to know what needs to be updated in |
See the last commit on #15; results in a working system. Of course its a hack .. |
How about using https://github.com/songgao/water/blob/master/waterutil/tun.go to determine if the packet is v4 or v6 and then extracting the mac address based on that? |
Yup that works. Sorry for the duplication, and I do appreciate your contribution but I'm going to close this PR now, and keep going with my own. If you could test it that would be useful, and good. |
Closing, in favor of #15, but thank-you. |
#12
A /64 subnet has 2^64 IP addresses which is way too many
to fit in-memory for the simple-vpn server. To add IPv6
support, we initialize the server with at-most 2^20 IPs
which translates to a /108 subnet. If we run out of IPs
in the /108, we expand the subnet to /107 and so on.