• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 858
  • Last Modified:

Forward port 25 through a remote server via ssh tunnel or iptables?

Hello Experts:

In this scenario lets pretend Postfix or another mail server is not available to relay email for me.

[server 1] <---> <dynamic IP address> <---> <internet> <---> <static ip address <---> [remote server] <internet> <---> <destination email server>

Issue: To save myself 100 dollars a month at home on static IP addresses (thanks comcast), I have setup my home network using static IP addresses. I have a remote VPS that I use that has static IPs and I use it as a router of sorts. It works GREAT for everything but for sending email. My email server is located behind my home network (server 1) and can receive email no problem, but sometimes when I send email I get a bounce back because I'm behind a dynamic IP address (some email servers reject this as possible spam).

I would like to know if there is an easy solution just using either IPTables forwarding, or SSH tunnles, or a mix?

It's easy for me to grab all traffic heading out with destination 25 and redirect it to any port on my remote VPS box, but I'm not sure how to get it to route through after that and be forwarded to the destination, such as mail.google.com or what-have-you?

Thanks for any help!

1 Solution
What I would suggest is setup your SMTP server at your home as a relay only and have it forward everything to at SMTP server you run on your VPS box.  Have the VPS box deliver the e-mail to the destination.
dr34m3rsAuthor Commented:
That's exactly what I ended up doing. This is perfect and gives much more control once you figure out postfix. I read you can even strip headers to keep the "received from" in the headers clean...  great stuff!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now