How to redirect to FTP server in LAN?

Discussion in 'Server Operation' started by homi, Oct 12, 2017.

  1. homi

    homi New Member

    I have 2 servers Ubuntu. One is inet provider with static public IP adress (ext., int And second is FTP server (and backup server etc.), in the same LAN, with IP static How to redirect to my FTP server from outside of LAN ? FTP server is, port 21. Thanks.
  2. You can use iptables to redirect traffic,
    Use following commands for iptables

    iptables -t nat -A PREROUTING -p tcp --dport 21 -j DNAT --to
    iptables -A FORWARD -d -p tcp --dport 21 -j ACCEPT
    sysctl net.ipv4.ip_forward=1

    the first line puts a iptables rule to change the destination address and port.

    the second line allows this redirected traffic to be forwarded.

    the third line enables traffic forwarding in the kernel.
  3. ahrasis

    ahrasis Active Member

    By "lan" do you mean behind a router?Because if it is, port forwarding (TCP) to your ftp pc ip in your router settings would suffice.

Share This Page