Sorry everyone, I know this has been beaten to death, but I still can't
get both passive and active ftp working with my FTP server behind a NAT
gateway.

I tried what was suggested at this posting in the archives:
http://false.net/ipfilter/2001_07/0222.html

This did not work for me.  Only Active FTP is working, passive fails.

Using ipfilter V. 3.4.29...

Here are the rules I am using:

ipf.rules:

# Interface naming and configuration
# xl0 = External NIC, facing the world
# dc0 = Internal NIC, facing private LAN
# lo0 = Loopback
# 
# BEGIN RULESETS
# SECTION 0) Rules generic to all interfaces
  block in log quick all with opt lsrr
  block in log quick all with opt ssrr
  block in log quick all with ipopts
  block in log quick all with short

# SECTION 1) Rules for the xl0 external interface
  block in on xl0 all

# Anti-Spoofing Rules
  # Bad Source Addresses 
  block in log quick on xl0 from 192.168.0.0/16 to any
  block in log quick on xl0 from 172.16.0.0/12 to any
  block in log quick on xl0 from 10.0.0.0/8 to any
  block in log quick on xl0 from 0.0.0.0/8 to any
  block in log quick on xl0 from 127.0.0.0/8 to any
  block in log quick on xl0 from 169.254.0.0/16 to any
  block in log quick on xl0 from 192.0.2.0/24 to any
  block in log quick on xl0 from 204.152.64.0/23 to any
  block in log quick on xl0 from 224.0.0.0/3 to any
  # Bad Destination Addresses
  block in log quick on xl0 from any to 192.168.0.0/16
  block in log quick on xl0 from any to 172.16.0.0/12
  block in log quick on xl0 from any to 0.0.0.0/8
  block in log quick on xl0 from any to 127.0.0.0/8
  block in log quick on xl0 from any to 169.254.0.0/16
  block in log quick on xl0 from any to 192.0.2.0/24
  block in log quick on xl0 from any to 204.152.64.0/23
  block in log quick on xl0 from any to 224.0.0.0/3
  block in log quick on xl0 from any to 10.0.0.255/32
 
# Beginning Outbound rules
  # Bad Destination addresses
  block out log quick on xl0 from any to 192.168.0.0/16
  block out log quick on xl0 from any to 172.16.0.0/12
  block out log quick on xl0 from any to 0.0.0.0/8
  block out log quick on xl0 from any to 10.0.0.0/8
  block out log quick on xl0 from any to 127.0.0.0/8
  block out log quick on xl0 from any to 169.254.0.0/16
  block out log quick on xl0 from any to 192.0.2.0/24
  block out log quick on xl0 from any to 204.152.64.0/23
  block out log quick on xl0 from any to 224.0.0.0/3
  # Bad Source addresses
  block out log quick on xl0 from 192.168.0.0/16 to any
  block out log quick on xl0 from 172.16.0.0/12 to any
  block out log quick on xl0 from 0.0.0.0/8 to any
  block out log quick on xl0 from 127.0.0.0/8 to any
  block out log quick on xl0 from 169.254.0.0/16 to any
  block out log quick on xl0 from 192.0.2.0/24 to any
  block out log quick on xl0 from 204.152.64.0/23 to any
  block out log quick on xl0 from 224.0.0.0/3 to any

# Services Section

[snipped most of my public services...]

# FTP
  pass in quick on xl0 proto tcp from any to 10.0.0.10/24 port = 21 \
  flags S keep state keep frags

# Block all other inbound connections and log them
  block in log quick on xl0 proto tcp from any to any
  block in log quick on xl0 proto udp from any to any
  block in log quick on xl0 all
  
# Keep-state outbound rules
  pass out quick on xl0 proto tcp all flags S keep state keep frags
  pass out quick on xl0 proto udp all keep state keep frags
  pass out quick on xl0 proto icmp all keep state keep frags
  block out quick on xl0 all

# SECTION 2) Internal Interface
  # Let the internal interface run free
    pass in quick on dc0 all
    pass out quick on dc0 all

# SECTION 3) Loopback
  # Let the loopback run free
    pass in quick on lo0 all
    pass out quick on lo0 all

Here is my ipnat.rules:
# For ftp from the gateway itself  --- Do I need this???
#map xl0 206.169.230.71/32 -> 206.169.230.71/32 proxy port ftp ftp/tcp
map xl0 0.0.0.0/0 -> 206.169.230.71/32 proxy port ftp ftp/tcp
rdr xl0 206.169.230.71/32 port 21 -> 10.0.0.10 port 21 tcp
map dc0 from any to 10.0.0.10/24 -> 0/0 proxy port ftp ftp/tcp
# General mapping for internal clients
map xl0 10.0.0.0/24 -> 206.169.230.71/32 portmap tcp/udp 40000:60000
map xl0 10.0.0.0/24 -> 206.169.230.71/32

[snipped my other service specific rdrs]

Here is a snippet of a SmartFTP client log:
[snipped the beginning logon sequence]
...
200 Type set to A.
    PASV
227 Entering Passive Mode (10,0,0,10,193,98)
    Opening data connection IP: 10.0.0.10 PORT: 49506.
    A connection attempt failed because the connected party did not
properly respond after a period of time, or established connection
failed because connected host has failed to respond.


I thought with my above rules that the client would get back the
external IP address, but instead it gets 10.0.0.10.  Any ideas?  Is
there some patch I can apply?

Thanks,

Adam



Reply via email to