Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Email server behind pfSense

    Scheduled Pinned Locked Moved NAT
    69 Posts 5 Posters 29.8k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      podilarius
      last edited by

      Nahid,
      That is going to depend on the type of email servers you are using. I use 2 email server types; Exchange and Zimbra. The setup for something like this is different in each, but it is possible. I asked to try to figure out what you are trying to accomplish. Are you in control of the 94.55 address where the external mail server is?

      1 Reply Last reply Reply Quote 0
      • N
        nahid
        last edited by

        We use MerakMail (IceWarp) mail server. My email Server is installed in a local machine with IP 10.10.1.5. The ISP provider has given us some static IP those we use for our servers. For example 94.55.59.129 is for our webserver but webserver is in our local ip with 10.10.1.11. I natted the 80 port with 94.55.59.129 and it is working with no problem. The same thing I want do is to send from and get mails from 10.10.1.5 but it should use 94.55.59.130 as permitted sender.

        I have also natted the IMAP, POP3, and SMTP port forwarding. Could you please describe me the configuration that I need to send mail from 10.10.1.5 behind the pfSense but using the MX record of 94.55.59.130.

        If you need further information please let me know.

        1 Reply Last reply Reply Quote 0
        • P
          podilarius
          last edited by

          Ah .. okay I see. Looking at the advanced outbound rule you posted, it seems wrong. As the others stated, you need to put this rule above all others in the AON screen. You also need to change the destination port to blank (any). Your server is going to be responding to request on high port with a source port of 25. As others have stated, you also need to change the interface to WAN.
          I would open it up first and then lock it down so i would do:

          Interface: WAN
          Source: INTERNALMAILSERVER
          SPort: any
          Destination: any
          DPort: any
          NAT Address: SESRICMailServer
          NAT Port: blank (any)

          If that works, then just change SPort to 25 if you only want to NAT smtp.

          1 Reply Last reply Reply Quote 0
          • N
            nahid
            last edited by

            You can get the configuration picture attached.

            PortForward.png
            PortForward.png_thumb
            rules.png
            rules.png_thumb
            OutBoundNAT.png_thumb
            OutBoundNAT.png

            1 Reply Last reply Reply Quote 0
            • N
              nahid
              last edited by

              Will the above configuration work or is there anything wrong?

              1 Reply Last reply Reply Quote 0
              • P
                podilarius
                last edited by

                The configuration from the pics looks good. If it is not working, try restarting the FW.

                1 Reply Last reply Reply Quote 0
                • marcellocM
                  marcelloc
                  last edited by

                  Nahid,

                  You have two nats for the same port 80. It will not work.

                  The rest of your config is fine but you may need to test with bogons rules disabled on wan interface.

                  Treinamentos de Elite: http://sys-squad.com

                  Help a community developer! ;D

                  1 Reply Last reply Reply Quote 0
                  • P
                    podilarius
                    last edited by

                    @marcelloc:

                    Nahid,

                    You have two nats for the same port 80. It will not work.

                    The rest of your config is fine but you may need to test with bogons rules disabled on wan interface.

                    They are to 2 different servers and 2 hopefully different internal ips (different aliases), so it should be okay.

                    1 Reply Last reply Reply Quote 0
                    • marcellocM
                      marcelloc
                      last edited by

                      @podilarius:

                      They are to 2 different servers and 2 hopefully different internal ips (different aliases), so it should be okay.

                      That's right podilarius, if web server and mailserver are different wan ip's the nat is fine.

                      nahid,

                      Did you changed you pfsense gui port as well disabled webConfigurator redirect rule  on system-> advanced?

                      Treinamentos de Elite: http://sys-squad.com

                      Help a community developer! ;D

                      1 Reply Last reply Reply Quote 0
                      • N
                        nahid
                        last edited by

                        marcelloc,

                        I have done that what you have said. And as podilarius said I have 2 different IP both internally and externally for the respective servers.
                        I am going to test now whether the above mentioned configuration is working or not.

                        1 Reply Last reply Reply Quote 0
                        • chpalmerC
                          chpalmer
                          last edited by

                          nahid-

                          I assume you have set up a VIP for each of your public IP address you intend to use…??

                          Triggering snowflakes one by one..
                          Intel(R) Core(TM) i5-4590T CPU @ 2.00GHz on an M400 WG box.

                          1 Reply Last reply Reply Quote 0
                          • N
                            nahid
                            last edited by

                            chpalmer,

                            What I have to do? I have to create Virtual IP for my Email Server or Aliases is ok?

                            Could you please explain.

                            1 Reply Last reply Reply Quote 0
                            • N
                              nahid
                              last edited by

                              marcelloc,

                              _"
                              nahid,

                              Did you changed you pfsense gui port as well disabled webConfigurator redirect rule  on system-> advanced?"_

                              I haven't changed it? Do I have to change it? or it ok?

                              1 Reply Last reply Reply Quote 0
                              • marcellocM
                                marcelloc
                                last edited by

                                @nahid:

                                I haven't changed it? Do I have to change it? or it ok?

                                yes, config these steps to avoid problems on port 80 nat.

                                Treinamentos de Elite: http://sys-squad.com

                                Help a community developer! ;D

                                1 Reply Last reply Reply Quote 0
                                • chpalmerC
                                  chpalmer
                                  last edited by

                                  @marcelloc:

                                  @nahid:

                                  I haven't changed it? Do I have to change it? or it ok?

                                  yes, config these steps to avoid problems on port 80 nat.

                                  Marcello-    he needs a VIP for that external IP doesn't he??

                                  Triggering snowflakes one by one..
                                  Intel(R) Core(TM) i5-4590T CPU @ 2.00GHz on an M400 WG box.

                                  1 Reply Last reply Reply Quote 0
                                  • marcellocM
                                    marcelloc
                                    last edited by

                                    @chpalmer:

                                    Marcello-    he needs a VIP for that external IP doesn't he??

                                    The aliases on screen shots suggest that vip/ip alias are configured.

                                    Treinamentos de Elite: http://sys-squad.com

                                    Help a community developer! ;D

                                    1 Reply Last reply Reply Quote 0
                                    • N
                                      nahid
                                      last edited by

                                      Marcello,

                                      I am still not sure that what I have to use. Virtual IP or Aliases for my External Mail server forwarding or both of them are ok?

                                      1 Reply Last reply Reply Quote 0
                                      • marcellocM
                                        marcelloc
                                        last edited by

                                        With one firewall, use IP alias. Firewall -> virtual ip-> IP alias

                                        Treinamentos de Elite: http://sys-squad.com

                                        Help a community developer! ;D

                                        1 Reply Last reply Reply Quote 0
                                        • N
                                          nahid
                                          last edited by

                                          Marcello,

                                          When I configure OutBound NAT InternalMailServer with the Virtual IP (IP Aliases) IntrnalMailServer (10.10.1.5) could not able to access Internet. Actually it should access through the Internet with its external ip I mean with the virtual ip that configured for it.

                                          How can I solve this?

                                          1 Reply Last reply Reply Quote 0
                                          • N
                                            nahid
                                            last edited by

                                            Thanks to everybody, the problem has solved through creating the virtual ip as IP Aliases and then NAT them as 1:1 with internal mail server.

                                            Now I want to use Postfix Forwarder with MailScanner.

                                            Marcello, could you please help me to configuring these packages? If possible please give me some screen shots of settings.

                                            Thanks in advance.

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.