Port forward smtp using iptables rules

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Author Message
TheShanMan
DD-WRT User


Joined: 23 Jul 2007
Posts: 101

PostPosted: Wed May 01, 2013 5:33    Post subject: Port forward smtp using iptables rules Reply with quote
I'd like to use iptables rules to port forward from my router to my internal smtp server but for the life of me I can't seem to get it visible on the internet. Using the dd-wrt port forwarding UI I can get it working fine though.

The reason I want to use iptables directly is because I eventually want to lock down my port since my domain's email routes through an external mail service (no-ip), which in turn routes to my mail server, so their servers are the only ones which should legitimately connect to my smtp server.

To start I'm just trying to make it wide open and once I get that working I will tweak the rules to restrict what it will accept connections from.

Here is an example of what I've tried (and I've tried many variants on this).

Code:

/usr/sbin/iptables -A FORWARD -p tcp --dport 25  -j ACCEPT
/usr/sbin/iptables -t nat -A PREROUTING -i vlan2  -p tcp --dport 25 -j DNAT --to-destination 192.168.1.3


I wish there was a way to spit out the exact commands that dd-wrt generates when I configure the port forwarding in the UI.

FWIW my firmware is DD-WRT v24-sp2 (08/12/10) mega - build 14929 running on a linksys E3000.

What am I doing wrong here? I appreciate any input!
Sponsor
TheShanMan
DD-WRT User


Joined: 23 Jul 2007
Posts: 101

PostPosted: Wed May 01, 2013 5:52    Post subject: Reply with quote
Mine doesn't. Like I said, port forwarding works fine if I configure it from the dd-wrt UI. I'm apparently doing something wrong with my iptables commands though.
TheShanMan
DD-WRT User


Joined: 23 Jul 2007
Posts: 101

PostPosted: Wed May 01, 2013 6:26    Post subject: Reply with quote
Bingo! I bow at your feet. Thank you so much!
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum