| Linux | Security | Debian | Slax | Tiny Core | Health |
|
Iptables 1 Iptables 3 Iptables 4 Iptables 9 Erase Everything from a Hard Drive |
Iptables 2Simplify the Set UpYou have seen how to set up a firewall. But it would take a long time if you typed all of the commands each time. Let's simplify the process. Open the Text Editor, not the Terminal this time, and type everything into a file, so it can be saved and used again. This will eliminate the need to type all of the commands every time you set up a firewall. Type:
This tells iptables to flush, or delete everything from Iptables. Without this, the rules would be added again, so each rule would be written twice. Still using the Text Editor, type all of the commands used on the previous page. When you have finished, save the file. You should now have:
Copy all of the lines together, and paste them to the Root Terminal. Notice, the terminal will process them one after another. You may need to press "Enter," when it gets to the last line. This depends on whether you copied the return at the end of the last line. If you are not sure, there is no harm in pressing "Enter" again. When copying the iptables set up, if you include the return at the end of the last line, you will not need to press enter when it gets to the last line. If you typed something incorrectly, you may get a message following that line. Check that there are no messages. You can scroll up in the terminal if it is already off the top of the screen. If you made a mistake, correct it in your file with the Text Editor, and paste the whole lot again. Now, every time you want to set up Iptables, you can copy this file, and paste it to Iptables. Save Your Iptables SetupIf you want to add more commands, you can add them to your file with the Text Editor, and paste the whole lot again. Save each new rule you want to add, in your file. If you keep a record of you iptables set up, setting it up again in the future will be quick and easy. © Copyright Guy Shipard 2008 - 2009 |