Tag Archive for 'firewall'

Debian 9: permanent iptables rules

Just an example for Debian 9.

1. Install ‘iptables-persistent’ package. Agree during installation the rules to be saved to /etc/iptables/rules.v4 .

2. Add rules (e.g. from console):

iptables -P OUTPUDT DROP
iptables -A OUTPUT -d -j ACCEPT

3. Save rules:

netfilter-persistent save

4. Reboot and enjoy.

5. If you need to add/delete/edit rules, edit /etc/iptables/rules.v4 and then run ‘netfilter-persistent start’ to re-read the file.