Configure postfix for 1 external ip to send email

Discussion in 'Installation/Configuration' started by Roland Megens, Sep 11, 2009.

  1. Roland Megens

    Roland Megens New Member

    Followed this tutorial: http://www.howtoforge.com/virtual-users-and-domains-postfix-courier-mysql-centos5.1, and everything is working fine on my local network.
    What I want to achieve: allow 1 external ip (at work) to send email to anywhere (recieving mails is no prob) with windows mail, i googled allot, but i can't figure it out, i think postfix is not allowing to do what i want :confused:

    I quite a noob with linux :eek:

    telnet 192.168.0.198 25 -> working, so i can locally telnet to server
    (response: 220 server.bla.nl ESMTP Postfix)

    telnet 12.34.45.67 25 -> NOT working, can't telnet from outside (external)
    sending email, local network - working
    sending email, external - not working (email client, server requires login activated)

    No errors in mail.log
    Sep 11 21:46:39 server pop3d: Connection, ip=[x.x.x.x]
    Sep 11 21:46:39 server pop3d: LOGIN, [email protected], ip=[x.x.x.x], port=[55749]
    Sep 11 21:46:39 server pop3d: LOGOUT, [email protected], ip=[x.x.x.x], port=[55749], top=0, retr=0, rcvd=12, sent=39, time=0

    main.cf:
    readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
    myhostname = server.bla.nl
    mynetworks = 127.0.0.0/8 192.168.0.0/24 12.34.56.79
    #
    #12.34.56.79 ip at work
    #
    virtual_alias_domains =
    virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf
    virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
    virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
    virtual_mailbox_base = /home/vmail
    virtual_uid_maps = static:5000
    virtual_gid_maps = static:5000
    smtpd_sasl_auth_enable = yes
    broken_sasl_auth_clients = yes
    smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
    smtpd_use_tls = yes
    smtpd_tls_cert_file = /etc/postfix/smtpd.cert
    smtpd_tls_key_file = /etc/postfix/smtpd.key
    transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
    virtual_create_maildirsize = yes
    virtual_maildir_extended = yes
    virtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cf
    virtual_mailbox_limit_override = yes
    virtual_maildir_limit_message = "The user you are trying to reach is over quota."
    virtual_overquota_bounce = yes
    proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
    content_filter = amavis:[127.0.0.1]:10024
    receive_override_options = no_address_mappings
     
    Last edited: Sep 15, 2009
  2. falko

    falko Super Moderator Howtoforge Staff

    Please add the external IP to mynetworks in /etc/postfix/main.cf and restart Postfix.
     
  3. Roland Megens

    Roland Megens New Member

    I already did, the external ip (example) of work: 12.34.56.79

    mynetworks = 127.0.0.0/8 192.168.0.0/24 12.34.56.79


    so the external ip where i want to send email from is already in mynetworks

    from outside / external i can't telnet on port 25, from the local network telnet port 25 is working, something is blocking acces, for sure it is not firewall or router

    configured postfix to listen also on port 2525, no response also
     
    Last edited: Sep 12, 2009
  4. falko

    falko Super Moderator Howtoforge Staff

    Try 12.34.56.79/32
     
  5. Roland Megens

    Roland Megens New Member

    changed:
    mynetworks = 127.0.0.0/8 192.168.0.0/24 12.34.56.79

    to:
    mynetworks = 127.0.0.0/8 192.168.0.0/24 12.34.56.79/32

    doesn't change anything, the help is very appreciated
     
  6. falko

    falko Super Moderator Howtoforge Staff

    Does your ISP maybe block port 25?
     
  7. Roland Megens

    Roland Megens New Member

    My provider blockes port 25 when you have a dynamic ip, I have a static ip and port 25 is should be open, tested it with different websites, all "test" sites say port 25 is open, can't figure out what is going on, locally everything works well.

    Feel free to test:

    server.humaheftruck.nl

    ip: 88.159.160.114

    followed a tutorial to change to port smtp 2525, and again, locally everything is fine, from external can't get in.
     
  8. falko

    falko Super Moderator Howtoforge Staff

    I'm able to connect:

    Code:
    mh1:~# telnet server.humaheftruck.nl 25
    Trying 88.159.160.114...
    Connected to server.humaheftruck.nl.
    Escape character is '^]'.
    220 server.humaheftruck.nl ESMTP Postfix
    ehlo localhost
    250-server.humaheftruck.nl
    250-PIPELINING
    250-SIZE 10240000
    250-VRFY
    250-ETRN
    250-STARTTLS
    250-AUTH PLAIN LOGIN
    250-AUTH=PLAIN LOGIN
    250-ENHANCEDSTATUSCODES
    250-8BITMIME
    250 DSN
    quit
    221 2.0.0 Bye
    Connection closed by foreign host.
    mh1:~#
     
  9. Roland Megens

    Roland Megens New Member

    hmm, still not working from work, maybe provider work is blocking port 25, will try to figure that out

    Thanks for the help so far.
     
    Last edited: Sep 16, 2009
  10. Roland Megens

    Roland Megens New Member

    Spend a few hours figuring it out, isp of work blocks ALL trafic over port 25. Trying to setup postfix so it works on port 25 AND 587, no luck yet
     
  11. Roland Megens

    Roland Megens New Member

    In my router :) linked port 587 to 25 and that solved it :)

    wish i knew litlle bit more of linux, can't figure out why i can't get postfix to listen on port 25 AND 587
     

Share This Page