I'm a developer working from home on an application. One of the features of my app is that it sends outgoing notification emails. I'm attempting to relay these messages through one of our company's public servers. I've configured sendmail on said server to accept connections from my IP address at home. However, my ISP blocks outgoing connections to TCP port 25.

I'd like to use iptables on the public server to accept incoming connections on port 2525 and redirect them to port 25. How do I do this? Thanks!

link|improve this question

64% accept rate
feedback

2 Answers

up vote 2 down vote accepted

Something like:

$ iptables -A PREROUTING -t nat -p tcp --dport 2525 -j REDIRECT --to-port 25

This may need to be edited depending on your current iptables ruleset.

link|improve this answer
Thanks! iptables commands are like regular expressions to me. I always forget the syntax when I need to use it, but it becomes immediately obvious once I see the solution. – OptimusSubprime Feb 12 '10 at 3:09
You're welcome! Keep at it - they'll start to become second-nature eventually. – ErikA Feb 12 '10 at 3:10
feedback

you also could use redir ( http://sammy.net/~sammy/hacks/ ) - it runs from inetd and is packaged under debian

link|improve this answer
This works perfectly, while ErikA's answer unfortunately (It looks a prettier solution for me to use just iptables than extra daemons) does not. – Ivan Jul 19 '10 at 13:53
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.