Question

Using floating IP for outbound connections

I just setup a droplet and assigned it a floating IP. I believe it should be possible to configure the OS (Ubuntu in my case) to use that floating IP for all outbound connections instead of the anchor IP, I just don;t know how to accomplish this.

I need to do this reliably because I am connecting to an external API that requires connections to come from a whitelisted IP. And changing the whitelist is a slow manual process so my hope is to use the floating IP to ensure it shouldn’t have to be changed even if I have to rebuild the server or something.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

No I think you are mistaken as to what the anchor IP is.

“Network traffic between a Floating IP and a Droplet flows through an anchor IP, which is an IP address aliased to the Droplet’s public network interface (eth0).”

https://www.digitalocean.com/docs/networking/floating-ips/how-to/find-anchor-ips/

In any case. The point is to use the Floating IP for outbound connections. Which I did ultimately find a bash file to configure this here: https://gist.github.com/eagafonov/5c57bfbe353a9c93a94c

Hi @ryanUrchin,

I believe I met a problem similar to yours and found two workarounds to it. Before I share them I would need some clarification from you.

You wrote
I believe it should be possible to configure the OS (Ubuntu in my case) to use that floating IP for all outbound connections instead of the anchor IP

I am pretty sure you mixed up your droplet’s anchor IP with its public IP. It would not be possible to communicate across the internet with an anchor IP as a source one. An anchor IP belongs to ipv4 range that is designated to private (local) networks. You can retrieve your droplet’s anchor IP executing a command below (due to the appropriate DO’s doc):

curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/anchor_ipv4/address

Is that right, or I misunderstood your description ?