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

This question already has an answer here:

I'm using Postfix in my ubuntu vps and I have 2 IPs available. I'd like that my postfix can access to my others ips, and use them randoomly.

How can I do this?

For example: main IP: other IP: second ip :

share|improve this question

marked as duplicate by Michael Hampton, Dave M, mdpc, Khaled, Iain Mar 11 '13 at 12:41

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Please don't send spam, nor ask us how to send spam. – Michael Hampton Mar 9 '13 at 17:03
who told you i will send spam? you just talk without knowing the background. – Omer Stimpack Mar 9 '13 at 17:08
Why would you want to send from multiple IPs? I can't think of any legitimate reason for doing so. – Grant Mar 9 '13 at 19:18

Configure the interface binding via: postconf -e "inet_interfaces = all

See man postconf

inet_interfaces (default: all) The network interface addresses that this mail system receives mail on. Specify "all" to receive mail on all network interfaces (default), and "loopback-only" to receive mail on loopback network interfaces only (Postfix version 2.2 and later). The parameter also controls delivery of mail to user@[ip.address].

Note 1: you need to stop and start Postfix when this parameter changes.

Note 2: address information may be enclosed inside [], but this form is not required here.

When inet_interfaces specifies just one IPv4 and/or IPv6 address that is not a loopback address, the Postfix SMTP client will use this address as the IP source address for outbound mail. Support for IPv6 is available in Postfix version 2.2 and later.

On a multi-homed firewall with separate Postfix instances listening on the "inside" and "outside" interfaces, this can prevent each instance from being able to reach remote SMTP servers on the "other side" of the firewall. Setting smtp_bind_address to avoids the potential problem for IPv4, and setting smtp_bind_address6 to :: solves the prob‐ lem for IPv6.

A better solution for multi-homed firewalls is to leave inet_interfaces at the default value and instead use explicit IP addresses in the SMTP server definitions. This preserves the Postfix SMTP client's loop detection, by ensuring that each side of the firewall knows that the other IP address is still the same host. Setting $inet_interfaces to a sin‐ gle IPv4 and/or IPV6 address is primarily useful with virtual hosting of domains on secondary IP addresses, when each IP address serves a different domain (and has a different $myhostname setting).

See also the proxy_interfaces parameter, for network addresses that are forwarded to Postfix by way of a proxy or address translator.


 inet_interfaces = all (DEFAULT)
 inet_interfaces = loopback-only (Postfix version 2.2 and later)
 inet_interfaces =
 inet_interfaces =, [::1] (Postfix version 2.2 and later)
 inet_interfaces =,

postconf -e is an utility programm to maintain the postfix configuration.

-e Edit the configuration file, and update parameter set‐ tings with the "name=value" pairs on the postconf(1) command line. The file is copied to a temporary file then renamed into place. Specify quotes to protect special characters and white‐ space on the postconf(1) command line.

Any configuration changes needs to be recognized a restart of postfix.

share|improve this answer
When i use this command postconf -e "inet_interfaces = all nothing appair so how can i configure it with this command? – Omer Stimpack Mar 10 '13 at 1:53
@CjayOmar see update – H.-Dirk Schmitt Mar 10 '13 at 14:42

This is a config blog from /etc/postfix/ that should work for all interfaces on a machine.

myhostname = my_machine_name
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = my_machine_name, localhost.localdomain, localhost
relayhost =
mynetworks = [::ffff:]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = ipv4

If you are in Ubuntu you can run the following to reconfigure Postfix via a wizard:

sudo dpkg-reconfigure postfix

Why would these solutions not work for you?

EDIT: Run ifconfig on your machine and check the inet addr connected to each interface on that machine. If you do not see or there, then your machine cannot see either address so the postfix config is meaningless.

share|improve this answer
Only one line from that config should be in this answer. The rest of them are unnecessary noise. – Ladadadada Mar 10 '13 at 1:22
do you mean this one ̉inet_interfaces =,, do esnt work it says when i restart postfix this error : postfix: fatal: parameter inet_interfaces: no local interface found for – Omer Stimpack Mar 10 '13 at 12:01
Check my edit to the answer. If it is set to all then any IP connected to that machine would be valid. So you should be able to just use it out of the box. If you are specifying an address and it fails with no interface then that IP doesn’t even exist as far as the machine is concerned or postfix is concerned. – JakeGould Mar 10 '13 at 16:10
You are right bro i have added interfaces and my ips appair, so how can i make postfix rotate them ? – Omer Stimpack Mar 11 '13 at 11:43
Bro? Good luck, dude. – JakeGould Mar 11 '13 at 15:13

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