| 149 | |
| 150 | '''3. Deleting a rule from the iptable :''' |
| 151 | |
| 152 | '''Syntax:-''' |
| 153 | {{{ |
| 154 | sudo iptables -D chain_name rule_number |
| 155 | }}} |
| 156 | '''Example:-'''[[BR]] |
| 157 | If we want to delete the rule which accepts the traffic to port 22 and which we have added in the previous section, then:- |
| 158 | {{{ |
| 159 | sudo iptables -D INPUT 1 |
| 160 | }}} |
| 161 | Remember the rules number starts from 1 |
| 162 | |
| 163 | '''4. Saving your configuration :''' |
| 164 | This part is unnecessary if you are implementing it on a personal computer which is not a server, but if |
| 165 | you are implementing a firewall on a server, then there are high chances that your server might get corrupted and |
| 166 | you might lose all your data. So, it’s always better to save your configurations. |
| 167 | |
| 168 | There are a lot of ways to do this, but the easiest way I find is with '''iptables-persistent''' package. You can download the package from Ubuntu’s default repositories: |
| 169 | {{{ |
| 170 | sudo apt-get update |
| 171 | sudo apt-get install iptables-persistent |
| 172 | }}} |
| 173 | Once the installation is complete, you can save your configuration using the command:- |
| 174 | {{{ |
| 175 | sudo invoke-rc.d iptables-persistent save |
| 176 | }}} |