Forrest logo
back to the iptables tool

iptables:tldr:e74eb

iptables: Delete chain rule.
$ sudo iptables -D ${chain} ${rule_line_number}
try on your machine

This command is used to delete a specific rule from a specific chain in the iptables firewall configuration on a Linux system.

Here's a breakdown of the command:

  • sudo: This command is used to run the subsequent command with administrative privileges. It allows the user to execute commands as the "superuser" or "root," providing the necessary permissions to modify system configuration.
  • iptables: This command-line utility allows the user to manipulate the netfilter firewall rules in the Linux kernel. It is used to filter network traffic and control network packets.
  • -D: This option specifies the delete operation, indicating that we want to remove a rule from a chain.
  • ${chain}: This variable should be replaced with the name of the specific chain from which you want to delete the rule. A chain is a list of rules that match and perform some action on network packets.
  • ${rule_line_number}: This variable should be replaced with the line number of the rule you want to delete. Each rule in a chain is assigned a line number, making it easier to identify and manipulate specific rules.

Overall, the command will remove the specified rule from the specified chain within the iptables firewall configuration.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the iptables tool