LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 01-06-2005, 04:58 AM   #1
picox
LQ Newbie
 
Registered: Dec 2004
Posts: 5

Rep: Reputation: 0
iptables not working with me


Hello
im trying to block an ip through iptables. i used the following:
Code:
iptables -A INPUT -s xxx.xxx.xxx.xxx -j DROP
but when i go to iptables-save i dont see the above rule!
i just see:

Code:
# Generated by iptables-save v1.2.8 on Thu Jan  6 05:57:38 2005
*mangle
:PREROUTING ACCEPT [3651966:2382433568]
:INPUT ACCEPT [2472348:2171093958]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [2627433:2884125516]
:POSTROUTING ACCEPT [2627433:2884125516]
COMMIT
# Completed on Thu Jan  6 05:57:38 2005
# Generated by iptables-save v1.2.8 on Thu Jan  6 05:57:38 2005
*filter
:INPUT ACCEPT [292528:88815113]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [148233:81064206]
COMMIT
# Completed on Thu Jan  6 05:57:38 2005
i even tried to block myself and it didnt work! plz help
 
Old 01-06-2005, 08:35 AM   #2
musicman_ace
Senior Member
 
Registered: May 2001
Location: Indiana
Distribution: Gentoo, Debian, RHEL, Slack
Posts: 1,555

Rep: Reputation: 46
Putting a drop on the INPUT chain would stop them from accessing your pc from that IP address. If you want do block yourself from an IP, shouldn't it go on the OUTPUT chain.
 
Old 01-06-2005, 08:38 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,679

Rep: Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893
Look at the output of:
iptables -L

Did you save the current rules with iptables-save command? If not then the file will not show that rule.

I see that you did save the tables.

Last edited by michaelk; 01-06-2005 at 08:39 AM.
 
Old 01-06-2005, 09:01 AM   #4
picox
LQ Newbie
 
Registered: Dec 2004
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by michaelk
Look at the output of:
iptables -L

Did you save the current rules with iptables-save command? If not then the file will not show that rule.

I see that you did save the tables.
iptables -L doesn;t show me anything
 
Old 01-06-2005, 09:05 AM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,679

Rep: Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893
Is iptables even running?
 
Old 01-07-2005, 01:49 AM   #6
nirav.jani
Member
 
Registered: Nov 2004
Location: Hyderabad, India
Distribution: Fedora Core - II, RedHat - 9
Posts: 45

Rep: Reputation: 15
The same thing is happening with me also, even I have downloaded the latest version of iptables from www.netfilter.org
and installed it, I dont know what is the problem but I am not able to block INPUT traffic from a particular ip address as per the picox and yes uptill I know this command should stop every traffic comming from a particular IP address.
I have just modified it and it is
iptables -A INPUT -i eth0 -s xxx.xxx.xxx.xxx -j DROP
it must work with atleast one input source that is eth0 , but not working why I don't know ?
Nirav
 
Old 01-09-2005, 05:35 PM   #7
CodeFish
LQ Newbie
 
Registered: Apr 2004
Distribution: Mandrake
Posts: 11

Rep: Reputation: 0
picox,

you have to load your rule-set before using iptables-save. You may need to activate iptables:
$ service iptables start

Initially, there are no rules. One option is to edit /etc/rc.d/init.d/iptables
see "Iptables Tutorial 1.1.19" by Oskar Andreasson at frozentux.net for other options/more details.

---

Nirav,

try,

iptables -A INPUT -i eth0 -s -j DROP
or
iptables -A INPUT -i eth0 -s 0/0 -j DROP
 
Old 01-10-2005, 01:28 AM   #8
nirav.jani
Member
 
Registered: Nov 2004
Location: Hyderabad, India
Distribution: Fedora Core - II, RedHat - 9
Posts: 45

Rep: Reputation: 15
Yes that is what I have tried previously the problem with the command
iptables -A INPUT -i eth0 -s -j DROP - it will show an error or something like take help by iptables -h - because we haven't provided the ip address or anything with -s option.

with the command
iptables -A INPUT -i eth0 -s 0/0 -j DROP will block all the websites - uptill I know, but I want to stop only one ip address - or say traffic from any one ip address to my computer.

Anyway I don't know any settings have been changed or what but I am not able to stop traffic from any one ip address still and the command like

iptables -A INPUT -i eth0 -s XXX.XXX.XXX.XXX -j DROP

still works fine - with no effect on traffic from that site

any solutions ?
nirav
 
Old 01-10-2005, 02:54 AM   #9
nirav.jani
Member
 
Registered: Nov 2004
Location: Hyderabad, India
Distribution: Fedora Core - II, RedHat - 9
Posts: 45

Rep: Reputation: 15
Hi all,
In my problem I got success after flushing all the chains and changing the default policies of chains,
I have goen through this link and utilises it to do my job
http://iptables-tutorial.frozentux.n...h-iptables.txt

enjoy
Nirav
 
  


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 not working selfnet Linux - Networking 2 05-02-2005 11:23 AM
Iptables is not working under RH 3.0 aronnok Linux - Security 3 12-25-2004 05:40 PM
iptables not working ashfaq Linux - Software 1 03-24-2004 05:02 AM
Iptables not working? powerchord81 Linux - Networking 22 10-31-2003 09:18 AM
IPtables: almost working but... psychoholic Linux - Networking 4 09-11-2003 08:19 AM

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

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