Site Tools


clearing_iptables

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
clearing_iptables [2023/05/08 04:47] – -replaced instances of switch or paramter with command, the proper term hogwildclearing_iptables [2024/10/31 21:09] (current) hogwild
Line 1: Line 1:
 ===== Clearing iptables custom commands prior to applying new ones ===== ===== Clearing iptables custom commands prior to applying new ones =====
  
-Let's say, as an example, that you wanted to use some custom iptables commands in a script, such as the firewall script. In fact, the following principles would apply to any recurring script (such as "WAN Up").+As an example, let's say that you wanted to use some custom iptables commands in a script, such as the firewall script. (Actually, the following principles would apply to any recurring scriptsuch as "WAN Up").
  
  \\ You can remove previously-added iptables directives using a simple approach:  \\ You can remove previously-added iptables directives using a simple approach:
Line 11: Line 11:
  \\  \\
  
-The commands below will check what iptables **-A** (append) or **-I** (insert) directives have been issued previously in the current Script/Firewall text. They will then force a run of the same command, replacing any instance of **-A** or **-I** with a **-D** (Delete) command. In essence, this will reverse/remove any user-added iptables directives. A user might have created custom tables in which to use advanced iptables commands. This is usually performed using the "**-N**" (new) command. The same principles described above will also apply to previously-issued directives which used the **-N command**.+The commands below will check what iptables **-A** (append) or **-I** (insert) directives have been issued previously in the current Script/Firewall text. They will then force a run of the same command, replacing any instance of **-A** or **-I** with a **-D** (Delete) command. In essence, this will reverse/remove any previous user-added iptables directives.
  
- \\ Here are some rules to remember when using these commands:+You might have created custom tables in which to use advanced iptables commands. This is usually performed using the "**-N**" (new) command. The same principles described above will also apply to previously-issued directives which used the **-N command**.
  
-  * First, you need to dereference the custom table from the built-in one, using the above method. + \\ Here are a few rules to remember when using these commands: 
-  * A table must then be emptied with the **-F** (Flush) switch/parameter (for example**iptables -F $TABLE_NAME ) **. + 
-  * Only at this point will you be allowed to remove the table with the command:  **iptables -X $TABLE_NAME** .+ \\ 
 + 
 +  * First, you need to dereference the custom table from the built-in one, \\ using the above method. 
 +  * A table must then be emptied with the **-F** (Flush) switch/parameter \\ (for example: "**iptables -F $TABLE_NAME") **. 
 +  * Only then will you be allowed to remove the table by using the command: \\ "**iptables -X $TABLE_NAME"**.
  
  \\  \\
  
  
clearing_iptables.1683517678.txt.gz · Last modified: 2023/05/08 04:47 by hogwild