I am forwarding dns queries onto another external dns server. I would like the queries to appear as they’re coming from the floating ip, not the public ip address of my droplet. Any ideas on how to force outgoing traffic through the floating ip address?
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.
Assuming you are using Bind9 as your forwarding DNS server, setting the
transfer-source
and thequery-source
to the Droplet’s “anchor IP” should cause outgoing traffic to come from your Floating IP.From How To Use Floating IPs on DigitalOcean:
You can find it using:
The “anchor IP” (highlighted) will be under your normal public IP address information:
Or you could find it via the metadata service. It will be returned if you query:
So the
options
section of your Bind9 configuration should have a section that looks like:For more info on Bind’s usage of addresses and ports, this excerpt of O’Reilly’s DNS & Bind is helpful.