This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

SMTP relay and IPSec site-to-site VPN

Hello everyone,

I have two sites connected through site-to-site IPsec VPN. On both site, there is a mail server running. On of the site uses the Astaro box as a SMTP gateway for all mail while the other one only sends mail (directly, not through Astaro).

Just to make things clear, the mail flow (SMTP) was the following:

SMTP1 -[ASL1-ASL2 VPN]--> ASL2 --> SMTP2

Site 1 has all public IP addresses (it's a public site) while site 2 is using private IPs NATed by ASL2.

My problem is the following: up to now, the above setup worked but the tunnel was configured with the public IP addess of both ASL gateway in the list of published network for both side and gateways. This worked with connections going from ASL2 to ASL1 but not in the other direction.

So, we've fixed it by removing the firewalls public IPs from the VPN definition completely (both as published networks and gateway definitions). That solved the connectivity issue between site 1 and site 2 but now the mail server cannot connect to the ASL2's external SMTP port.

I've temporary fixed that by adding a stating entry in the host file of the SMTP1 server, but I need a more permanent fix.

Anyone has an idea what the problem is ?


This thread was automatically locked due to age.
  • Just to make things clear, the mail flow (SMTP) was the following:

    SMTP1 -[ASL1-ASL2 VPN]--> ASL2 --> SMTP2

    Site 1 has all public IP addresses (it's a public site) while site 2 is using private IPs NATed by ASL2.

    Fulgan, I think you overestimate our ability to understand![;)]  Let me restate that to see if I understand.

    Site 1 has no private IPs and the ASG is in bridge mode.  It is connected to Site 2 with an IPsec Site-to-Site.  The mail server here both sends and receives email.

    In Site 2, the ASG is in routing mode with the local network masqueraded behind a public IP on the External interface.  The mail server here sends email only.

    So, we've fixed it by removing the firewalls public IPs from the VPN definition completely (both as published networks and gateway definitions).

    (repeating in my words) In each site, the local public IP target of the VPN was removed from 'Local networks' in the 'IPsec Connection' definition and, in the local 'Remote Gateway' definition for the other site, the remote site's public IP target for the VPN was removed from 'Remote networks'.

    now the mail server cannot connect to the ASL2's external SMTP port.

    I've temporary fixed that by adding a stating entry in the host file of the SMTP1 server, but I need a more permanent fix.

    (restating) Now, the mail server in Site 1 cannot access the Site-2 mail server via its public IP which is DNATted to its private IP.  The fix was to add a host definition with the SIte-2 mail server's private IP to the list of 'Static Hosts' on the ASG in Site 1.

    If I've understood correctly, then I believe you have the optimal configuration now.

    Cheers - Bob
  • Thank you for answering.

    Fulgan, I think you overestimate our ability to understand! Let me restate that to see if I understand.

    Site 1 has no private IPs and the ASG is in bridge mode. It is connected to Site 2 with an IPsec Site-to-Site. The mail server here both sends and receives email.


    Ah, I might have been less than clear with my explanations [;)]

    No, Site 1 is not in bridge mode. It's in router mode between 4 segments that uses only public, routable IP addresses.

    (repeating in my words) In each site, the local public IP target of the VPN was removed from 'Local networks' in the 'IPsec Connection' definition and, in the local 'Remote Gateway' definition for the other site, the remote site's public IP target for the VPN was removed from 'Remote networks'.


    That is correct.

    In Site 2, the ASG is in routing mode with the local network masqueraded behind a public IP on the External interface.


    That is correct.

     The mail server (in site 2) here sends email only.


    No. this one receives and send. But in this exemple, it should receive mail from the ASL2 machine only (since this one acts as an AV/spam filter). It works just fine sending mail.

    It's the mail server is site 1 that is sending mail only (the one with the public IP). It's configured to reject all incomming mail and just relay mail from the other machines  in site 1.

    (restating) Now, the mail server in Site 1 cannot access the Site-2 mail server via its public IP which is DNATted to its private IP.


    No. The SMTP server that site 1 should be using for sending mail is the public IP address of the ASL2 box.

     The fix was to add a host definition with the SIte-2 mail server's private IP to the list of 'Static Hosts' on the ASG in Site 1.


    The fix was to edit the host file of the mail server to ping the DNS name of the ASL2 box (which is the domain's MX as well) to the internal IP address of the ASL2 box (private). It works, but if the tunnel fails, the mail stops flowing even if the connection is still up.

    The SMTP server on site 2 is never actually used: it will NOT accept mail from any host except the ASL2 box or the internal LAN and the SMTP1 machine shouldn't attempt to contact it.

    Let me try another explanation completely, maybe it'll be more clear:

    I have two sites, 1 and 2. I want to send mail from site 1 to site 2

    Site 1 one uses public IPs and has not NAT.
    Site 2 uses a public IP and a number of private networks that are NATed.
    Site 2 has a SMTP server running on it's firewall (ASL2) which is used for receiving mail from all external sources and AV/spam filtering. legit mail is then forwarded to SMTP2 directly.
    Both sites are joined through an IPSec VPN
    Initially, the VPN tunnel had the public IP of both ASL box published in the local/remote networks lists.
    When removing these public IPs from the VPN networks lists, connections from site 1 to site 2 started to work (good) but connections from site 1 to the public IP address of site 2 stopped working (bad).

    The reason, if I understand it correctly, is that a packet sent from site 1 machine will NOT go through the tunnel (because it doesn't match the destination IP address selector for the VPn interface). However, the RESPONSE packet will go through the tunnel (because the destination of THIS packet matches a known remote network).

    Right ?

    In that case, should I enable strict routing to solve my problem ?
  • Well, it was simple enough to try: strict routing solved the problem [:)]

    Thank you again for answering.