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

    Mail servers imap behind pfsense not reachable

    Scheduled Pinned Locked Moved Firewalling
    62 Posts 8 Posters 10.4k 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.
    • D
      daan
      last edited by

      Yes currently I only have a WAN and LAN.
      My 143 port is running on STARTTLS, clear text is not allowed.

      My ISP allows it, because with my previous router (not a pfsense router) it worked fine. Never had any problems.

      I just tried to capture packets, I think something is wrong I get TCP Retransmission in Wireshark. I do not know what it means, I want and am currently learning networking..

      GertjanG 1 Reply Last reply Reply Quote 0
      • GertjanG
        Gertjan @daan
        last edited by

        @daan said in Mail servers imap behind pfsense not reachable:

        wrong I get TCP Retransmission in Wireshark

        You pre selected
        Port 143
        Protocom TCP
        Interface : WAN
        right ?

        You will probably find the same traffic on the LAN side which implies that pfSense :: the NAT rule, is working correcly.

        Your IMAP server on LAN accepts connection from the LAN network, not connection from 'else where' like the Internet. Check this.

        No "help me" PM's please. Use the forum, the community will thank you.
        Edit : and where are the logs ??

        1 Reply Last reply Reply Quote 0
        • D
          daan
          last edited by daan

          Yes I did
          6b3620f5-4523-4ddf-9d7a-f2cd62d4ceaf-image.png

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

            Do a packet capture on your LAN port while someone tries to connect from outside and see if the traffic shows up there or not.

            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
            • D
              daan
              last edited by

              This is what I get, 192.168.1.118 is my pc.
              12:44:52.525535 IP 192.168.1.118.39414 > MY.IP.00.00.143: tcp 0

              The capture is full with these packets, no incoming packets found..

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

                @daan said in Mail servers imap behind pfsense not reachable:

                This is what I get, 192.168.1.118 is my pc.
                12:44:52.525535 IP 192.168.1.118.39414 > MY.IP.00.00.143: tcp 0

                Where Exactly are you sniffing for that? Sure isn't your wan of pfsens showing traffic getting to it.. Since the source is rfc1918, doesn't go over the internet.

                Step 1 in troubleshooting port forwarding is VALIDATION that traffic gets to wan of pfsense, pfsense can not forward something it never sees..

                Then validate it sends it on by sniffing on lan side of pfsense.. Here is example

                imap.png

                That is my wan... Here is sniff on lan side, showing sending to IP on inside.. And my machine sending back a RST

                rst.png

                After I setup a port forward.

                portforward.png

                Everything you need to troubleshoot port forwarding is here
                https://docs.netgate.com/pfsense/en/latest/troubleshooting/nat.html

                just use can you see me . org to send traffic from the outside.

                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
                • D
                  daan
                  last edited by

                  When I check for open LAN ports on 192.168.1.200 (My mail server IP, running in docker) I get the expected output.
                  67ba5462-6d0e-40ae-b795-0ad277009af9-image.png

                  When I check for open ports on " https://www.yougetsignal.com/tools/open-ports/ " the imap and smtp ports are all reachable.

                  And there is another weird thing, I have my mail setup on my phone. I do get notifications from my email app when I get a new mail (The title and part of the message is readable in the notification), but when I open the app the email is not there and it throws a IMAP connection error..

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

                    Dude I can not help you if you can not provide the simple info that would take you 10 seconds to provide.

                    Do a sniff on pfsense wan... Not go to can you see me . org.. put in 143 - do you see the packets on pfsense? If so,

                    Then sniff on the lan side and repeat the process.. If you see traffic going to your imap server rfc1918 IP.. Then pfsense has done its job.. .Whatever other issues you might be having nothing to do with the simple act of forwarding a port.

                    I just hit the IP you used to connect to the forum and it is answers via 143

                    Escape character is '^]'.
                    * OK [CAPABILITY IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE XLIST LITERAL+ STARTTLS LOGINDISABLED] Dovecot (Debian) ready.
                    

                    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
                    • D
                      daan
                      last edited by daan

                      Yes I know, when I do a packet capture on my WAN. I get an empty log
                      76a90efe-9310-4c75-923f-340bcb2ecc44-image.png

                      I know that the IMAP responds but I can't reach it with a E-Mail client

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

                        Well then you not sniffing on the right interface, or the correct port?

                        Are you using PPPoE for your connection?

                        Or maybe there is something in front of your device answering for these ports? If what your saying is pfsense never sees the traffic. Then you have something in front of pfsense answering?

                        If your not seeing loads of traffic when you sniff on your wan... Then your sniffing on the wrong interface or you have something wrong with your packet capture.. Do a simple tcpdump from pfsense console.

                        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
                        • D
                          daan
                          last edited by daan

                          I used these settings
                          c32204af-dda3-4113-9070-dc960b91e94d-image.png

                          Pfsense is hooked up straight to my ISP modem, my LAN interface goes to a layer 2 cisco switch, the mail server is attached to the switch

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

                            Well do it without 143, do you see lots of traffic?

                            If you see lots of normal traffic, and nothing on 143 - then something in front of pfsense is answering for 143..

                            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
                            • D
                              daan
                              last edited by

                              When I do not specify a port I see loads of traffic, HTTPS traffic

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

                                Well then 143 is not getting to pfsense, but something answers on your IP (one connected to the forum with)

                                Maybe your ISP intercepts this traffic... But if pfsense never sees traffic to 143, how could it ever forward it?

                                This is why step one in any sort of this troubleshooting, is to actually VALIDATE traffic is getting to pfsense.. Pfsense can not do anything with something it never sees.

                                You sure pfsense wan is public address? Its not a rfc1918 address?

                                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

                                V 1 Reply Last reply Reply Quote 0
                                • V
                                  viragomann @johnpoz
                                  last edited by

                                  @johnpoz said in Mail servers imap behind pfsense not reachable:

                                  This is why step one in any sort of this troubleshooting, is to actually VALIDATE traffic is getting to pfsense.

                                  Mentioned about eight times in this thread, but still seems to be ignored.

                                  1 Reply Last reply Reply Quote 0
                                  • D
                                    daan
                                    last edited by

                                    The mail server is on my current IP, but with my previous router it worked fine (Non pfsense).
                                    And yes I am 1000% sure my pfsense WAN IP is my public IP, because all of my websites running from this network are up and reachable.

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

                                      Well something is answering on his IP he is connecting to the forum with, which I would assume his IP... But from his packet capture - nothing is getting to pfsense..

                                      Pfsense can not forward what it does not see.. This is basic 101 stuff here..

                                      edit: I do not know what to tell you.. This is basic 101 stuff here, if you can not show us pfsense seeing the traffic on its wan... How could it ever do anything with it.. All I can tell you is something answers on 143 when I hit the IP you connected to the forum from..

                                      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
                                      • V
                                        viragomann @daan
                                        last edited by

                                        @daan said in Mail servers imap behind pfsense not reachable:

                                        When I do not specify a port I see loads of traffic, HTTPS traffic

                                        You can also limit the capture to multiple port by entering "143|587|993" for instance to take all IMAP ports.

                                        1 Reply Last reply Reply Quote 0
                                        • V
                                          viragomann @daan
                                          last edited by

                                          @daan
                                          You can check your real public IP on web services like https://whatismyipaddress.com

                                          The IP you get displayed there must match your pfSense WAN IP, otherwise there is a router in front of pfSense.

                                          1 Reply Last reply Reply Quote 0
                                          • D
                                            daan
                                            last edited by

                                            @viragomann I know my it is the same IP as the pfsense WAN interface IP

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