iptables, how to delete the last rule?

From: dr_b (wegenwacht_at_gmail.com)
Date: 09/29/05


Date: 29 Sep 2005 03:09:26 -0700

Hello,

Is there an easy way to delete the last rule in a chain?
(other than counting to get the rule number)

The rule is (from iptables -L):
REJECT all -- anywhere anywhere
reject-with icmp-host-prohibited

I'm trying with:
 /sbin/iptables -D INPUT -p all -s 0/0 -d 0/0 -j REJECT --reject-with
icmp-host-prohibited

but it gives me:
iptables: Bad rule (does a matching rule exist in that chain?)

thanks,

Patrick



Relevant Pages

  • Google Summer of Code 2009: Student applies to create a Better IPTables Management Tool
    ... a student) and select the Linux Foundation ... The tool focuses on helping the user to perceive what a particular chains of rules in a particular table does to a user specified packet. ... As the project aims for better IPtables management tool, I can contribute with my hard earned 3 years experience in maintenance of firewalls. ... The tools helps the user to either select all the rules in the chain or some particular rules and tells the impact of the application of selected rules upon the incoming/outgoing packet. ...
    (Linux-Kernel)
  • Re: Sample iptables rules list, inviting your suggestions / criticisms (thanks) :-)
    ... iptables commandline syntax. ... rules into a user-defined chain, so you need to define them only once. ... As I had suggested in I'd put the DNS ... $ipt -P OUTPUT DROP ...
    (comp.security.firewalls)
  • Need Help Figuring Out a DMZ Setup
    ... i have just built a new firewall box running redhat 8 & iptables. ... i can access my web site on the server in the dmz. ... packets that came from that lan (like checking mail, ... # Create chain for bad tcp packets ...
    (comp.os.linux.security)
  • Re: Help with Iptables on with RH linux
    ... iptables -P OUTPUT DROP ... # PREROUTING chain rules ... INPUT only when packets have a destination IP of your firewall. ...
    (RedHat)
  • Re: Max iptables rules?
    ... iptables processes rules in defined chains. ... Wrong, that is is the case for every chain, but the way from chain to chain ... # allow http access from NET_1 to SERVER_1 ... iptables -A server_1 -j myreject ...
    (comp.security.firewalls)