Question

Send Outbound Traffic Over a Reserved IP with a Custom Image

Hi,

The “Send Outbound Traffic Over a Reserved IP” (https://docs.digitalocean.com/products/networking/reserved-ips/how-to/outbound-traffic/) document mentions for custom images that there is no anchor IP, but yet that is what must be used to send traffic out over the reserved IP.

The explanation of Anchor IP (from https://docs.digitalocean.com/glossary/anchor-ip/), says “Droplets created from custom images do not require an anchor IP to use a reserved IP, instead the reserved IP maps to the Droplet’s public IP address by default.”

I’m trying to confirm if it is tested and expected to work that custom images can send outbound traffic over a reserved IP? And if so, do they need to go through the instructions to enable Anchor IPs (https://docs.digitalocean.com/products/networking/reserved-ips/how-to/enable-old/#enable-anchor-ips-immediately)?

I was able to find an Anchor IP, but was having trouble getting routing to work (but I’m new to custom images and having multiple network ports - I see the the loopback, public IP and private IP before I try to add anchor IP).

I likely have something wrong in my setup, but just wanted to confirm it should be possible.

Thanks!

Show comments

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.

Accepted Answer

Found the solution. the IP addr to assign to eth0 is what returns from http://169.254.169.254/metadata/v1/interfaces/public/0/anchor_ipv4/address (10.18.0.12 in this example) and the default GW should be what is returned from http://169.254.169.254/metadata/v1/interfaces/public/0/anchor_ipv4/gateway (10.18.0.1 in this example).

To avoid severing your network connection if something fails, I’d recommend add a non-default route to one specific IP first, for example:

host ifconfig.me

ifconfig.me has address 34.117.118.44

ip route add 34.117.118.44/32 via 10.18.0.1 dev eth0 Then, to test that it worked: curl ifconfig.me Once this works: ip addr add 10.18.0.12/16 dev eth0 route add default gw 10.18.0.1 And: route del default gw $ORIGINAL_GW

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more