Hier werden die Unterschiede zwischen zwei Versionen gezeigt.
Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung Nächste Überarbeitung | Vorherige Überarbeitung Nächste Überarbeitung Beide Seiten, nächste Überarbeitung | ||
lpi2:iptables [2013/12/13 17:43] ingo_wichmann |
lpi2:iptables [2016/12/01 16:26] 127.0.0.1 Externe Bearbeitung |
||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
- | ====== iptables Syntax ====== | + | ====== iptables beobachten ====== |
+ | watch -d iptables -nvL --line-numbers | ||
+ | * -L = List (auflisten) | ||
+ | * -n = no DNS-lookup | ||
+ | * -v = verbose (gesprächig) | ||
+ | * --line-numbers = Regeln Nummerieren (einzelne Regeln können anhand der Nummer z.B. gelöscht werden) | ||
+ | |||
+ | ====== iptables Regeln zurücksetzen ====== | ||
+ | ===== 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 ^^^ target ^^ | ^ table ^ command ^ chain ^ rule-specification ^^^ target ^^ | ||
| -t filter | -A | INPUT | -s | | | -j | ACCEPT | | | -t filter | -A | INPUT | -s | | | -j | ACCEPT | | ||
Zeile 19: | Zeile 37: | ||
)) | )) | ||
- | ====== iptables beobachten ====== | + | ====== Einbindung von iptables in den Bootvorgang ====== |
- | watch -d iptables -L -n -v --line-numbers | + | ===== CentOS (bis 6) ===== |
- | + | Paket: iptables-services | |
- | * -L = List (auflisten) | + | |
- | * -n = no DNS-lookup | + | |
- | * -v = verbose (gesprächig) | + | |
- | * --line-numbers = Regeln Nummerieren (einzelne Regeln können anhand der Nummer z.B. gelöscht werden) | + | |
- | ====== 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 ====== | ||
- | ===== CentOS ===== | ||
/etc/init.d/iptables save | /etc/init.d/iptables save | ||
speichert die aktuell aktiven iptables-Regeln in der Datei ''/etc/sysconfig/iptables''. Beim Booten werden sie hier wieder ausgelesen. | speichert die aktuell aktiven iptables-Regeln in der Datei ''/etc/sysconfig/iptables''. Beim Booten werden sie hier wieder ausgelesen. | ||
+ | |||
+ | ===== CentOS (ab 7) ===== | ||
+ | wie SuSE, oder ''firewalld'' nutzen | ||
+ | |||
===== 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: | ||
+ | ''/etc/network/interfaces'' : | ||
+ | <file> | ||
+ | auto eth0 | ||
+ | iface eth0 inet dhcp | ||
+ | up sh -c 'iptables-restore < /etc/iptables' | ||
+ | </file> | ||
====== Einfacher Paketfilter mit NAT ====== | ====== Einfacher Paketfilter mit NAT ====== | ||
Zeile 181: | Zeile 195: | ||
* http://www.frozentux.net/iptables-tutorial/iptables-tutorial.html | * http://www.frozentux.net/iptables-tutorial/iptables-tutorial.html | ||
- | ===== iptables und dhcp ===== | + | |
- | * http://www.faveve.uni-stuttgart.de/it/auth/dhcp.php | + | |
===== iptables und ssh ===== | ===== iptables und ssh ===== | ||
* http://www.debian-administration.org/articles/187 , aber: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=332231 | * http://www.debian-administration.org/articles/187 , aber: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=332231 | ||