Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
Hi, I set up a mail server behind NAT router using dyndns. All necessary ports have been forwarded. Sending mails from my network using the servers IP as SMTP Server ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2011
    Posts
    3

    Postfix and sending Mail from "outside" of my LAN doenst work


    Hi,

    I set up a mail server behind NAT router using dyndns. All necessary ports have been forwarded.

    Sending mails from my network using the servers IP as SMTP Server 192.168.16.11 works fine and mail will be send out. But how can I send mails from the outside over my dyndnsserver?

    In main.cf "mynetworks" I define, what belongs to me and from whom the server should accept SMTP tasks. I set "mynetworks = all" without any luck.


    See my /etc/postfix/main.cf below
    Code:
    # See /usr/share/postfix/main.cf.dist for a commented, more complete version
    
    
    # Debian specific:  Specifying a file name will cause the first
    # line of that file to be used as the name.  The Debian default
    # is /etc/mailname.
    #myorigin = /etc/mailname
    
    smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
    biff = no
    
    # appending .domain is the MUA's job.
    append_dot_mydomain = no
    
    # Uncomment the next line to generate "delayed mail" warnings
    #delay_warning_time = 4h
    
    readme_directory = no
    
    # TLS parameters
    smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
    smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
    smtpd_use_tls=yes
    smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
    smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
    
    # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
    # information on enabling SSL in the smtp client.
    
    myhostname = server
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    myorigin = /etc/mailname
    mydestination = server, localhost.localdomain, localhost
    relayhost = localhost 
    mynetworks = 127.0.0.0/8, 192.168.16.0/24 
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = 127.0.0.1, 192.168.16.11
    inet_protocols = ipv4
    
    sender_dependent_relayhost_maps = hash:/etc/postfix/relaymap
    smtp_sender_dependent_authentication = yes
    smtp_sasl_auth_enable = yes
    smtp_sasl_password_maps = hash:/etc/postfix/passes
    smtp_sasl_security_options = noanonymous
    
    mailbox_transport = lmtp:unix:/var/run/cyrus/socket/lmtp
    I hope somebody knows what I am doing wrong

  2. #2
    Linux Enthusiast Mudgen's Avatar
    Join Date
    Feb 2007
    Location
    Virginia
    Posts
    664
    I'm a sendmail guy, so I'll leave remarks on your postfix config to others. But what happens if you
    telnet dyndnsname 25
    from outside? Substituting your actual DNS name, of course. And does anything get logged on the server?

  3. #3
    Just Joined!
    Join Date
    Apr 2007
    Posts
    1

    Cool

    Hi Thomas,

    You will have to set relayhost = IP address of your DYnDNS,

    So it will relay all the mails thru it and your mail won't get in spam of receivers mailbox.

    Thanks
    Meghraj

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Jun 2011
    Posts
    3
    telnet myadress.dyndns.org 25 works and opens
    Code:
    220 Server ESMTP Postfix <Ubuntu>
    so does telnet 192.168.16.11 25. Loggin is on in /var/log/mail.log. All mail being send over servers IP 192.168.16.11 are logged here, but no error is logged when trying do send over dyndns.

    @meghraj
    I would be glad if my mails would end in users spam folder. At the moment I can not even send them there I cant set the IP adress of dyndns to "relayhost = " because is is dynamic. Changes every day.

  6. #5
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    Location
    The Keystone State
    Posts
    2,677
    Do you have an mx record setup for your mail server and is it working correctly?

    Regards
    Robert

    Linux
    The adventure of a life time.

    Linux User #296285
    Get Counted

  7. #6
    Just Joined!
    Join Date
    Feb 2006
    Posts
    5
    I was trying to help you by posting link to a blog and then my config file, but linuxquestions says I can't post URLs before making 15 posts. I am not posting URLs I was posting references to help you... well I use dnsexit and not dyndns to update A record for my dynamic IP. Other than that you will need to set up SMTP AUTH if you want to relay mail from anywhere in the world. Alternatively, you can use certs.

  8. #7
    Just Joined!
    Join Date
    Jun 2011
    Posts
    3
    Dont have an mx record and no doamin for my mailserver set. Will look into SMTP AUTH next week. I am on vacation for some days now - thanks for you help so far.

  9. #8
    Linux Newbie nplusplus's Avatar
    Join Date
    Apr 2010
    Location
    Charlotte, NC, USA
    Posts
    106
    thomas1977,

    "mynetworks = 127.0.0.0/8, 192.168.16.0/24" will keep all systems except localhost and your local 192.168.16.0/24 subnet from relaying mail through your setup. You will need to add an entry for any other networks or hosts you want to allow. If you are adding one host, then the addition will be the IP of the host you want to add with "/32" at the end. For instance...

    mynetworks = 127.0.0.0/8, 192.168.16.0/24, 1.1.1.1/32

    By the way, great job for choosing Postfix. I love it!

    N++

  10. #9
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    Location
    The Keystone State
    Posts
    2,677
    You are going to need an MX record in order for internet mail to reach your domain.

    Regards
    Robert

    Linux
    The adventure of a life time.

    Linux User #296285
    Get Counted

  11. #10
    Linux Enthusiast Mudgen's Avatar
    Join Date
    Feb 2007
    Location
    Virginia
    Posts
    664
    Quote Originally Posted by Lazydog View Post
    You are going to need an MX record in order for internet mail to reach your domain.
    Not according to RFC2821 (and my experience). An A record will suffice if the server is directly deliverable, as it appears to be from OP's telnet results.

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •