I am running DD-WRT v24-sp2 std firmware on a Linksys WRT54GL.

I have a port forward configured on port 25 to ip What I want to do is allow this port forwarding, but only from WAN IP's in the range -

How can this be done?

  • What does the manual on the Linksys say? – mdpc Mar 28 '13 at 1:29
  • @mdpc probably not much. The router is NOT running linksys firmware, so the manual would not make any mention about how to accomplish what I'm trying to do. The firmware on this router is DD-WRT and I am able to make iptables entries that work. The difficulty that I'm having is in setting the right entries. – objectivesea Mar 29 '13 at 18:22

You'll have to dig into the firewall guide for this.

Firewall Guide

Firewall Example using iptables

Something like this:

#iptables -t nat -I PREROUTING -p tcp -s remote.ip.address/netmask -d $WAN_IP --dport 25 -j DNAT --to $LAN_IP:25
#iptables -I NAT -p tcp -d $WAN_IP --dport 25 -j ACCEPT

and remove any port forwarding rules you have on the NAT page, so you don't cause issues.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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