LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 11-25-2010, 08:55 AM   #1
ruckus_laci
LQ Newbie
 
Registered: Nov 2010
Posts: 3

Rep: Reputation: 0
Post iptables - ip filtering


Hi Gentlemen!

I'm trying to write an iptables config file, but got stuck.

So I want to define an IP range that allows full access eth0-eth1 forwarding, and another that is allowed to access some special ip-s.
The first part works, I could make the range has full access:

iptables -A FORWARD -m iprange --src-range 192.168.80.20-192.168.80.40 -j ACCEPT
iptables -A FORWARD -i eth1 -o eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -o eth1 -i eth0 -j ACCEPT
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward

But cant find out, how tom make the second rule. How could I put speicified target ip-s in this? I've tried to make a new chain:

iptables -N ALLOW
iptables -A FORWARD -m iprange --src-range 192.168.80.40-192.168.80.50 -j ALLOW
iptables -A ALLOW ...
But from this point there was no syntax I could force to work.

(sorry for my bad english )
And thx for help!

Another idea to allow the allow chain to accept the IP:

iptables -A ALLOW -s IP -j ACCEPT
iptables -A ALLOW DROP
iptables -A ALLOW -j FROWARD

Any other idea?

Last edited by ruckus_laci; 11-25-2010 at 11:27 AM.
 
Old 11-25-2010, 09:22 AM   #2
fcintron
Member
 
Registered: Oct 2010
Location: México
Distribution: Centos
Posts: 72

Rep: Reputation: 4
Quote:
Originally Posted by ruckus_laci View Post
Hi Gentlemen!

I'm trying to write an iptables config file, but got stuck.

So I want to define an IP range that allows full access eth0-eth1 forwarding, and another that is allowed to access some special ip-s.
The first part works, I could make the range has full access:

iptables -A FORWARD -m iprange --src-range 192.168.80.20-192.168.80.40 -j ACCEPT
iptables -A FORWARD -i eth1 -o eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -o eth1 -i eth0 -j ACCEPT
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward

But cant find out, how tom make the second rule. How could I put speicified target ip-s in this? I've tried to make a new chain:

iptables -N ALLOW
iptables -A FORWARD -m iprange --src-range 192.168.80.40-192.168.80.50 -j ALLOW
iptables -A ALLOW ...
But from this point there was no syntax I could force to work.

(sorry for my bad english )
And thx for help!

Hi, why don´t you try Firehol http://firehol.sourceforge.net/, It has a very easy to use script language. I have 1 server with a firewall with around 300 iptables rules that in Firehol script language are 20 lines.

Regards
 
  


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
IPTABLES Mac filtering hertzzmang Linux - Networking 1 09-27-2009 07:08 AM
String filtering using IPTABLES bobbera Linux - Server 5 06-25-2008 08:27 AM
iptables mac filtering Ventrix Linux - Security 1 11-21-2007 07:29 PM
filtering with iptables behind a proxy torgeir.nes Linux - Server 2 05-24-2007 01:27 AM
iptables and content filtering evan1821 Linux - Security 1 06-09-2004 01:03 PM

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

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