I have a single public IP for multiple VM, i need forward multiple ports for FTP service, i write these lines:

iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 20:21 -j DNAT --to-destination


iptables -t nat -A PREROUTING -i eth0 -p tcp -m multiport --dports 20:21 -j DNAT --to-destination

But i have always the same error when i connect with FTP client: no route to host

  • unless there is a specific FTP conntrack module for iptables, your gonna have issues with ftp cuz of the way active/passive work they are a pain to fw/route/masq..... try scp or rsync over ssh... not an answer cuz i dont know how to make ftp work in this situation,... just know not to use it – nandoP Jan 15 '15 at 3:00
  • I have loaded nf_nat_ftp and nf_conntrack_ftp modules but not work, i have modify the rules: iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 20 -j DNAT --to-destination iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 21 -j DNAT --to-destination FORWARDand OUTPUT is accept by default in all traffic – hellb0y77 Jan 15 '15 at 8:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.