Skip to contentSkip to conversation

Active and Passive FTP

DISCUSSION Robert Becskei 2 participants 2 messages May 17, 2005

lore
Share & tools
lore
#0 lore raw

Hello everyone ,

my clients access the internet like this

client --- proxy server --- eth0 firewall eth1 ----internet

in squid.conf I told squid to always direct allow ftp...

in iptables I've did the following modifications...

iptables -A INPUT -i eth1 -p tcp --sport 21 -m state --state ESTABLISHED -j ACCEPT
iptables -A INPUT -i eth1 -p tcp --sport 20 -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -A INPUT -i eth1 -p tcp --sport 1024:65535 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT

iptables -A OUTPUT -o eth1 -p tcp --dport 21 -m state --state NEW,ESTABLISHED -j ACCEPT iptables -A OUTPUT -o eth1 -p tcp --dport 20 -m state --state ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth1 -p tcp --sport 1024:65535 --dport 1024:65535 -m state ESTABLISHED,RELATED -j ACCEPT

passive ftp works... but I cannot get active to work I always get a

200: SWITCHING TO ASCII MODE
500: ILLEGAL PORT COMMAND
500: Unknown COMMAND

what did I mess up ? is there a way to get active working as well...are the above rules correct ? eth1 is my outside interface...the proxy server connects to eth0 directly

Sincerely
Robert B

#1 lore raw
Quoted 9 lines · Robert Becskei

Hello everyone ,

my clients access the internet like this

client --- proxy server --- eth0 firewall eth1 ----internet

in squid.conf I told squid to always direct allow ftp...

in iptables I've did the following modifications...

you are making this much more complicated than it actually is:

modprobe ip_conntrack_ftp
modprobe ip_nat_ftp

iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -A FORWARD -i eth0 -o eth1 -p tcp --syn --dport 21 -j ACCEPT

-j

--
"Peter: Wow, it's like I died and went to heaven, then God realized it
wasn't my time yet, so He sent me back to a brewery."
--Family Guy