Sretto

2/20/20 9:00AM

I recently enabled the firewall software feature on my computer running Debian(a Linux distribution), here are the steps:

1: install Debian package "iptables"

# apt install iptables

Figure 1. Install software package "iptables" in command line

2: put firewall rules in file "/etc/iptables.conf"

*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
COMMIT

Figure 2. Contents of file "/etc/iptables.conf"

3: create firewall-starting file "/etc/network/if-pre-up.d/iptables"

#!/bin/sh
iptables-restore</etc/iptables.conf

Figure 3. Contents of file "/etc/network/if-pre-up.d/iptables"

4: make file "/etc/network/if-pre-up.d/iptables" executable

# chmod a+x /etc/network/if-pre-up.d/iptables

Figure 4. Make file "/etc/network/if-pre-up.d/iptables" executable in command line

5: run file "/etc/init.d/networking" to start firewall

# /etc/init.d/networking restart

Figure 5. Run "/etc/init.d/networking" in command line


Feng Zhou



About Us|Corporate Responsibility|Contact|Advertising Program

Sretto Home

© 2026 Sretto