The short answer is yes. The longer answer is that it depends on the software you are using to make the request. It needs to expose some way of binding to a particular interface. If it does, you’ll need to find what we call the “anchor IP” and use it. The easiest way to find the anchor IP is to inspect your Droplet’s metadata. From the Droplet, run:
- curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/anchor_ipv4/address
In my case, it returns 10.10.0.8
If you wanted to make your request with curl
you could then use:
- curl --interface 10.10.0.8 https://example.com
Or with wget
you would use:
- wget --bind-address=10.10.0.8 https://example.com
In both cases, example.com
would now see the request as coming from my Floating IP not my Droplet’s IP address.
Check out this tutorial for more info on Floating IPs: How To Use Floating IPs on DigitalOcean In particular, see the section on “Droplet Anchor IPs.”