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

Alternative Ingress IP #1605

Merged
merged 3 commits into from
Jan 31, 2020
Merged

Conversation

jackivanov
Copy link
Collaborator

@jackivanov jackivanov commented Oct 7, 2019

Description

This PR adds functionality to provision and configure a separate ingress IP to split up incoming and outgoing traffic. The PR is for DigitalOcean only for now.
Because of a bug in Ansible, we're again forced to modify the module locally.

Motivation and Context

Fixes #1047

How Has This Been Tested?

  1. Deployed to DigitalOcean
  2. Connected via IKEv2 and WireGuard
  3. Ensured that the endpoint for both IKEv2 and WireGuard was set to the Floating IP
  4. Went to ipleak.net to ensure the ip shown was not the one from the step 3

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • All new and existing tests passed.

TODO:

  • Short but efficient description comment here
  • will be addressed as a separate issue: As we now provision multiple resources without a shared control mechanism (like CloudFormation), we have to create a mechanism to clean up the environment, delete the server and the floating ip by running ./algo destroy which rises cloud specific prompts and displays the resources available for deletion.

Any suggestions welcome!

@jackivanov jackivanov added the 1.2 label Oct 7, 2019
@jackivanov jackivanov added this to the 1.2 milestone Oct 7, 2019
@jackivanov
Copy link
Collaborator Author

cc @dnesting @davidemyers

@jackivanov jackivanov changed the title Separate ingress IP draft [WIP] Separate ingress IP Oct 7, 2019
@davidemyers
Copy link
Contributor

I suggest a name other than static_ip for the variable in config.cfg as I think that name will confuse people (the IPs for most (all?) providers other than Lightsail can be thought of as static). Perhaps second_ip or ingress_ip.

@davidemyers
Copy link
Contributor

I also suggest that the configs/ subdirectory be named after the primary IP address rather than the secondary ingress IP.

config.cfg Outdated Show resolved Hide resolved
@jackivanov jackivanov force-pushed the feature/1047 branch 3 times, most recently from 1d5f2cd to d224860 Compare November 12, 2019 10:48
@jackivanov jackivanov changed the title [WIP] Separate ingress IP Separate ingress IP Dec 8, 2019
@jackivanov jackivanov changed the title Separate ingress IP Alternative Ingress IP Dec 8, 2019
@jackivanov jackivanov marked this pull request as ready for review December 8, 2019 13:29
@jackivanov
Copy link
Collaborator Author

Alright, it's ready for more tests

@davidemyers
Copy link
Contributor

This breaks IPv6 for me (tested via http://ipv6-test.com/ and https://browserleaks.com/ip). I don't see the alternate IPv6 address on ens3 even after a reboot.

Deployed from Ubuntu 19.10 using the alternate Python 3.8 and tested using WireGuard on iOS.

@jackivanov
Copy link
Collaborator Author

OK, seems we have to use netplan. @davidemyers I think it's fixed now, works on my end

@davidemyers
Copy link
Contributor

That works for me, thanks.

Should the secondary IPv6 address be /64 like the primary? I tried it that way and it seems to work.

@davidemyers
Copy link
Contributor

The docs should mention that when using this feature with DigitalOcean, after manually deleting a Droplet you need to also delete the Floating IP or you'll get charged for it.

@jackivanov
Copy link
Collaborator Author

jackivanov commented Dec 10, 2019

Should the secondary IPv6 address be /64 like the primary? I tried it that way and it seems to work.

It will work for sure, but DigitalOcean actually gives you a /124, but not the whole /64, so we take a random address from the /124 subnet

@benturner
Copy link

Hm, this doesn't appear to do anything for the IPv4 traffic?

@jackivanov
Copy link
Collaborator Author

jackivanov commented Jan 27, 2020

@benturner It's disabled by default at the moment. You need to turn it on in config.cfg alternative_ingress_ip: true. Can you try that?

@benturner
Copy link

Yep, I did. It properly changed my rules.v6 file but the rules.v4 file didn't get the SNAT option added to it.

@jackivanov
Copy link
Collaborator Author

jackivanov commented Jan 27, 2020

@benturner It doesn't modify rules.v4, it just sets the destination IP for the vpn connection as the Floating IP.

But I think it might be not a good way in case we want to add more providers.. I'll check that

@jackivanov
Copy link
Collaborator Author

jackivanov commented Jan 28, 2020

I've refactored the code, so we use the simplest schema with SNAT now

@jackivanov
Copy link
Collaborator Author

@davidemyers could you check out this one please?

@davidemyers
Copy link
Contributor

Works for me, tested from WireGuard on iOS.

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

Successfully merging this pull request may close these issues.

Separate egress IP address
3 participants