LinuxQuestions.org
Help answer threads with 0 replies.
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 04-23-2009, 10:56 PM   #1
saifkhan123
Member
 
Registered: Apr 2009
Distribution: Red Hat/CentOS
Posts: 108

Rep: Reputation: 19
iptables configuration


hello,
i am currently working for a company and a task has been assigned to me to create a monitoring server on a linux machine (Centos 5.2) using splunkd, now i have created the monitoring server and its working fine,the issue is that i just want my server to be accessed only through my 3 IP-Addresses at port 8000, for this i am using iptables but unable to figure out how i will do this, can anybody help me, the current config of my iptables file is

------------------------------------------------
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p 50 -j ACCEPT
-A RH-Firewall-1-INPUT -p 51 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8000 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 514 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 514 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
------------------------------------------------------------------------------------------
accessing server address is 172.16.100.187:8000, and the ip-adresses which i want to allow are 10.10.1.21, 10.10.1.22, 10.10.1.23 (only these 3 addresses can only access the server at http port 8000)...........the rest all the traffic should be blocked ......can anybody tell me exact configuration of iptables for this scenario.

Regards,
Tauseef Khan
 
Old 04-24-2009, 12:09 AM   #2
kirukan
Senior Member
 
Registered: Jun 2008
Location: Eelam
Distribution: Redhat, Solaris, Suse
Posts: 1,278

Rep: Reputation: 148Reputation: 148
Accept the source address which you want to allow access and then drop all others
iptables -A INPUT -s 10.10.1.21/255.255.255.0 -p tcp -m state --state NEW -m tcp --dport 8000 -j ACCEPT
 
Old 04-24-2009, 01:35 AM   #3
yecao
LQ Newbie
 
Registered: Apr 2009
Posts: 2

Rep: Reputation: 1
Hi
You can input command fellow

iptables -I INPUT 11 -s 10.10.1.20/255.255.252.0 -p tcp -m state --state NEW -m tcp --dport 8000 -j ACCEPT
iptables -D RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8000 -j ACCEPT

This command will cause only 10.10.1.20-23 access your server
if you want more strict input fellow
iptables -I INPUT 11 -s 10.10.1.20/255.255.254.0 -p tcp -m state --state NEW -m tcp --dport 8000 -j ACCEPT
iptables -I INPUT 11 -s 10.10.1.22 -p tcp -m state --state NEW -m tcp --dport 8000 -j ACCEPT
iptables -D RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8000 -j ACCEPT

I come from china ,my enlish is so bad, if something wrong sorry
 
Old 04-24-2009, 11:40 PM   #4
saifkhan123
Member
 
Registered: Apr 2009
Distribution: Red Hat/CentOS
Posts: 108

Original Poster
Rep: Reputation: 19
thanks guys

thank you very much guys your config is working......wooooohooooo!!!!!!
 
  


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 Configuration? SBN Linux - Security 6 11-13-2006 09:33 PM
Iptables configuration gurl4sh25 Linux - Security 5 10-10-2006 01:20 AM
Please help me with iptables configuration rbm Linux - Security 4 01-29-2006 05:48 AM
iptables configuration props666999 Linux - Security 3 08-28-2005 02:32 PM
iptables configuration tungaw2001 Linux - Networking 2 04-15-2004 03:01 PM

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

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