Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!

share|improve this question
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.

share|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. – jamieb Feb 12 '10 at 3:09
You're welcome! Keep at it - they'll start to become second-nature eventually. – EEAA Feb 12 '10 at 3:10

you also could use redir ( ) - it runs from inetd and is packaged under debian

share|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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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