Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm trying to remove a blocked IP from our server.

405 35964 DROP       all  --  !lo    *       IP ADDRESS           0.0.0.0/0 
 19   988 DROP       all  --  *      !lo     0.0.0.0/0            24.7.56.95 


root@host01 [~]# iptables -D INPUT 35964
iptables: Index of deletion too big
root@host01 [~]# iptables -D INPUT 405
iptables: Index of deletion too big

root@host01 [~]# iptables -D INPUT -s IPADDRESS -j ACCEPT
iptables: Bad rule (does a matching rule exist in that chain?)

What gives?! Google is of no help since I keep finding the same lines that give me the same error.

share|improve this question

migrated from superuser.com Nov 18 '11 at 4:33

This question came from our site for computer enthusiasts and power users.

3 Answers 3

Run iptables-save|grep 24.7.56.95 to get the exact rule command used to enabled the block. It will be something like:

-A INPUT ! -i lo -s 24.7.56.95 -j DROP

Take this command, replace the -A with -D and run it through iptables:

iptables -D INPUT ! -i lo -s 24.7.56.95 -j DROP

Et viola!

share|improve this answer

Use iptables -D INPUT 1 to delete the first rule in list, or iptables -F INPUT to delete all rules.


405 and 35964 are the packet and byte counts, respectively. Just like the header says.

$ sudo iptables -v -L
Chain INPUT (policy ACCEPT 1 packets, 155 bytes)
 pkts bytes target     prot opt in     out     source               destination

Use iptables -L --line-numbers to see the actual rule numbers.

share|improve this answer

Check if there is any block for the IP address in csf

grep /etc/csf

If found, remove that csf rule

csf -dr

It will automatically remove the iptable rule also.

You can check the status of IP using the command csf -g

If no rules in Ip tables, the result will be as follows:

Chain num pkts bytes target prot opt in out source destination
No matches found for in iptables

You can also check the same in IP table also.

iptables -nL | grep

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.