Problem setting up ftp server inside lan (iptables)

From: Sam (samuel.richard_at_usherbrooke.ca)
Date: 08/16/04

  • Next message: Rob: "Re: iptables and masquerading - slow to initiate connection"
    Date: 16 Aug 2004 10:38:58 -0700
    
    

    Hi,

    I am trying to set up my ftp server located inside my lan. It thought
    everything has been done, but when I try to access the ftp server from
    the outside, it fails.

    There's got to be something I'm missing here. Any help would be very
    appreciated.

    Thanks,

    Sam

    Here are the rules in iptables:

    *********

    WAN=$(nvram_get wan_ifname)

    IPT=/usr/sbin/iptables

    for T in filter nat mangle ; do
      $IPT -t $T -F
      $IPT -t $T -X
    done

    $IPT -t filter -A INPUT -m state --state INVALID -j DROP
    $IPT -t filter -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
    $IPT -t filter -A INPUT -p icmp -j ACCEPT
    $IPT -t filter -A INPUT -i $WAN -p tcp -j REJECT --reject-with
    tcp-reset
    $IPT -t filter -A INPUT -i $WAN -j REJECT --reject-with
    icmp-port-unreachable
    $IPT -t filter -A FORWARD -m state --state INVALID -j DROP
    $IPT -t filter -A FORWARD -m state --state RELATED,ESTABLISHED -j
    ACCEPT
    $IPT -t filter -A FORWARD -i $WAN -m state --state NEW,INVALID -j DROP

    $IPT -t nat -A POSTROUTING -o $WAN -j MASQUERADE

    ****

    I added the following to redirect port 20 and 21, and 10000-12000
    (passive port range)

    iptables -t nat -A PREROUTING -p tcp --dport 20 -j DNAT
    --to-destination 192.168.1.20:20

    iptables -t nat -A PREROUTING -p tcp --dport 21 -j DNAT
    --to-destination 192.168.1.20:21

    iptables -t nat -A PREROUTING -p tcp --dport 10000:12000 -j DNAT
    --to-destination 192.168.1.20


  • Next message: Rob: "Re: iptables and masquerading - slow to initiate connection"

    Relevant Pages

    • Re: FTP Server Implementation
      ... if you DMZ the FTP server and do your transfers from the SBS LAN to the FTP ...
      (microsoft.public.windows.server.sbs)
    • Newbie: Weird problem with ftp behind ipchains
      ... I have a single firewall and a LAN behind it. ... Passive connections work pretty well. ... It looks as if, somehow, a packet going to the ftp server wasn't NATted. ...
      (comp.security.firewalls)
    • Re: FTP Server Implementation
      ... >if you DMZ the FTP server and do your transfers from the SBS LAN to the FTP ... >Router WAN 1.2.3.4 DG ISP router ...
      (microsoft.public.windows.server.sbs)
    • Re: BAT file to FTP [WILDPACKET]
      ... > logon to it and uploads to a FTP Server on the LAN. ... > comes into play to collect the file and upload to the ftp server. ... echo binary>>%script% ...
      (microsoft.public.windows.server.general)
    • BAT file to FTP [WILDPACKET]
      ... The Script collects the file called *.csv from PC's on the LAN when users ... logon to it and uploads to a FTP Server on the LAN. ... comes into play to collect the file and upload to the ftp server. ...
      (microsoft.public.windows.server.general)