• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

Anyone know how to portforward with iptables

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

DJ39

Registered
Joined
Mar 7, 2002
Location
S.E. Florida
I have the firewall set up and the masquerading, but damned if I can get port forwarding working.:mad: I've tried so many things I lost track of what I tried and didn't try. Please only respond if actually got it working. So many of the examples I tried to use did not work for me.

Also, what is the best way you suggest testing it? Its a real pain, but Ive tested it by running a web server on the internal machine, portforwarding to it, then using an anonymous surfing site to try and access the external ip and port.

You can use my email address: [email protected]
If you want to use ICQ, let me know and I will install it again.

Thank you in advance. :)
 
iptables -t nat -A PREROUTING -d xx.xxx.xx.x -p udp --dport 27960 -j DNAT --to-destination 192.168.0.35:27960

That, for example, is what I do to forward port 27960 to a box on my lan for hosting Q3 games. xx.xxx.xx.x is my external ip.
 
did you enable port forwarding ?? if not try this.....echo "1" > /proc/sys/net/ipv4/ip_forward
 
I figured out the problem.
I had to enable NEW connections for forwarding

IOW
$IPTABLES -A FORWARD -i $EXTIF -o $INTIF -m state --state ESTABLISHED,RELATED -j ACCEPT

became

$IPTABLES -A FORWARD -i $EXTIF -o $INTIF -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT

Thank you, all, for your help.
 
Back