Tuesday, May 6, 2008

SSH Port Forwarding Passive FTP

Initialize ssh port forwarding of FTP

#modprobe ip_conntrack
#modprobe ip_conntrack_ftp
#modprobe ip_nat_ftp
#echo 1 > /proc/sys/net/ipv4/ip_forward


Iptables port forwarding rules

iptables -t nat -A PREROUTING -p tcp --dport 21 -i <server's-ethernet> -j DNAT --to <remote-server-ip>:21
iptables -t nat -A POSTROUTING -p tcp -d <remote-server-ip> --dport 21 -j SNAT --to-source <server's-ip>

No comments: