lpi2:iptables
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen der Seite angezeigt.
| Beide Seiten, vorherige ÜberarbeitungVorherige ÜberarbeitungNächste Überarbeitung | Vorherige Überarbeitung | ||
| lpi2:iptables [2013/12/13 17:44] – ingo_wichmann | lpi2:iptables [2019/12/19 17:19] (aktuell) – [Links] dirk_streubel | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| ====== iptables beobachten ====== | ====== iptables beobachten ====== | ||
| - | watch -d iptables -L -n -v --line-numbers | + | watch -d iptables -nvL --line-numbers |
| * -L = List (auflisten) | * -L = List (auflisten) | ||
| Zeile 7: | Zeile 7: | ||
| * --line-numbers = Regeln Nummerieren (einzelne Regeln können anhand der Nummer z.B. gelöscht werden) | * --line-numbers = Regeln Nummerieren (einzelne Regeln können anhand der Nummer z.B. gelöscht werden) | ||
| - | ====== iptables | + | ====== iptables |
| + | ===== filter ===== | ||
| + | iptables -P INPUT ACCEPT | ||
| + | iptables -P OUTPUT ACCEPT | ||
| + | iptables -P FORWARD ACCEPT | ||
| + | iptables -F | ||
| + | iptables -X | ||
| + | ===== nat ===== | ||
| + | iptables -t nat -F | ||
| + | iptables -t nat -X | ||
| + | ====== iptables Syntax ====== | ||
| ^ table ^ command ^ chain ^ rule-specification | ^ table ^ command ^ chain ^ rule-specification | ||
| | -t filter | -A | INPUT | -s | | | -t filter | -A | INPUT | -s | | ||
| Zeile 15: | Zeile 25: | ||
| | ::: | -I | ::: | -o | | | ::: | -I | ::: | -o | | ||
| | ::: | -R | ::: | | ::: | -R | ::: | ||
| - | | -t nat | -L | PREROUTING | + | | -t nat | -L | PREROUTING |
| - | | ::: | -S | OUTPUT | + | | ::: | -S | OUTPUT |
| - | | ::: | -F | POSTROUTING | :::| tcp | '' | + | | ::: | -F | POSTROUTING | :::| tcp | '' |
| - | | ::: | -Z | ::: | :::| ::: | '' | + | | ::: | -Z | ::: | :::| ::: | '' |
| - | | -t mangle | -N | PREROUTING | + | | -t mangle | -N | PREROUTING |
| | ::: | -X | OUTPUT | | ::: | -X | OUTPUT | ||
| - | | ::: | -P | INPUT | -m | conntrack | --ctstate | + | | ::: | -P | INPUT | -m | conntrack | '' |
| | ::: | -E | POSTROUTING | | | | ::: | -E | POSTROUTING | | | ||
| (( inspiriert von: | (( inspiriert von: | ||
| {{: | {{: | ||
| )) | )) | ||
| - | |||
| - | ====== iptables filter-Regeln komplett zurücksetzen ====== | ||
| - | iptables -P INPUT ACCEPT | ||
| - | iptables -P OUTPUT ACCEPT | ||
| - | iptables -P FORWARD ACCEPT | ||
| - | iptables -F | ||
| - | iptables -X | ||
| - | iptables -t nat -F | ||
| - | iptables -t nat -X | ||
| ====== Einbindung von iptables in den Bootvorgang ====== | ====== Einbindung von iptables in den Bootvorgang ====== | ||
| - | ===== CentOS ===== | + | ===== CentOS |
| + | Paket: iptables-services | ||
| / | / | ||
| speichert die aktuell aktiven iptables-Regeln in der Datei ''/ | speichert die aktuell aktiven iptables-Regeln in der Datei ''/ | ||
| + | |||
| + | ===== CentOS (ab 7) ===== | ||
| + | wie SuSE, oder '' | ||
| + | |||
| ===== SuSE ===== | ===== SuSE ===== | ||
| Zeile 112: | Zeile 119: | ||
| update-rc.d iptables start 40 S . stop 89 0 6 . | update-rc.d iptables start 40 S . stop 89 0 6 . | ||
| + | Alternativ: | ||
| + | ''/ | ||
| + | < | ||
| + | auto eth0 | ||
| + | iface eth0 inet dhcp | ||
| + | up sh -c ' | ||
| + | </ | ||
| ====== Einfacher Paketfilter mit NAT ====== | ====== Einfacher Paketfilter mit NAT ====== | ||
| Zeile 180: | Zeile 194: | ||
| * http:// | * http:// | ||
| * http:// | * http:// | ||
| + | * https:// | ||
| + | |||
| - | ===== iptables und dhcp ===== | ||
| - | * http:// | ||
| ===== iptables und ssh ===== | ===== iptables und ssh ===== | ||
| * http:// | * http:// | ||
lpi2/iptables.1386956661.txt.gz · Zuletzt geändert: 2013/12/13 17:44 von ingo_wichmann
