Network Troublshooting > General Networking Support in Linux

Port forwarding with iptables?


i want to forward, for example port 82, to behind my router when it receives the port request from my outside ip....  any help on the rule. i tried PREROUTING in the nat table, but it didnt work, maybe i did it wrong...

Have enabled the following??

--- Code: ---echo 1 > /proc/sys/net/ipv4/ip_forward
--- End code ---

yup, i have all the forwarding and masquerading working fine, i have a cable modem shared to my lan, but i want to forward ports to certain computers in my lan


echo 1 >/proc/sys/net/ipv4/ip_forward

iptables -t nat -A POSTROUTING -s -d -j ACCEPT

iptables -t nat -A POSTROUTING -s  -j ACCEPT

iptables -t nat -A POSTROUTING -s -o eth0  -j SNAT    --to-source

This may help. this is what i use on my gateway server


[0] Message Index

Go to full version