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.9k 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.
    • chpalmerC
      chpalmer
      last edited by

      You need to provide a little more info…    :)

      Do you have more than 1 WAN IP?

      Are you using the WAN IP for only this server?

      And you might include the other server I just noticed in your other post. Since this is the same subject, can you please keep it all in one place??  Thanks!  ;)

      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

        This is the Network you can find in the attachment.

        Network.png
        Network.png_thumb

        1 Reply Last reply Reply Quote 0
        • johnpozJ
          johnpoz LAYER 8 Global Moderator
          last edited by

          You still haven't answered the question.. You say your WAN IP is 94.54, but then your email is 94.55

          So you own 2 class B?  Has your ISP routed multiple segments to you?  They gave you disjointed multiple IPs?

          Or is that just a typo??

          An intelligent man is sometimes forced to be drunk to spend time with his fools
          If you get confused: Listen to the Music Play
          Please don't Chat/PM me for help, unless mod related
          SG-4860 24.11 | Lab VMs 2.8, 24.11

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

            If you have valid ips on pfsense as well on servers, you do not need nat, just need firewall rules.

            If your email server runs windows, I suggest you to take a look at postfix forwarder package to protect you mail system.

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

            Help a community developer! ;D

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

              Thanks marcelloc,

              I will try to use postfix forwarder package. What can I use as anti-spam with postfix?

              I tried with Firewall rules for the ports IMAP, POP3 and SMTP individually defining them but when mails sent from the it shows that the mail server ip was not 94.55.x.x instead it took the firewall ip as 94.54.x.x. How can I solve the problem.

              If I create the virtual ip with the External email server ip 94.55.x.x and then make individually port forwarding for IMAP, POP3 and SMTP will it work? what do you think?

              Thanks for your advice.

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

                johnpoz,

                The ISP provided a 16 block of IP for using our servers from same block and gave 1 ip from another block for our firewall. This situation was predefined.

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

                  @nahid:

                  I will try to use postfix forwarder package. What can I use as anti-spam with postfix?

                  postfix package has a lot of antispam features but you can install mailscanner package too.

                  @nahid:

                  I tried with Firewall rules for the ports IMAP, POP3 and SMTP individually defining them but when mails sent from the it shows that the mail server ip was not 94.55.x.x instead it took the firewall ip as 94.54.x.x. How can I solve the problem.

                  to use firewall ip as mx, you will need nat or postfix forwarder package

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

                  Help a community developer! ;D

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

                    "to use firewall ip as mx, you will need nat or postfix forwarder package"

                    I need mail server ip (94.55.x.x) as mx. In this case is it possible to configure it from postfix package?

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

                      @nahid:

                      "to use firewall ip as mx, you will need nat or postfix forwarder package"

                      I need mail server ip (94.55.x.x) as mx. In this case is it possible to configure it from postfix package?

                      postfix will use server address, if you have 94.55. IP on pfsense, it will work

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

                      Help a community developer! ;D

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

                        Dear marcelloc,

                        Don't mind. Actually I am very new in pfSense. What do you mean by 94.55.x.x ip in pfSense? My WAN IP is 94.54.x.x and my internal mail server configured as 10.10.1.5. Domain MX record is on 94.55.x.x and I want to send and receive mail through 94.55.x.x

                        I checked the postfix forwarder option that takes the Domain name and ip. If I put the domain name and ip (94.55.x.x) there will it work?

                        Thanks for your help.

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

                          nahid,

                          You network diagram shows internal and external ips on your mail server. If this ip is an alias on your pfsense, you just need to configure this alias to postfix forwarder and make an outbound nat (firewall -> nat) to force exchange outgoing ip address to be the same as mx.

                          att,
                          Marcello Coutinho

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

                          Help a community developer! ;D

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

                            Thanks Marcello Coutinho.

                            I will do exactly what you have told on Saturday.

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

                              Marcello,

                              How can I configure an aliases in postfix forwarder? Is it the domain where I can give the aliases ip address or something else?

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

                                @nahid:

                                Marcello,

                                How can I configure an aliases in postfix forwarder? Is it the domain where I can give the aliases ip address or something else?

                                on domain tab you specify internal domains as well internal ips.

                                do you mean domain aliases like mydomain.com and domain2.com?

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

                                Help a community developer! ;D

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

                                  Dear marcelloc,

                                  I tried how you told to configure it but could able to send email as it marked the wan IP address as spam. I inspected the email headers and it showed that the email was sent from ip address 94.54.x.x what is not my email server ip.

                                  I configured the outbound nat but it failed to send over Email Server IP

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

                                    Using you internal mail server only and having you mx IP as an alias on your pfsense, an outbound nay should work.  Remember to configure outbound Nat mode to manual.

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

                                    Help a community developer! ;D

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

                                      Dear Marcelloc,

                                      Attached picture where you can find my config. Is there any mistakes there?

                                      outbountnat.png
                                      outbountnat.png_thumb
                                      outboundnatedit.png
                                      outboundnatedit.png_thumb

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

                                        Change interface to wan and place rule on top

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

                                        Help a community developer! ;D

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

                                          Dear marcelloc,

                                          I tried how you instructed but unsuccessful. Is there any way to solve this problem?

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

                                            Do you send email to the internal email server and then use the external as a forwarder, and then use the external as the public email mx and forward all inbound emails to the internal server?

                                            As marcelloc indicated, NAT rules work on first matching. So if the desired effect is below an undesired action, then you will need to move it to the top.

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