Linux Security Debian Slax Tiny Core Health

Security

Frugal Install

Encryption

Definitions

Iptables 1
Set Up a Simple Firewall

Iptables 2
Simplify the Setup

Iptables 3
Start the Firewall Automatically

Iptables 4
Change the Policy to Drop

Iptables 5
Logging

Iptables 6
Add Rules

Iptables 7
IP Address Blocks

Iptables 8
Add Chains

Iptables 9
Change Rules While in Use

Iptables Summary

Graphical Firewalls

Check for Malware

Erase Everything from a Hard Drive

Security Links


Other Links


Contact Details

Iptables 3

Start the Firewall Automatically

You have seen how to set up a firewall, but each time you turn the computer off, the firewall settings are lost. The next step is to set it up so it starts automatically each time the computer is turned on.

Using the Text Editor, after the other lines, add the line:

iptables-save > /etc/iptables.rules

This tells iptables to save the rules in the file "/etc/iptables.rules." You can use any file name, and any directory.

You should now have:

iptables -F
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p tcp --sport 80 -j ACCEPT
iptables -A INPUT -p udp --sport 53 -j ACCEPT
iptables -A INPUT -j DROP
iptables-save > /etc/iptables.rules

Copy and paste this to the Root Terminal.

Iptables has now saved the rules, but you need to tell the computer where to find them when it starts. To do this you need to add a line to the file "/etc/network/interfaces."

Open the file "/etc/network/interfaces" with a Root Text Editor.

Add the line:

pre-up iptables-restore < /etc/iptables.rules

Save the file.

If you have used a different name for your file, use that name here.

The Iptables firewall will now start every time the computer is turned on. Check and see. Turn the computer off and restart.

Open the terminal and type:

iptables -L

If you have done everything correctly, you will see the Iptables rules.

You have a firewall.

If you are happy with a very simple firewall, you can leave it as it is. The way it is so far, it may prevent access to some things.

If you want to learn more, continue.


< Iptables 2 Simplify the Setup

Iptables 4 Change the Policy to Drop >


© Copyright Guy Shipard 2008 - 2009