Ftp-proxy trouble with load balancing NAT using PF

Vijay Shrivastav vijay_shrivastav at hotmail.com
Sat Nov 5 05:37:44 PST 2005


Hello,

I am having trouble having ftp-proxy to be called in my dual WAN with NAT
Setup. I have included my setup files. The dual WAN sharing works great
But I have to make the ftp-proxy work in order to let ftp go across
The NAT. I am using  FreeBSD 5.3-RELEASE.

Thanks in advance.

xfire# pfctl -ss | grep 127.0.0.1
self tcp 127.0.0.1:8021 <- 208.55.68.52:21 <- 10.71.0.255:4694
CLOSED:SYN_SENT

I enabled logging for inetd and do not see it getting called to fork
Ftp-proxy when I try to FTP from a PC on the lan_net.

If I "telnet localhost 8021" I can see inetd starting ftp-proxy, but since
this is not a
Nat connection ftp-proxy logs this message.
Nov  5 01:27:49 xfire inetd[528]: ftp-proxy from 127.0.0.1
Nov  5 01:27:49 xfire ftp-proxy[564]: pf nat lookup failed 127.0.0.1:53204
(No such file or directory)

xfire# pfctl -ss | grep 127.0.0.1
self tcp 127.0.0.1:8021 <- 208.55.68.52:21 <- 10.71.0.255:4694
CLOSED:SYN_SENT

Netstat -an shows
----------------
tcp4       0      0  *.8021                 *.*                    LISTEN

/etc/inetd.conf has this line
----------------
ftp-proxy       stream  tcp     nowait  root    /usr/libexec/ftp-proxy
ftp-proxy -n

My /etc/pf.conf
------------------
lan_net = "10.71.0.1/16"
int_if  = "fxp1"
ext_if1 = "fxp0"
ext_if2 = "fxp2"
ext_gw1 = "78.222.255.177"
ext_gw2 = "10.1.1.254"

scrub in all
#  nat outgoing connections on each internet interface
nat on $ext_if1 from $lan_net to any -> ($ext_if1)
nat on $ext_if2 from $lan_net to any -> ($ext_if2)
rdr on $int_if proto tcp from any to any port 21 -> 127.0.0.1 port ftp-proxy

#  default deny
#block in  from any to any
#block out from any to any
pass in all
pass out all
pass quick on lo0 all

#  pass all outgoing packets on internal interface
pass out on $int_if from any to $lan_net

#  pass in quick any packets destined for the gateway itself
pass in quick on $int_if from $lan_net to $int_if

# FTP-PROXY Loading Blance
#pass in quick on $int_if proto tcp from any to 127.0.0.1 port = 8021 keep
state label ftp-proxy
pass  log quick proto tcp from $lan_net to 127.0.0.1  port 8021 keep state

#  load balance outgoing tcp traffic from internal network.
pass in on $int_if route-to \
    { ($ext_if1 $ext_gw1), ($ext_if2 $ext_gw2) } round-robin \
    proto tcp from $lan_net to any flags S/SA modulate state
#  load balance outgoing udp and icmp traffic from internal network
pass in on $int_if route-to \
    { ($ext_if1 $ext_gw1), ($ext_if2 $ext_gw2) } round-robin \
    proto { udp, icmp } from $lan_net to any keep state

#  route packets from any IPs on $ext_if1 to $ext_gw1 and the same for
#  $ext_if2 and $ext_gw2
pass out on $ext_if1 route-to ($ext_if2 $ext_gw2) from $ext_if2 to any
pass out on $ext_if2 route-to ($ext_if1 $ext_gw1) from $ext_if1 to any
pass in on $ext_if1 inet proto tcp from port 20 to ($ext_if1) \
    user proxy flags S/SA keep state
pass in on $ext_if2 inet proto tcp from port 20 to ($ext_if2) \
    user proxy flags S/SA keep state

#  general "pass out" rules for external interfaces
pass out on $ext_if1 proto tcp from any to any flags S/SA modulate state
pass out on $ext_if1 proto { udp, icmp } from any to any keep state
pass out on $ext_if2 proto tcp from any to any flags S/SA modulate state
pass out on $ext_if2 proto { udp, icmp } from any to any keep state


More information about the freebsd-pf mailing list