LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   iptables / FTP masquerading: Port command illegal (https://www.linuxquestions.org/questions/linux-networking-3/iptables-ftp-masquerading-port-command-illegal-304765/)

radiowhiz 03-22-2005 01:21 PM

iptables / FTP masquerading: Port command illegal
 
Hi Everyone,

I finally got my FTP server working on my Red Hat 9 Linux firewall box. For some reason, I could only get it to work on a port other than 21. I elected for port 29 and changed /etc/services ftp entry and my firewally rules accordingly. For some reason, if I change back to 21, no response sent by ftp server to syn pkt from client ftp. If anyone has any ideas why it works on any other port than 21, please let me know.

Anyways, i got passive mode ftp to work on this box. However, active mode fails. and it complains:
ftp> dir
500 Illegal PORT command.
ftp: bind: Address already in use

When i look at the packets, I see the client sending a Port cmd using its non-routable IP. This then passes through a firewall, and the source IP gets translated to a public IP. Then hits my Linux firewall and I the vsftpd process it and sends back that Illegal port response.

My firewall is using DHCP over my DSL connection. Hence I am using MASQUERADING in iptables:

-A POSTROUTING -o eth1 -j MASQUERADE

modules in memory are:

ip_conntrack_ftp 5296 1 (autoclean)
ip_nat_ftp 4112 0 (unused)
iptable_mangle 2776 0 (autoclean) (unused)
tulip 43840 1
ipt_MASQUERADE 2200 1 (autoclean)
iptable_nat 21720 2 (autoclean) [ip_nat_ftp ipt_MASQUERADE]
ipt_state 1048 10 (autoclean)
ip_conntrack 26976 3 (autoclean) [ip_conntrack_ftp ip_nat_ftp ipt_M
ASQUERADE iptable_nat ipt_state]
iptable_filter 2412 1 (autoclean)
ip_tables 15096 7 [iptable_mangle ipt_MASQUERADE iptable_nat ipt
_state iptable_filter]

Anybody know whats going on?

Thanks Gurus!

win32sux 03-23-2005 05:15 PM

it's weird that you can make it work on any port except 21...

are you sure there isn't another daemon using port 21??


All times are GMT -5. The time now is 01:20 AM.