Using iptables to redirect incoming requests from port 2525 to port 25?

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!


Solution 1:

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.

Solution 2:

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