Uživatelské nástroje

Nástroje pro tento web


iptables

Rozdíly

Zde můžete vidět rozdíly mezi vybranou verzí a aktuální verzí dané stránky.

Odkaz na výstup diff

Obě strany předchozí revizePředchozí verze
Následující verze
Předchozí verze
iptables [2021/11/14 19:32] uranusakiptables [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
   nano /etc/nftables.conf   nano /etc/nftables.conf
  
-Vytvoření tabulky pravidel+Načtení a uložení config souboru. Všechny změny se provádí pouze v paměti bez uložení do souboru, po restartu zmizí.
   nft -f /etc/nftables.conf    nft -f /etc/nftables.conf 
 +  nft list ruleset > /etc/nftables.conf
 +
 +===== Tabulky =====
  
 Výpis všech pravidel. Výpis všech pravidel.
   nft list ruleset   nft list ruleset
      
-Výpis určité tabulky. Typy tabulek ip, ip6, inet, arp a bridge.   +Seznam tabulek 
-  nft list table inet filter+  nft list tables
      
 +Přidat tabulku. Typy tabulek ip, ip6, inet (ip i ip6), arp a bridge.
 +  nft add table ip nazev
 +  
 +Smazat tabulku
 +  nft delete table inet nazev
 +  
 +Výpis určité tabulky.  
 +  nft list table inet nazev
  
-íklady nastavení pravidel+===== Řetězce ===== 
-  nft add rule inet filter output ip daddr x.x.x.x reject +   
-  nft add rule inet filter output ip6 daddr x:x::reject+Vytvoření/smazání nového řetězce (regular/base) 
 +  nft add chain inet filter webfilter 
 +  nft delete chain inet filter webfilter 
 +  
 +  nft add chain inet filter inputchain '{ type filter hook input priority 0; }' 
 + 
 +===== Pravidla ===== 
 + 
 +idat nové pravidlo
 +  nft add rule inet nazev_tabulky output ip daddr x.x.x.x reject 
 +  nft add rule inet nazev_tabulky ip6 daddr x:x::drop
      
   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 - /etc/nftables.conf>
 +
 +flush ruleset
 +
 +table inet filter {
 +        chain input {
 +                type filter hook input priority 0; policy drop;
 +                ct state established,related accept
 +                iifname "lo" accept
 +                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;
 +        }
 +}
 +
 +</file>
 ====== iptables ====== ====== iptables ======
 [[https://wiki.debian.org/DebianFirewall]]\\ [[https://wiki.debian.org/DebianFirewall]]\\
iptables.1636914777.txt.gz · Poslední úprava: 2021/11/14 19:32 autor: uranusak

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki