internal e-mail server and nat (503 error)

Hello and welcome,
I’m trying to set an email address within my network (192.168.4.0/24 gate 192.168.4.1, email server 192.168.4.103).

I have a public IP address that the entire network accesses. The email server is located inside the network and has dst-nat rules set on it.

Generally, sending and receiving emails works, DNS records are set. However, there was a problem with delivering messages to external hosting. When the server is online, messages that should arrive receive the phrase “503 This mail server requires authentication when attempting to send to non-local e-mail address”.

I suspect that the problem is the NAT settings, which capture all ports to the mail and therefore it does not reach. Disabling them caused the e-mail (external) to start working.

Do you have any hints on how to solve this problem, or what have I set incorrectly in the navigation?

 ;;; EMAIL
      chain=dstnat action=dst-nat to-addresses=192.168.4.103 to-ports=587 protocol=tcp 
      in-interface-list=WAN dst-port=587 log=no log-prefix="" 

11 X  ;;; EMAIL
      chain=dstnat action=dst-nat to-addresses=192.168.4.103 to-ports=465 protocol=tcp 
      in-interface-list=WAN dst-port=465 log=no log-prefix="" 

12 X  ;;; EMAIL
      chain=dstnat action=dst-nat to-addresses=192.168.4.103 to-ports=143 protocol=tcp 
      in-interface-list=WAN dst-port=143 log=no log-prefix="" 

13 X  ;;; EMAIL
      chain=dstnat action=dst-nat to-addresses=192.168.4.103 to-ports=993 protocol=tcp 
      in-interface-list=WAN dst-port=993 log=no log-prefix=""


mailserver.png

Check domain.com DNS records, first MX record perhaps pointing to your network.

Hi, thank you for your answer :slight_smile:

DNS in domain.com is not a problem. This is external hosting and all DNS records are set by this provider. I only have influence on my subdomain, so I suspect that the nat rules are somehow intercepting all the packets that go to the e-mail ports and I don’t know how to separate them since the e-mail server is not on a public address :frowning:

up!

If you are sending mails trough externally hosted mailserver domain.com from PC which is not in your LAN, your router is not involved at all. That was the reason for my question about MX records. If you suspect router configuration, something is wrong in your diagram and explanations.