LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-26-2005, 04:08 PM   #1
muppski
Member
 
Registered: Feb 2003
Posts: 149

Rep: Reputation: 15
A active FTP server


Hey

I've setup a FTP server. (proftpd)
But I need to ensure that people who are behind nat and such can access me too in Active mode (thats what you call non-passive mode right?


Is there anything I can do serverside?
is there anything they can do client side? if then how?

is there something we BOTH need to do?

or just make sure they can connect to me in passive...

Last edited by muppski; 07-26-2005 at 04:38 PM.
 
Old 07-26-2005, 08:08 PM   #2
mpeg4codec
Member
 
Registered: Jul 2005
Distribution: Debian, Gentoo, self-built [not LFS]
Posts: 109

Rep: Reputation: 15
If you're both behind NAT, they'll probably have to access you using PASV. I don't think there's any way around that. You could maybe set up a GRE tunnel, but good luck getting that to pass through your router if FTP won't. That would be overkill and more trouble than it's worth, anyway.
 
Old 07-26-2005, 10:04 PM   #3
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Actually, if you're both behind NAT, you're generally in for a bit of trouble.

One of the firewalls basically has to be able to track ftp connections (i.e., ipt_conntrack_ftp, IIRC). Or both.

Generally, though, if your firewall is capable of this, and you allow state=RELATED packets, you should be good to go.
 
Old 07-27-2005, 12:32 AM   #4
muppski
Member
 
Registered: Feb 2003
Posts: 149

Original Poster
Rep: Reputation: 15
So basiclly

Code:
iptables -A INPUT -p tcp --dport 21 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -p tcp --dport 20 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
Will do?
or is it sport?

Or is this just wrong?

BTW : i got

modprobe ip_conntrack
modprobe ip_nat_ftp
modprobe ip_conntrack_ftp
modprobe iptable_nat
in my iptables script
 
Old 07-27-2005, 12:34 AM   #5
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Generally speaking, you should accept ESTABLISHED,RELATED on all ports.
 
Old 07-27-2005, 12:47 AM   #6
muppski
Member
 
Registered: Feb 2003
Posts: 149

Original Poster
Rep: Reputation: 15
oh this?

Code:
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
btw I noticed you said
ipt_conntrack_ftp
and i have
ip_conntrack_ftp

Are they different?
 
Old 07-27-2005, 01:07 PM   #7
deoren
Member
 
Registered: Oct 2003
Location: USA
Distribution: Ubuntu
Posts: 216

Rep: Reputation: 30
Here is a snippet from an iptables script I run:

Code:
# load ftp connection tracking module if it isn't already loaded
if [ ! `lsmod 2>/dev/null | grep -q "ip_conntrack_ftp"` ]; then
    modprobe ip_conntrack_ftp ports=21
fi

# load ftp nat module if it isn't already loaded
# From my own trial and efforts, this module is needed
# in order to successfully do a list on a remote host.
# This is because with passive ftp the server tells
# the client which high unprivileged port the client
# needs to connect to.  Without (either this one or 
# above module, not sure which) the module, you would
# have to allow outgoing requests from all unprivileged
# ports. 
# https://lists.netfilter.org/pipermai...ay/011604.html
if [ ! `lsmod 2>/dev/null | grep -q "ip_nat_ftp"` ]; then
    modprobe ip_nat_ftp ports=21
If you're running on an alternate port (from the outside) you'll want to change 21 to whatever you've decided to use.
 
  


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
IPTABLES rules for active FTP TruckStuff Linux - Security 7 04-22-2009 06:21 PM
Active ftp, konqueror Hamsjael Linux - Networking 4 06-10-2005 10:01 AM
ftp confusion/want active connections servnov Linux - General 2 09-26-2004 01:48 PM
Connection tracking for Active FTP paradoxlight Linux - Networking 1 03-25-2003 03:18 AM
Active and Passive FTP sancho5 Linux - Networking 3 11-24-2001 09:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04: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