We help IT Professionals succeed at work.

Sonicwall port forward email to vpn

We've had a hardware failure of our spam box and while it is down I want to forward email directly to the email servers. For most I just created a new rule in my sonicwall to send it directly to the email server which is on our lan. One of the email servers is on the other end of a vpn.

The vpn is between my sonicwall tz205 and a tz105. The tunnel is up and working fine. On my lan if I telnet across the vpn to the email server it works just fine but I cannot get the sonicwall to do it. It seems like a pretty simple idea.

I searched google and found a couple of resources for doing this and followed them step by step but it doesn't work for me. There must be a simple way to tell the sonic wall to just forward the mail coming from one external IP address to an IP address on the vpn but I can't seem to find it.

Any help is appreciated.
Watch Question

Distinguished Expert 2019
Before continuing make sure your settings on the mail server are not such that they only accept connection attempts from the spambox ip.
Change the forwarding of port 25 rule on the sonicwall from going to IPa (spam box) to go to IP B (mail server)

You only need to deal with the rule change going between the external firewall and the spambox now mail server.  If you have your spambox dealing with two separate domains, the transition is a more complicated one depending on how each domain/MX records are setup.  IF they are both using the same destination IP such that there is no way to differentiate on the firewall, you would have to configure one mail server to accept the email messages of the second domain with the sole purpose of forwarding it to the other mail server (i.e. do not define domain2.com as a local domain).

If you could provide a network topology of what you have in terms of how

Internet <=> sonicwall <=> port 25 <=> spam box Was it forwarding to the LAN IP of the remote Mail server? Do you have a virtual IP on the sonicwall that ends up going through the VPN and hitting the remote mail server?

Usually, the firewall might not be permitted to push inter-interface.
If your sonicwall does not have a virtual IP on the local lan that forwards to the remote mail server IP, but does support such, you may have to add it to achieve.  Another option is to have a local SMTP such as IIS, and configure it to route all email it gets to the LAN Mail server.
Though you have to be careful not to make your intermediary SMTP server an open relay.


I have five different IP addresses on the wan of the firewall. There is a dns record for each and each goes internet -> Firewall -> spam box for inbound. For this particular one the spam box then forwards the email to the client site over the vpn.

I just need to skip the box. For this mail server I tried changing the IP address of the address object for the server to send it to the mail server instead of the spam box but it didn't work. I edited the address object a second time and changed it from the lan zone to the vpn zone but it still didn't work.

I think the issue is I have to allow traffic from the wan to the vpn as well but I'm not sure how to do this for just the Wan IP address I need.
Distinguished Expert 2019

See whether you can define an object on the LOCAL Lan that translates through the VPN to the remote mail server.

Not familiar enough with somicwall settings options.

Do you have an SMTP that can be configured to accept messages for this domain but will then forward it to the One through the VPN.
Distinguished Expert 2019

Let's say your LAN on the inbound is on the remote LAN mailserver has
Create a virtualIP that redirects to natting the source I.e. The mail server on will see the request as coming from
Then using a local system on the lan see whether you can connect to 25 and get the response from the remore mail server.  If you can, you would then alter this forwarding rule instead of going to to port 25 and see if that lets you do what you need.


This really should have been easy to do at the firewall but would just not work.

What I ended up doing was setting up an external relay domain in Exchange 2013 and a send connector for the domain. I then updated the smtp rule on the firewall to forward email to Exchange 2013 which then relays it over the vpn to Exchange.

This did not occur to me until I read the bottom of your first post again about having IIS relay. That made me think of Exchange relaying so thank you for that.