Ausgehende IP von Postfix festlegen

casper99
Posts: 18
Joined: 2006-05-04 07:56

Ausgehende IP von Postfix festlegen

Post by casper99 »

Hi Leute,

ich habe auf meinem Debian 3.1 ein Postfix Server am laufen.
Der Server besitzt mehrere IP Adressen, die als Subinterfaces eingetragen sind.
Postfix schickt mails jedoch immer von der Quell-IP des Hauptinterfaces "eth0".
Kann man die IP nach aussen fest vergeben?
Top

flo
RSAC
Posts: 2297
Joined: 2002-07-28 13:02
Location: Berlin

Re: Ausgehende IP von Postfix festlegen

Post by flo »

http://www.postfix.org/postconf.5.html#inet_interfaces

und dann setzt Du in der Master.cf (wenn Du möchtest) noch Instanzen für die anderen IPs auf, wenn Postfix darauf auch lauschen soll ...

flo.
Top

lord_pinhead
RSAC
Posts: 830
Joined: 2004-04-26 15:57

Re: Ausgehende IP von Postfix festlegen

Post by lord_pinhead »

Edit:
Flo war schneller, hatte es kurz mit dem SMTP Client verwechselt.
Top

duergner
RSAC
Posts: 976
Joined: 2003-08-20 11:30
Location: Pittsburgh, PA, USA

Re: Ausgehende IP von Postfix festlegen

Post by duergner »

Was er sucht ist meiner Meinung nach smtp_bind_address da er eine Moeglichkeit sucht, die *ausgehende* IP festzulegen.
Top

flo
RSAC
Posts: 2297
Joined: 2002-07-28 13:02
Location: Berlin

Re: Ausgehende IP von Postfix festlegen

Post by flo »

Den Parameter kannte ich gar nicht - aber allzu aussagefähig ist die Doku da auch nicht, meiner Meinung nach beeinflußt doch inet_interfaces auch die outgoin IP?

flo.
Top

User avatar
Joe User
Project Manager
Project Manager
Posts: 11518
Joined: 2003-02-27 01:00
Location: Hamburg

Re: Ausgehende IP von Postfix festlegen

Post by Joe User »

http://www.postfix.org/postconf.5.html wrote: 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 recommended 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 servers on the "other side" of the firewall. Setting smtp_bind_address to 0.0.0.0 avoids the potential problem for IPv4, and setting smtp_bind_address6 to :: solves the problem 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 master.cf 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 single 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).

[...]

smtp_bind_address (default: empty)

An optional numerical network address that the Postfix SMTP client should bind to when making an IPv4 connection.

This can be specified in the main.cf file for all SMTP clients, or it can be specified in the master.cf file for a specific client, for example:

/etc/postfix/master.cf:
smtp ... smtp -o smtp_bind_address=11.22.33.44

Note 1: when inet_interfaces specifies no more than one IPv4 address, and that address is a non-loopback address, it is automatically used as the smtp_bind_address. This supports virtual IP hosting, but can be a problem on multi-homed firewalls. See the inet_interfaces documentation for more detail.

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

smtp_bind_address6 (default: empty)

An optional numerical network address that the Postfix SMTP client should bind to when making an IPv6 connection.

This feature is available in Postfix 2.2 and later.

This can be specified in the main.cf file for all SMTP clients, or it can be specified in the master.cf file for a specific client, for example:

/etc/postfix/master.cf:
smtp ... smtp -o smtp_bind_address6=1:2:3:4:5:6:7:8

Note 1: when inet_interfaces specifies no more than one IPv6 address, and that address is a non-loopback address, it is automatically used as the smtp_bind_address6. This supports virtual IP hosting, but can be a problem on multi-homed firewalls. See the inet_interfaces documentation for more detail.

Note 2: address information may be enclosed inside [], but this form is not recommended here.
PayPal.Me/JoeUserFreeBSD Remote Installation
Wings for LifeWings for Life World Run

„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Top

casper99
Posts: 18
Joined: 2006-05-04 07:56

Re: Ausgehende IP von Postfix festlegen

Post by casper99 »

Ja genau, duergner hatte Recht.
Vielen Dank.

Durch ein anpassen von "smtp" in der master.cf
mit "smtp_bind_address" wurde mein Problem gelöst,
und Postfix meldet sich jetzt gegenüber anderen Mailservern beim Senden auch mit der richtigen IP.

Vielen Dank an alle
Top

duergner
RSAC
Posts: 976
Joined: 2003-08-20 11:30
Location: Pittsburgh, PA, USA

Re: Ausgehende IP von Postfix festlegen

Post by duergner »

Den Parameter kann man auch in die main.cf schreiben soweit ich weiss. (Nur noch so am Rande)
Top

casper99
Posts: 18
Joined: 2006-05-04 07:56

Re: Ausgehende IP von Postfix festlegen

Post by casper99 »

Ja, hab ich auch versucht, aber das macht Probleme in Verbindung mit Amavisd-new
Top