LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 01-13-2003, 04:34 AM   #1
Miky
Member
 
Registered: Dec 2002
Location: London / Paris
Distribution: Debian / OpenBsd
Posts: 74

Rep: Reputation: 15
Iptables, ftp problems


Hi,

I'm experiencing problems with ftp using iptables
From the machine where iptables lives it seems to work when I try to connect to a ftp server on the internet.

But from my local lan it doesn't, from a windows command it gets stuck on when i do a ls or dir

port command successful.considering using pasv
here comes the directory listing

My rules are basic

# All connections go out
iptables -A FORWARD -s $local_net -d $internet -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A FORWARD -s $internet -d $local_net -m state --state ESTABLISHED -j ACCEPT

# Active mode - port 20
iptables -A FORWARD -p tcp -s $local_net --sport 1024:65535 -d $internet --dport 20 -m state --state ESTABLISHED -j ACCEPT
iptables -A FORWARD -p tcp -s $internet --sport 20 -d $local_net --dport 1024:65535 -m state --state RELATED,ESTABLISHED -j ACCEPT

And on the nat table i have
iptables -t nat -A POSTROUTING -s $local_net -o eth0 -j SNAT --to $extfw


First question :
Using active mode the data channel is opened by the server, are the data automaticly nated back to my machine using this postrouting rule or should i write a prerouting rule ?
Because the packets on the data channel don't know that they have to come back to my machine (192.168.0.226)

Second q:
Have anybody resolved that problems in another way, i read somewhere that the irc conn_tracking where interfering with the ftp one

Thanx for help
 
Old 01-13-2003, 08:50 AM   #2
barbanero
Member
 
Registered: Jan 2002
Location: Bucharest
Distribution: RedHat, AIX
Posts: 39

Rep: Reputation: 15
This lines i try in my firewall and it works

#i can make ftp everywhere
iptables -A INPUT -s $ALL -i $EXT_IF -d $EXT_IP -p tcp --sport 20:21 -j ACCEPT

# only $INT_LAN can ftp me
iptables -A INPUT -s $INT_LAN -i $EXT_IF -d $EXT_IP -p tcp --dport 20:21 -j ACCEPT
 
Old 01-13-2003, 09:18 AM   #3
Miky
Member
 
Registered: Dec 2002
Location: London / Paris
Distribution: Debian / OpenBsd
Posts: 74

Original Poster
Rep: Reputation: 15
actually my pb is on the forward chain, input and output are ok.
I don't know if it's the firewall though because, i had pb with my windows workstation (as usual)
thanx anyway
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ftp and iptables eantoranz Linux - Networking 1 07-04-2005 11:24 AM
iptables and ftp ciberrust Linux - Networking 2 11-19-2004 05:05 PM
IPTables and FTP - ftp on LAN adamgedde Linux - Newbie 6 10-16-2003 08:11 PM
ftp and ftp port forwarding with IPtables?? FunkFlex Linux - Security 3 04-24-2002 03:03 AM
FTP Through IPTables JHuizingh Linux - Networking 5 03-08-2002 11:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 10:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration