How to make second IP the “outgoing” one? [Debian/Networking/Docker]

we would like to setup a small transactional email server for outgoing emails to confirm transactions. As IPs are the most important identifier of email servers and whitelisted by the spam checkers, I would like to use a fail-over/floating IP as the “primary” one for outgoing connections.

The server has the primary IP and I can add the fail-over IP to the network configuration, but how can I ensue that all new outgoing connections are coming from the fail-over IP?

The old primary IP still needs to be usable in case I need to switch the fail-over IP to a different server and access this server for maintenance.

If it helps, the email service is running in a Docker container, it potentially would be enough to let the container just use the fail-over IP for new outgoing connections. But how?

Thanks bluepuma

Answer

I finally found a solution that is working for me.

My Debian is using /etc/network/interfaces.d/50-cloud-init to set the primary IP, the hoster recommends to add a /etc/network/interfaces.d/60-my-floating-ip.cfg.

I just changed 60 to 49. Then the floating IP is initiated first and used as the default outgoing IP. The old primary IP is still reachable.

Attribution
Source : Link , Question Author : bluepuma77 , Answer Author : bluepuma77

Leave a Comment