Originally Posted by talusog
yah.i have a linux gateway which is also a proxy cahing server(squid)and i want to forward ftp connections to my ftp server(cerberus ftp)that runs on windows 2003 which is inside my network.i have no bright idea about port forwarding on linux so i jump into this forum for help and info..anyway i have done searching and looking at some linux forums and someone suggested that i should used rinetd but further searching revealed that rinetd does not redirect ftp because ftp uses more that one socket.another one suggested that i should do this iptable rule on my firewall script:
iptables -t nat -I PREROUTING -p tcp -i INTERNET --dport 21 -j DNAT --to 192.168.x.xx:21
where INTERNET is my gateway(eth0).
is that correct? or is there anything else that i should do.how about rinetd?is it true that rinetd wont work on ftp or is there a workaround for it?
thanks for all the help and suggestions.
Yeah that's getting the idea, but you also need to turn on port forwarding in the kernel if it's not already turned on, most distro's will not turn it on by default. try
turn on ip forwarding:
echo "1" > /proc/sys/net/ipv4/ip_forward
turn off ip forwarding
echo "0" > /proc/sys/net/ipv4/ip_forward
And then you will need a forwarding rule to allow the packet to now traverse the forward chain:
iptables -A FORWARD -p tcp -i INTERNET --dport 21 -d 192.168.x.xx -j ACCEPT
And I think you will need to load the modules for ftp tracking, this is used to except the data port 20 that ftp uses