Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is that possible to bind all available public IP addresses on a server to one Postfix instance as its outgoing IP address pool and let it choose a random IP address or specified IP address from the pool each time it sends out an email?

If above is not possible, can it be configured to listen on one public IP address per instance and each time it delivers a message, it use the binded one as outgoing IP address?

share|improve this question

If the ip addresses belongs to different subnets, the first could be done with multihop routing giving each outgoing line a weight depending on how often you want it to be used. You can check this chapter from the LARTC for more details.

Another way would be using the same default gateway each time and SNATing outgoing packets using iptables to one of your available ips from the pools using a round robin algorithm. This will also work no matter whether the ips belong to the same subnet or not.

On the other hand, running multiple instances of the mail server on the same machine doesn't seem like a good idea. In theory it could work but you have no real reason to do so and also, I don't think you can set a different routing table within each postfix instance so all outgoing mails would follow the normal hop route to the next relay server.

share|improve this answer

I have such configuration what you want but with qmail. Cost me lot of efforts to combine different patches to achieve this and even more. Now I can bind an IP to domain , and all incoming and outgoing mail for/from that domain is using this binded ip as well as domainkey signing for that domain. Looking forward if someone can share knowledge about postfix solution with the same result cause I am tired of qmail patching...

share|improve this answer

You may want to consider using an outbound nat pool for the server, allowing it to take on any IP in the pool at random. Both iptables and pf allow you to do this.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.