Firewalls schützen Systeme vor unerwünschtem Netzwerkzugriff. Unter Linux gibt es verschiedene Tools und Frameworks.
Jedes Tool hat eigene Stärken und Einsatzzwecke – Details auf den jeweiligen Unterseiten.
nftables ist der moderne Kernel-Framework, der iptables als Backend ersetzt. Sowohl firewalld als auch ufw können nftables als Backend nutzen:
Architektur-Übersicht:
┌───────────────────────────────────┐ │ Benutzer-Tools (Frontend) │ │ ┌──────────┐ ┌──────────┐ │ │ │firewalld │ │ ufw │ │ │ └─────┬────┘ └─────┬────┘ │ │ │ │ │ │ └────────┬───────┘ │ │ ▼ │ │ ┌───────────────────────────┐ │ │ │ Backend-Auswahl │ │ │ │ • iptables-nft (nftables)│ │ │ │ • iptables-legacy │ │ │ └──────────┬────────────────┘ │ │ ▼ │ │ ┌───────────────────────────┐ │ │ │ netfilter (Kernel) │ │ │ │ • nf_tables Module │ │ │ │ • ip_tables Module │ │ │ └───────────────────────────┘ │ └───────────────────────────────────┘
firewalld kann sowohl iptables als auch nftables als Backend nutzen:
# Backend prüfen sudo firewall-cmd --get-backend # Mögliche Backends: # - nftables (Standard ab RHEL 9 / Fedora 32+) # - iptables (Legacy) # Backend in /etc/firewalld/firewalld.conf ändern: # FirewallBackend=nftables # FirewallBackend=iptables
Vorteile von nftables-Backend:
Migration:
ufw nutzt traditionell iptables als Backend, kann aber auch auf iptables-nft umgestellt werden:
# Prüfen welches Backend aktiv ist sudo update-alternatives --display iptables # Auf nftables-Backend umstellen (Ubuntu 20.04+) sudo update-alternatives --set iptables /usr/sbin/iptables-nft sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-nft # ufw nutzt dann automatisch nftables über iptables-Kompatibilitäts-Layer sudo ufw reload
iptables-nft Kompatibilitäts-Layer:
iptables-nft übersetzt iptables-Befehle in nftables-RegelnHinweis: Ab Ubuntu 22.04 ist iptables-nft das Standard-Backend.
WICHTIG: Verschiedene Firewall-Tools sollten nicht gleichzeitig verwendet werden!
# Konflikte vermeiden: # Wenn firewalld aktiv: sudo systemctl stop ufw sudo systemctl disable ufw # Wenn ufw aktiv: sudo systemctl stop firewalld sudo systemctl disable firewalld # Direkter nftables-Zugriff (nur wenn kein anderes Tool aktiv): sudo nft list ruleset
Warum Konflikte entstehen:
Best Practice:
ufw (Desktop/einfache Server)firewalld (Enterprise/komplexe Setups)nftables (Experten)| Tool | Backend | Einsatz | Einfachheit |
ufw | iptables/iptables-nft | Desktop, einfache Server | ★★★★★ Sehr einfach |
firewalld | iptables/nftables | Enterprise, RHEL/Fedora | ★★★☆☆ Mittel |
nftables | Direkt (Kernel) | Experten, Scripts | ★★☆☆☆ Komplex |
iptables | iptables (Legacy) | Alt-Systeme (deprecated) | ★★☆☆☆ Komplex |
Migrationspfad: