Problem with sending mail from 2 domains on same IP in master.cf

Discussion in 'ISPConfig 3 Priority Support' started by Petar, May 9, 2022.

  1. Petar

    Petar Member HowtoForge Supporter

    Dear colleagues,

    Please help me find the mistake or misconfiguration of my postfix/master.cf
    My main goal is for the domains hosted on the server to send messages from their own domain and not from the servers main domain.
    Lets say that the servers domain is mail.server.com and the 2 hosted domains are domain1.com and domain2.com with their mail.domain1.com and mail.domain2.com mail server settings.
    This is all achievable if i use different IP addresses for the hosted domains, but when hosting them all on the same IP address i get:

    warning: duplicate master.cf entry for service "123.123.123.123:smtp" ([123.123.123.123]:25) -- using the last entry

    and all the mail is send from the last mentioned mail sender in master.cf

    the part from /etc/postfix/master.cf

    127.0.0.1:smtp inet n - n - - smtpd
    -o myhostname=localhost
    -o syslog_name=postfix-localhost
    -o smtp_helo_name=localhost
    -o smtp_bind_address=127.0.0.1
    -o myhostname=localhost
    123.123.123.123:smtp inet n - n - - smtpd
    -o myhostname=mail.domain1.com
    -o smtp_bind_address=123.123.123.123
    -o syslog_name=postfix-mail.domain1.com
    -o smtp_helo_name=mail.domain1.com
    123.123.123.123:smtp inet n - n - - smtpd
    -o myhostname=mail.domain2.com
    -o smtp_bind_address=123.123.123.123
    -o syslog_name=postfix-mail.domain2.com
    -o smtp_helo_name=mail.domain2.com

    domain1-out unix - - n - - smtp
    -o smtp_bind_address=123.123.123.123
    -o smtp_helo_name=mail.domain1.com
    -o syslog_name=postfix-mail.domain1.com
    domain2-out unix - - n - - smtp
    -o smtp_bind_address=123.123.123.123
    -o smtp_helo_name=mail.domain2.com
    -o syslog_name=postfix-mail.domain2.com
     
  2. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

  3. Petar

    Petar Member HowtoForge Supporter

    Hi Th0m, thanks for the answer.
    Yes this is what i would like to achieve, but i couldn't successes with one IP address.
    Your links doesn't provide the needed solution.
    The one that i was trying works with separate IP's per domain, but not when they are on the same...
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Postfix uses the system hostname when it connects to other systems, not virtual domains hosted on that server. I don't think that you can use the same IP multiple times to bind postfix for them to fake the sender's hostname. You either need one IP per domain or you use a central system hostname as it's normally done on mail systems.
     
    Th0m likes this.
  5. Petar

    Petar Member HowtoForge Supporter

    OK thank you for clarification, both of you Th0m and Till.
    I thought that its possible and that i have some mistake at the settings.
    Will get back to standard setting with servers hostname and adding it to spf of the domain.

    Thanks for your time and help
     

Share This Page