Iptables (Debian): Unterschied zwischen den Versionen

Aus MattWiki
Keine Bearbeitungszusammenfassung
Zeile 22: Zeile 22:
=== Enable Automatic Load of Rules at Startup ===
=== Enable Automatic Load of Rules at Startup ===


Copy load rules script to '''/etc/network/if-pre-up.d/'''
Copy import rules script to '''/etc/network/if-pre-up.d/'''


Add execution permissions:
Add execution permissions:

Version vom 27. September 2020, 09:35 Uhr

Commands

iptables-save > iptables.rules          # Export iptables rules to iptables.rules
iptables-restore < iptables.rules       # Import iptables rules from iptables.rules
iptables -L                             # List active iptables
iptables -L -v                          # List active iptables and show adapters
iptables -S                             # List active in iptables-save-format
iptables -F                             # Flush active rules

iptables on Debian

Add iptables Rule File

Copy iptables.rules to /etc

chown root:root iptables.rules
chmod 600 iptables.rules
iptables-restore < iptables.rules

Check, if still works.

Enable Automatic Load of Rules at Startup

Copy import rules script to /etc/network/if-pre-up.d/

Add execution permissions:

chmod +x iptables

The package iptables-persistent which also can be used for persisting iptables:

# apt-get install iptables-persistent

Blacklisting with ipset with Automatic Updates

See: https://github.com/trick77/ipset-blacklist