mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-06-05 13:26:01 +02:00
nft: add page (#1932)
This commit is contained in:
parent
d08d8603ec
commit
41e691a12b
1 changed files with 32 additions and 0 deletions
32
pages/linux/nft.md
Normal file
32
pages/linux/nft.md
Normal file
|
@ -0,0 +1,32 @@
|
|||
# nft
|
||||
|
||||
> Allows configuration of tables, chains and rules provided by the Linux kernel firewall.
|
||||
> Nftables replaces iptables.
|
||||
|
||||
- View current configuration:
|
||||
|
||||
`sudo nft list ruleset`
|
||||
|
||||
- Add a new table with family "inet" and table "filter":
|
||||
|
||||
`sudo nft add table {{inet}} {{filter}}`
|
||||
|
||||
- Add a new chain to accept all inbound traffic:
|
||||
|
||||
`sudo nft add chain {{inet}} {{filter}} {{input}} \{ type {{filter}} hook {{input}} priority {{0}} \; policy {{accept}} \}`
|
||||
|
||||
- Add a new rule to accept several TCP ports:
|
||||
|
||||
`sudo nft add rule {{inet}} {{filter}} {{input}} {{tcp}} {{dport \{ telnet, ssh, http, https \} accept}}`
|
||||
|
||||
- Show rule handles:
|
||||
|
||||
`sudo nft --handle --numeric list chain {{family}} {{table}} {{chain}}`
|
||||
|
||||
- Delete a rule:
|
||||
|
||||
`sudo nft delete rule {{inet}} {{filter}} {{input}} handle {{3}}`
|
||||
|
||||
- Save current configuration:
|
||||
|
||||
`sudo nft list ruleset > {{/etc/nftables.conf}}`
|
Loading…
Add table
Reference in a new issue