3

Question: When specifying 2 or more address for the inet_interfaces directive, will postfix still bind outgoing mail to one of them?

The postfix docs state:

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.

Due to the need for a loopback address I need to be able to bind to either 127.0.0.1 or my WAN address depending on mail destination. My current setting is:

inet_interfaces = 23.45.67.89, [2600:1234::1234:5678:abcd:abcd], 127.0.0.1

Previously I had used smtp_bind_address and smtp_bind_address6 but was causing problems since postfix needs to access loopback for local mail delivery.

Also, I do in fact have 5 static IPv4 addresses for this server, hence the desire to only use one of them. Since the docs state just one IPv4 and/or IPv6 I'm unsure whether specifying all three will ensure that outgoing mail is bound to anything at all.

Eaten by a Grue
  • 282
  • 4
  • 22

1 Answers1

3

Question: When specifying 2 or more address for the inet_interfaces directive, will postfix still bind outgoing mail to one of them?

No

Parameter inet_interfaces is consulted if inet_interfaces specifies just one IPv4 and/or IPv6 address that is not a loopback address. When inet_interfaces doesn't satisfy that, postfix will use treat smtp_bind_address as default. There are no docs mentioned that smtp_bind_address will use one of address specify in inet_interfaces

Source: Postfix source code, especially in smtp_connect.c and postfix documentation.

masegaloeh
  • 17,978
  • 9
  • 56
  • 104
  • thanks, and if `smtp_bind_address` is not specified? Is it just a coin toss at this point or will the addresses specified in `inet_interfaces` have any effect on which one is used? – Eaten by a Grue May 06 '15 at 04:13
  • 1
    The socket will use the first IP it finds that has an available route to the server IP being connected to. See [postfix configuration and Received from](http://serverfault.com/a/676158/218590) – masegaloeh May 06 '15 at 04:28