iptables
Rozdíly
Zde můžete vidět rozdíly mezi vybranou verzí a aktuální verzí dané stránky.
Obě strany předchozí revizePředchozí verzeNásledující verze | Předchozí verze | ||
iptables [2021/11/14 22:44] – uranusak | iptables [2021/11/15 22:54] (aktuální) – [Jednoduchý firewall] uranusak | ||
---|---|---|---|
Řádek 1: | Řádek 1: | ||
====== nftables ====== | ====== nftables ====== | ||
+ | |||
+ | Aktivace nftables při startu | ||
+ | systemctl enable nftables.service | ||
Konfigurační soubor | Konfigurační soubor | ||
Řádek 15: | Řádek 18: | ||
Seznam tabulek | Seznam tabulek | ||
nft list tables | nft list tables | ||
+ | | ||
+ | Přidat tabulku. Typy tabulek ip, ip6, inet (ip i ip6), arp a bridge. | ||
+ | nft add table ip nazev | ||
| | ||
Smazat tabulku | Smazat tabulku | ||
- | nft delete table inet filter | + | nft delete table inet nazev |
| | ||
- | Výpis určité tabulky. Typy tabulek ip, ip6, inet (ip i ip6), arp a bridge. | + | Výpis určité tabulky. |
- | nft list table inet filter | + | nft list table inet nazev |
- | + | ||
- | + | ||
- | Vysypání řetězců z tabulky | + | |
- | nft flush table inet filter | + | |
===== Řetězce ===== | ===== Řetězce ===== | ||
| | ||
- | Vytvoření nového řetězce (regular/ | + | Vytvoření/ |
nft add chain inet filter webfilter | nft add chain inet filter webfilter | ||
+ | nft delete chain inet filter webfilter | ||
+ | |||
nft add chain inet filter inputchain '{ type filter hook input priority 0; }' | nft add chain inet filter inputchain '{ type filter hook input priority 0; }' | ||
- | Příklady nastavení řetězců. | + | ===== Pravidla ===== |
- | nft add rule inet filter | + | |
- | nft add rule inet filter output | + | Přidat nové pravidlo. |
+ | nft add rule inet nazev_tabulky | ||
+ | nft add rule inet nazev_tabulky | ||
| | ||
nft add rule inet filter output ip daddr 8.8.8.8 counter | nft add rule inet filter output ip daddr 8.8.8.8 counter | ||
+ | ===== Jednoduchý firewall ===== | ||
+ | |||
+ | <file - / | ||
+ | |||
+ | flush ruleset | ||
+ | |||
+ | table inet filter { | ||
+ | chain input { | ||
+ | type filter hook input priority 0; policy drop; | ||
+ | ct state established, | ||
+ | iifname " | ||
+ | icmp type echo-request accept | ||
+ | } | ||
+ | |||
+ | chain forward { | ||
+ | type filter hook forward priority 0; policy drop; | ||
+ | } | ||
+ | |||
+ | chain output { | ||
+ | type filter hook output priority 0; policy accept; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | </ | ||
====== iptables ====== | ====== iptables ====== | ||
[[https:// | [[https:// |
iptables.1636926279.txt.gz · Poslední úprava: 2021/11/14 22:44 autor: uranusak