Difference between revisions of "PortRedirect"
m (Replaced Template:drawBox* (deprecated) with Template:* box and minor text changes) |
(Alternative iptables Approach) |
||
Line 27: | Line 27: | ||
Works perfectly. | Works perfectly. | ||
{{Note box|By using this approach your SME Server thinks that anything coming in from the outside world via port 2525 is in actual fact coming from within your LAN on port 25, so there is much less security applied.}} | {{Note box|By using this approach your SME Server thinks that anything coming in from the outside world via port 2525 is in actual fact coming from within your LAN on port 25, so there is much less security applied.}} | ||
+ | |||
+ | ====Alternative iptables Approach==== | ||
+ | |||
+ | I've added the following lines to /etc/rc.d/rc.local | ||
+ | |||
+ | ''iptables -A PREROUTING -t nat -p tcp --dport 9993 -j REDIRECT --to-port 993 | ||
+ | iptables -A PREROUTING -t nat -p tcp --dport 4465 -j REDIRECT --to-port 465 | ||
+ | '' | ||
+ | |||
+ | Cut-paste example for port 2525 redirection: | ||
+ | |||
+ | iptables -A PREROUTING -t nat -p tcp --dport 2525 -j REDIRECT --to-port 25 | ||
+ | |||
+ | ====Alternative iptables Approach==== | ||
===ISP is blocking port 80=== | ===ISP is blocking port 80=== |
Revision as of 10:29, 12 October 2013
ISP is blocking port 25
First I signed up for a free DNS hosting account through Mydomain.com I registered my domain through them years ago. So I have control over my own DNS records.
Second I went to NO-IP.com and signed up for the $39.99 mail reflector account. I found a great article by them on how to set it up here :
http://www.no-ip.com/support/guides/email/blocked_port_25.html
It was quick and easy. I paid my $39.99 and added my domain name. I put in port 2525. Then I added my email alias in the place provided by their site so when they receive my mail it would not bounce.
Third my DNS MX(mail exchange) record pointed to my domain ip address, so I had to change my my record to point to the no-ip.com mail servers. I changed my MX records to mail1.no-ip.com and a secondry mx record to point to mail2.no-ip.com.
Fourth I logged in to my SME server. I went to port forwarding and set port 2525 to forward to port 25 with the ip set to the word localhost.
It worked perfectly. Here is my litte map:
Incoming Mail
Yahoo mail --> MX record check --> Mail1.no-ip.com (port25) --> My SME server (port 2525).
Outgoing Mail
My SME server ---> My ISP's SMTP server ---> World
Works perfectly.
Alternative iptables Approach
I've added the following lines to /etc/rc.d/rc.local
iptables -A PREROUTING -t nat -p tcp --dport 9993 -j REDIRECT --to-port 993 iptables -A PREROUTING -t nat -p tcp --dport 4465 -j REDIRECT --to-port 465
Cut-paste example for port 2525 redirection:
iptables -A PREROUTING -t nat -p tcp --dport 2525 -j REDIRECT --to-port 25
Alternative iptables Approach
ISP is blocking port 80
Same deal except different ports