LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 07-12-2007, 10:50 AM   #1
FNC
Member
 
Registered: Feb 2001
Location: South Africa
Distribution: Fedora, Mandriva, PCLOS, SUSE - anything a can get my hands on
Posts: 140

Rep: Reputation: 15
iptables questions


Hi,

I want to prevent a range of ipaddresses on my network to access another range on the same subnet.
So basiclly I want to prevent 192.160.0.10-192.168.0.30 from seeing 192.168.0.31-192.168.0.40.
Do I have to add a rule under iptables FORWARD or iptables INPUT?

Regards
 
Old 07-12-2007, 12:57 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
this is impossible in a single place unless you're doing something like bridging between two switches. not sure what table that is then actually. iptables manpage suggests using the physdev module to get inside the bridged interfaces, and says that will work under FORWARD amongst others actually.

also check ebtables as a layer 2 replacement for iptables.

Last edited by acid_kewpie; 07-12-2007 at 12:58 PM.
 
Old 07-12-2007, 02:13 PM   #3
FNC
Member
 
Registered: Feb 2001
Location: South Africa
Distribution: Fedora, Mandriva, PCLOS, SUSE - anything a can get my hands on
Posts: 140

Original Poster
Rep: Reputation: 15
Ok , so how can I prevent a range of PC's from connecting to another range, but still access the same servers?
Do I have to use different subnets? And if so, can this be done on a single NIC with multiple IP's?
 
Old 07-12-2007, 06:42 PM   #4
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
The simplest way would be to have your ranges on their own interfaces.

You could then do it like:
Code:
iptables -I FORWARD -i eth0 -o eth1 \
-m iprange --src-range 192.168.0.100-192.168.0.200 \
-m iprange --dst-range 192.168.1.50-192.168.1.80 -j DROP
(Example assumes interface eth0 is on 192.168.0.0 while eth1 is on 192.168.1.0)

But if you're saying that all the clients are connected to the same interface then you'd need to do something like acid_kewpie suggested. A quick work-around could be to use INPUT rules on the destination hosts themselves (if they are GNU/Linux), like:
Code:
iptables -I INPUT -m iprange \
--src-range 192.168.0.10-192.168.0.30 -j DROP

Last edited by win32sux; 07-12-2007 at 06:48 PM.
 
  


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 questions notsosmart Linux - Security 2 10-15-2006 12:39 PM
questions about iptables Paxmaster Linux - Security 1 07-13-2005 02:01 AM
iptables questions AZDAVE Linux - Security 2 03-25-2004 01:26 PM
questions on sendmail and iptables aetengoku Linux - Software 4 01-27-2004 09:14 PM
iptables slackware questions moger Slackware 4 01-17-2004 07:07 AM

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

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