LinuxQuestions.org
Help answer threads with 0 replies.
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-18-2006, 03:07 AM   #1
winxandlinx
Member
 
Registered: May 2006
Posts: 141

Rep: Reputation: 15
Adding the rule in iptables ?


Hi Everyone

I am new to linux and iptables

First i am practicing the ipatbles in ferdora core 6

I have only one local ip in the iptables machine

my ip is 192.168.1.12(where the iptable is running )

Now i want to addthis rule in the iptables

"iptables -A INPUT -s 0/0 -i eth0 -d 192.168.1.12 - p
TCP -j DROP

i tryed go to the path of vi /etc/sysconfig/iptables

and i added that ,but its saying error

And also Normall i run that command its not working

What i should i add or run this to get updated

And where i can see for the status that my rule got

updated in the iptabless

Please clarify my doubts on iptables

I like yo learn iptables

Healping this issue will be greatly appriciated

Thanks&Regards
winxandlinx
 
Old 11-18-2006, 05:31 AM   #2
amitsharma_26
Member
 
Registered: Sep 2005
Location: New delhi
Distribution: RHEL 3.0/4.0
Posts: 777

Rep: Reputation: 31
Quote:
Originally Posted by winxandlinx
"iptables -A INPUT -s 0/0 -i eth0 -d 192.168.1.12 - p
TCP -j DROP
Code:
iptables -A INPUT -s 0/0 -i eth0 -d 192.168.1.12 -p TCP -j DROP
Copy ^^^ & run it. (maybe your rule had some problems with spaces)


Quote:
Originally Posted by winxandlinx
i tryed go to the path of vi /etc/sysconfig/iptables
About the default redhat firewall script, there are 2 things;
first they pipe all the input from INPUT to another new chain & second you are not supposed to use the above format. Follow the format mentioned in that file itself.


About learning iptables;
follow this....
Iptables Tutorial 1.1.19
Oskar Andreasson
http://www.linuxsecurity.com/resourc...-tutorial.html
 
Old 11-20-2006, 12:03 AM   #3
winxandlinx
Member
 
Registered: May 2006
Posts: 141

Original Poster
Rep: Reputation: 15
No Its not happening anything

when i am running this

Tell me where i can check that command has got updated or not
 
Old 11-20-2006, 07:00 AM   #4
amitsharma_26
Member
 
Registered: Sep 2005
Location: New delhi
Distribution: RHEL 3.0/4.0
Posts: 777

Rep: Reputation: 31
Quote:
Originally Posted by winxandlinx
No Its not happening anything

when i am running this

Tell me where i can check that command has got updated or not
Code:
iptables -vnL
will confirm you the same in a tabular form.
 
Old 11-20-2006, 11:12 PM   #5
winxandlinx
Member
 
Registered: May 2006
Posts: 141

Original Poster
Rep: Reputation: 15
Hi Amit

Thanks for the reply

i run this command iptables -vnL


Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
3177 4703K RH-Firewall-1-INPUT all -- * * 0.0.0.0/0 0.0.0.0/0

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 RH-Firewall-1-INPUT all -- * * 0.0.0.0/0 0.0.0.0/0

Chain OUTPUT (policy ACCEPT 1657 packets, 4514K bytes)
pkts bytes target prot opt in out source destination

Chain RH-Firewall-1-INPUT (2 references)
pkts bytes target prot opt in out source destination
1589 4506K ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmp type 255
0 0 ACCEPT esp -- * * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT ah -- * * 0.0.0.0/0 0.0.0.0/0
39 4362 ACCEPT udp -- * * 0.0.0.0/0 224.0.0.251 udp dpt:5353
0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:631
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:631
38 3925 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
1 48 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
1510 189K REJECT all -- * * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

Thanks & Regards
Winxandlinx
 
Old 11-20-2006, 11:27 PM   #6
winxandlinx
Member
 
Registered: May 2006
Posts: 141

Original Poster
Rep: Reputation: 15
This is second time

So i am running again

iptables -A INPUT -s 0/0 -i eth0 -d 192.168.1.12 -p TCP -j DROP

After ruunging this

Again iptables -vnL

output is

chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
735 79454 RH-Firewall-1-INPUT all -- * * 0.0.0.0/0 0.0.0.0/0

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 RH-Firewall-1-INPUT all -- * * 0.0.0.0/0 0.0.0.0/0

Chain OUTPUT (policy ACCEPT 63 packets, 7295 bytes)
pkts bytes target prot opt in out source destination

Chain RH-Firewall-1-INPUT (2 references)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmp type 255
0 0 ACCEPT esp -- * * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT ah -- * * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT udp -- * * 0.0.0.0/0 224.0.0.251 udp dpt:5353
0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:631
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:631
65 5058 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
1 48 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
669 74348 REJECT all -- * * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

Please check and try to solve this problem

Very egar to work in iptables

Last edited by winxandlinx; 11-21-2006 at 03:11 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
What is it doing this iptables rule?? lanczer Linux - Security 1 02-24-2006 11:26 AM
a little help needed for adding nat rule cutejai Linux - Networking 1 12-16-2005 06:14 PM
help with iptables rule!! vishamr2000 Linux - Security 6 11-09-2005 05:34 AM
Issues with adding a udev rule... Ateo Linux - General 1 03-04-2005 08:02 PM
IPTables Rule... Grim Reaper Linux - Software 8 04-28-2003 12:20 PM

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

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