LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-28-2009, 05:24 PM   #1
szahmad1
LQ Newbie
 
Registered: Nov 2009
Posts: 14

Rep: Reputation: 1
Port settings for ftp server on gateway


Hi Guys ! I need to setup up ports on a fully configured gateway to allow traffic only on port 21 and 20 to access an ftp server.can plz anyone help,i actually need the commands.Thanks
 
Old 11-28-2009, 05:39 PM   #2
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by szahmad1 View Post
Hi Guys ! I need to setup up ports on a fully configured gateway to allow traffic only on port 21 and 20 to access an ftp server.can plz anyone help,i actually need the commands.Thanks

i assume this gateway is running iptables right?
 
Old 11-28-2009, 11:10 PM   #3
szahmad1
LQ Newbie
 
Registered: Nov 2009
Posts: 14

Original Poster
Rep: Reputation: 1
iptables on gateway

yes true ! The ftp server is on another machine and this machine is running iptables/firewall/gateway
 
Old 11-29-2009, 01:31 PM   #4
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by szahmad1 View Post
yes true ! The ftp server is on another machine and this machine is running iptables/fiewall/gateway
Got any firewall logs or can you show rules? My guess is no ftp conn track module loaded
 
Old 11-30-2009, 12:13 AM   #5
szahmad1
LQ Newbie
 
Registered: Nov 2009
Posts: 14

Original Poster
Rep: Reputation: 1
i dont have enough info what the firewall log or the rules are,but i am running fedora 10 on both server and gateway.This is one of the requirements

Q: configure your firewall (using iptables) on the gateway to allow FTP clients (using either Active or Passive mode) through to the FTP server. All other connections should not be allowed.
 
Old 11-30-2009, 03:34 AM   #6
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by szahmad1 View Post
i dont have enough info what the firewall log or the rules are,but i am running fedora 10 on both server and gateway.This is one of the requirements

Q: configure your firewall (using iptables) on the gateway to allow FTP clients (using either Active or Passive mode) through to the FTP server. All other connections should not be allowed.
Ok...you need to read up a bit about ftp connection tracking

Code:
http://www.linuxchix.org/content/courses/security/connection_tracking

you need to load the ftp connection track modules as well as allowing the access to the correct ports in the firewall.

for example, i have loaded these modules in

Code:
/etc/sysconfig/iptables-config
to get ftp working properly.


Code:
IPTABLES_MODULES="ip_conntrack_netbios_ns ip_nat_ftp ip_conntrack"
and allowed the source ip to the ports 20 and 21
 
Old 12-01-2009, 11:09 AM   #7
szahmad1
LQ Newbie
 
Registered: Nov 2009
Posts: 14

Original Poster
Rep: Reputation: 1
And How do you allow the source ip to the ports 20 and 20, i mean the commands
 
Old 12-02-2009, 04:00 AM   #8
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by szahmad1 View Post
And How do you allow the source ip to the ports 20 and 20, i mean the commands
Code:
iptables -I INPUT -p tcp -s x.x.x.x  -m multiport --dports 20,21 -j ACCEPT
I have a similar set up on my end but not allowing port 20.
the port 20 is more of a data connection from server -> client, so the RELATED,ESTABLISHED rule(s) and or the connection tracking modules should cover this.

Last edited by centosboy; 12-02-2009 at 04:23 AM.
 
Old 12-03-2009, 07:25 AM   #9
szahmad1
LQ Newbie
 
Registered: Nov 2009
Posts: 14

Original Poster
Rep: Reputation: 1
Thanks for your support, i really appreciate it.
 
Old 12-03-2009, 10:53 AM   #10
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by szahmad1 View Post
Thanks for your support, i really appreciate it.
thank me with a thumbs up
 
0 members found this post helpful.
Old 12-04-2009, 12:05 AM   #11
szahmad1
LQ Newbie
 
Registered: Nov 2009
Posts: 14

Original Poster
Rep: Reputation: 1
ok thanks ..........thumbs up,,,,lol
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 server/ftp settings dnoy Linux - Software 1 06-08-2009 10:37 PM
FTP port in the server Linux For Ever Slackware 4 11-11-2007 11:42 PM
My router has a ftp server and won't forward the port greeklegend Linux - Server 6 09-10-2006 02:41 AM
CentOS Opening port for FTP Server Thin Linux - Distributions 3 11-16-2005 11:38 AM
how do i setup basic ftp server settings crouk Linux - Networking 0 03-29-2004 12:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:48 AM.

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