LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

nftables

modern Linux firewall framework replacing iptables

TLDR

List all rules
$ sudo nft list ruleset
copy
Add table
$ sudo nft add table inet [filter]
copy
Add chain
$ sudo nft add chain inet [filter] [input] '{ type filter hook input priority 0; }'
copy
Add rule
$ sudo nft add rule inet [filter] [input] tcp dport [22] accept
copy
Delete rule
$ sudo nft delete rule inet [filter] [input] handle [5]
copy
Load rules from file
$ sudo nft -f [/etc/nftables.conf]
copy
Flush all rules
$ sudo nft flush ruleset
copy

SYNOPSIS

nft [options] [commands]

DESCRIPTION

nftables is the modern Linux firewall framework replacing iptables. It provides a single unified interface for IPv4, IPv6, ARP, and bridge filtering.nftables uses a new syntax and improves on iptables performance and functionality.

PARAMETERS

list

List objects.
add
Add object.
delete
Delete object.
flush
Flush objects.
-f file
Read commands from file.
-i
Interactive mode.
-n
Numeric output.

RULE EXAMPLE

$ table inet filter {
    chain input {
        type filter hook input priority 0;
        ct state established,related accept
        tcp dport 22 accept
        tcp dport 80 accept
        drop
    }
}
copy

INSTALL

sudo dnf install nftables
copy
sudo pacman -S nftables
copy
sudo zypper install nftables
copy
brew install nftables
copy
nix profile install nixpkgs#nftables
copy

CAVEATS

Different syntax from iptables. Replaces iptables, ip6tables, arptables, ebtables. Requires kernel support.

HISTORY

nftables was developed by the Netfilter project, authored primarily by Patrick McHardy and Pablo Neira Ayuso, released in Linux kernel 3.13 (2014).

SEE ALSO

iptables(8), firewalld(1), ufw(8)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid