[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: need iptables port forwarding help!



Tom Vier wrote:

i've tried several times, using multiple different rules i've found from
different sites, and i still can't get port forwarding working. does anyone have working rules they could send me? i'm trying to forward packets from my
isp to port 2222 to an internal ip (i use nat) and port 22.

/sbin/iptables -t nat -A PREROUTING -p tcp --dport 22 -j DNAT --to-destination $INT_IP /sbin/iptables -t nat -A PREROUTING -p tcp --dport 2222 -j DNAT --to-destination $INT_IP /sbin/iptables -t nat -A POSTROUTING -p tcp --dport 22 -d $INT_IP -j SNAT --to-source $EXT_IP /sbin/iptables -t nat -A POSTROUTING -p tcp --dport 2222 -d $INT_IP -j SNAT --to-source $EXT_IP

define $INT_IP - internal ip to forward to, and
define $EXT_IP - external ip on your outbound interface.

Regards,
Clement




Reply to: