Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
gentoo:nft [2025/02/05 14:38] – created willy | gentoo:nft [2025/03/13 13:26] (current) – [NFTtables] willy | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== NFTtables ====== | + | ====== |
Linux has very advanced and powerful low-level networking management capabilities. Historically, | Linux has very advanced and powerful low-level networking management capabilities. Historically, | ||
Line 50: | Line 50: | ||
A quick cheatsheet: | A quick cheatsheet: | ||
< | < | ||
- | nft list tables # list all tables | + | nft -a 'list tables' |
- | nft add table ip myTable # create a new table | + | nft 'add table ip myTable' |
- | nft list table myTable # list chains and rules in myTable | + | nft -a 'list table myTable' |
- | nft delete table myTable # delete a table | + | nft 'delete table myTable' |
</ | </ | ||
Line 84: | Line 84: | ||
To delete chains: | To delete chains: | ||
<code bash> | <code bash> | ||
- | nft delete chain ip myTable myChain | + | nft 'delete chain ip myTable myChain' |
</ | </ | ||
Line 95: | Line 95: | ||
To list rules: | To list rules: | ||
<code bash> | <code bash> | ||
- | nft -a list table myTable # by table | + | nft -a 'list table myTable' |
- | nft -a list chain myTable mychain # by chain in table | + | nft -a 'list chain myTable mychain' |
</ | </ | ||
Line 142: | Line 142: | ||
- | |||
- | |||
- | nft list tables | ||
- | nft add table ip wg | ||
- | nft -- add chain ip wg prerouting { type nat hook prerouting priority -100 \; } | ||
- | nft add chain ip wg postrouting { type nat hook postrouting priority 100 \; } | ||
- | nft add rule ip wg prerouting tcp dport 2022 dnat to 10.70.0.1 dport 22 | ||
- | nft add rule ip wg prerouting tcp dport 22 dnat to 10.70.0.1 | ||
- | nft add rule ip wg postrouting ip daddr 10.70.0.1 masquerade | ||
- | | ||
- | nft add ip wg prerouting 'dnat to tcp dport map { 2022 : 10.70.0.1 . 22 }' | ||