LinuxQuestions.org
Visit Jeremy's Blog.
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 04-04-2006, 01:00 AM   #1
xyleo
LQ Newbie
 
Registered: Jan 2006
Posts: 8

Rep: Reputation: 0
IP Tables -- could anyone guide me?


Dear Fan's of Linux,

I am new to these IP Tables, could anyone help me on how to manipulate

Currently i wanted to add in a rules for a particular IP segment only to be accessible to the local machine. does any one know how to do so.

Thanking a million..
 
Old 04-04-2006, 01:18 AM   #2
visitashu
LQ Newbie
 
Registered: Jan 2006
Location: Bangalore : INDIA
Distribution: Ubuntu, RedHat, Gentoo, Linux Mint, Arch Linux, Fedora
Posts: 26

Rep: Reputation: 0
hi...
u can set rules to whatever souces u want to debar from ur server machine.
#iptables -A INPUT -s 192.168.a.b -d 192.168.x.y -p tcp --dport 23 -j DROP

now this command 'll stop TELNET service from machine a.b to ur machine x.y
#sysctl -p
n c the net.ipv4.ip_forward=0 line //by default
set this to 1
what ever rules u set at this stage gets written to /etc/sysconfig/iptables
which by default is empty
also edit /etc/sysconfig/iptables-config enables YES to service u need
then start ur IPTABLE service in runlevels 235
check out n reply if this works
 
Old 04-04-2006, 12:48 PM   #3
JakeX
Member
 
Registered: Aug 2004
Location: Windsor Ontario
Distribution: Ubuntu, Debian, Redhat
Posts: 44

Rep: Reputation: 15
I found a great firewall script you could work off of here:
http://www.linuxquestions.org/questi...d.php?t=430360

Enjoy, I use it as my base setup for other linux boxes, works well, just need to customize for your particular setup.
 
Old 04-05-2006, 02:52 AM   #4
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
if what you want is to make it so that the box only has access to a certain subnet then you want to use the OUTPUT chain, not the INPUT chain... example:
Code:
iptables -P OUTPUT DROP

iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

iptables -A OUTPUT -o lo -j ACCEPT

iptables -A OUTPUT -d 192.168.1.0/24 -m state --state NEW -j ACCEPT
in the above example, the box would only be allowed to make connections to subnet 192.168.1.0/24...


you could also use a simpler way which doesn't use packet state filtering:
Code:
iptables -P OUTPUT DROP

iptables -A OUTPUT -d 192.168.1.0/24 -j ACCEPT

iptables -A OUTPUT -o lo -j ACCEPT

Last edited by win32sux; 04-05-2006 at 02:54 AM.
 
  


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
IP Tables Jeewhizz Linux - Security 3 02-26-2009 01:27 PM
IP Tables gjagadish Linux - Networking 1 02-10-2006 05:33 PM
what are ip tables? master Linux - Security 4 01-24-2005 07:59 PM
IP TABLES help chrisfirestar Linux - Networking 2 10-29-2003 12:24 PM
Ip Tables Mag|c Linux - Security 3 06-26-2003 10:06 PM

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

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