Set up iptables

Approved 2024/01/26 23:40 by psycore (version: 1) Newest approved | Approver: psycore

This is an old revision of the document!


Set up iptables

Check rules

The following command lists all valid rules for iptables:

iptables -L

Save rules to a file

apt-get update
apt-get install iptables-persistent
nano /etc/iptables.test.rules
^O
^X

The iptables.test.rules file can now be edited.

Define rules

iptable rules can now be defined accordingly.

Activate rules in productive operation

iptables-save > /etc/iptables.up.rules
nano /etc/network/if-pre-up.d/iptables
^O
^X

The file /etc/network/if-pre-up.d/iptables is executed at system startup and loads the corresponding firewall rules. The following lines must be inserted here:

#!/bin/bash
 /sbin/iptables-restore < /etc/iptables.up.rules

Now make the file executable and that's it:

chmod +x /etc/network/if-pre-up.d/iptables
en/linux/iptables_einrichten.1706308833.txt.gz ยท Last modified: 2024/01/26 23:40
CC Attribution-Noncommercial-Share Alike 4.0 International