Skip to content

How to configure firewall on linux

Below I will go over three easy steps on Configuring IPTables Firewall on Linux Environment. The following configuration was tested on 64 Bit Debian.

The firewall itself consists of two configuration files located in the following location.

/etc/default/firewall-rules consist the firewalls rules which are editable by the user.
/etc/init.d/firewall is the script for start|stop|restart|status of the firewall.

Please use this as a template and replace the EXIF, EXTIP and other IP Address / Ranges.

Configuring Firewall Rules

Firewall Control Script

Once the Firewall rules in done. Please make sure to make the script executable by issuing the following command.

Once that is completed, add the following script and reside it in /etc/init.d/firewall.

Please make sure to make the script executable by issuing the following command.

Now the firewall can be controlled via the following commands.

Automatic Start on Boot

Finally, this firewall needs to be added to /etc/rc.local so the rules can be applied on boot. This option might vary between distros so I suggest you refer to the appropriate distros manual.

comments powered by Disqus