LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 08-11-2008, 08:50 AM   #1
Mithrilhall
Member
 
Registered: Feb 2002
Location: Adamstown, Pitcairn Islands
Distribution: Neon
Posts: 291

Rep: Reputation: 30
Question iptables question


How can I block incoming (FORWARD) ftp access to 10.150.125.0/24 and 172.16.136.0/24?

TIA
 
Old 08-11-2008, 08:53 AM   #2
Mithrilhall
Member
 
Registered: Feb 2002
Location: Adamstown, Pitcairn Islands
Distribution: Neon
Posts: 291

Original Poster
Rep: Reputation: 30
Would this work?

Code:
iptables -A FORWARD -p tcp -d 10.150.125.0/24 -s 0.0.0.0/0 --dport 21 -j DROP
 
Old 08-11-2008, 01:34 PM   #3
KinnowGrower
Member
 
Registered: May 2008
Location: Toronto
Distribution: Centos && Debian
Posts: 347

Rep: Reputation: 34
but what if i want to allow ftp access from inside my Network (192.168.0.0)

when 192.168.0.254 is ftp server in my network

please reply
 
Old 08-11-2008, 04:19 PM   #4
framp
Member
 
Registered: Apr 2003
Location: Next to Stuttgart, Germany
Distribution: Debian, Mint, Raspbian
Posts: 131
Blog Entries: 5

Rep: Reputation: 27
Quote:
Originally Posted by Mithrilhall View Post
Would this work?

Code:
iptables -A FORWARD -p tcp -d 10.150.125.0/24 -s 0.0.0.0/0 --dport 21 -j DROP
Because port 21 is used to establish ftp connections that should work.
 
Old 08-11-2008, 04:22 PM   #5
framp
Member
 
Registered: Apr 2003
Location: Next to Stuttgart, Germany
Distribution: Debian, Mint, Raspbian
Posts: 131
Blog Entries: 5

Rep: Reputation: 27
Quote:
Originally Posted by varindersingh View Post
but what if i want to allow ftp access from inside my Network (192.168.0.0)

when 192.168.0.254 is ftp server in my network

please reply
First of all enable port 21.
Then allow port 20 to go out to any other port (normal ftp port mode)
and allow all port > 1024 to acces the ftp server ports > 1024 (passive ftp mode)
 
Old 08-11-2008, 05:46 PM   #6
KinnowGrower
Member
 
Registered: May 2008
Location: Toronto
Distribution: Centos && Debian
Posts: 347

Rep: Reputation: 34
Quote:
Originally Posted by Mithrilhall View Post
Would this work?

Code:
iptables -A FORWARD -p tcp -d 10.150.125.0/24 -s 0.0.0.0/0 --dport 21 -j DROP
Hello dear friend

why its FORWARD chain,rather than INPUT

can u explain it please

& as i understand it will block traffic from all IPs/all networks deatined to port 21

so what will happen to Local network. Will the hosts in local network be able to access ftp (port 21).?
 
Old 08-12-2008, 02:46 AM   #7
framp
Member
 
Registered: Apr 2003
Location: Next to Stuttgart, Germany
Distribution: Debian, Mint, Raspbian
Posts: 131
Blog Entries: 5

Rep: Reputation: 27
Quote:
How can I block incoming (FORWARD) ftp access to 10.150.125.0/24 and 172.16.136.0/24?
Because there are multiple networks I assume there is a Linux router with multiple interfaces which is used as the firewall for all private networks and then you have to use the forward chain on this router. If you have one system directly connected to the internet then you are right and you have to use the input chain. You also might drop all connections on the ftp servers from the outside. But then you have to create sophisticated iptables rules so you can access the ftp server from the internal net. If you drop forwarding on the Linux router that's much easier.

Last edited by framp; 08-12-2008 at 02:50 AM.
 
Old 08-12-2008, 10:07 AM   #8
KinnowGrower
Member
 
Registered: May 2008
Location: Toronto
Distribution: Centos && Debian
Posts: 347

Rep: Reputation: 34
hi framp

u did the excellent job. Its great.. So what i understood from this discussion is ..

1. In case of ftp is running in local network we use FORWARD on Linux router
2. In case of ftp is running same box as of Linux router we use INPUT

is it right sir?

I have the 2nd case means my Linux box is directly connected to the internet through DSL
its Linux router as well as ftp server/telnet server.So i think i have to use INPUT chain instead of FORWARD. Right?

Please reply

thanks for help again

Last edited by KinnowGrower; 08-12-2008 at 12:01 PM.
 
Old 08-12-2008, 03:02 PM   #9
framp
Member
 
Registered: Apr 2003
Location: Next to Stuttgart, Germany
Distribution: Debian, Mint, Raspbian
Posts: 131
Blog Entries: 5

Rep: Reputation: 27
Quote:
Originally Posted by varindersingh View Post
... I have the 2nd case means my Linux box is directly connected to the internet through DSL
its Linux router as well as ftp server/telnet server.So i think i have to use INPUT chain instead of FORWARD. Right?
yes you are right
 
Old 08-12-2008, 03:13 PM   #10
ne pas
Member
 
Registered: Jul 2008
Posts: 55

Rep: Reputation: 23
@varindersingh, see Netfilter Traversal Diagramm it shows the tables and default rules a packet passes.
 
Old 08-12-2008, 11:58 PM   #11
KinnowGrower
Member
 
Registered: May 2008
Location: Toronto
Distribution: Centos && Debian
Posts: 347

Rep: Reputation: 34
Hi friends

I got it.

Thanks for help
 
  


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 question lsu420luv General 2 03-23-2006 10:38 AM
iptables v1.2.9: Unknown arg `/sbin/iptables' Try `iptables -h' or 'iptables --help' Niceman2005 Linux - Security 4 12-29-2005 08:20 PM
Question on Iptables jspsandhu Linux - Security 3 06-04-2005 08:09 PM
iptables question smirn0ff Linux - Security 5 04-13-2005 03:03 AM
Question about iptables tontod Linux - Networking 3 06-10-2002 05:03 PM

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

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