iptables, nft: add masquerade example (#6979)

feature/windows-fix-syntax-2
Richard Mörbitz 2021-11-05 00:36:44 +01:00 committed by GitHub
parent a51f7f6ce1
commit 15c9047cb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -19,6 +19,10 @@
`sudo iptables -A {{chain}} -s {{ip}} -p {{protocol}} --dport {{port}} -j {{rule}}`
- Add a NAT rule to translate all traffic from the `192.168.0.0/24` subnet to the host's public IP:
`sudo iptables -t {{nat}} -A {{POSTROUTING}} -s {{192.168.0.0/24}} -j {{MASQUERADE}}`
- Delete chain rule:
`sudo iptables -D {{chain}} {{rule_line_number}}`

View File

@ -20,6 +20,10 @@
`sudo nft add rule {{inet}} {{filter}} {{input}} {{tcp}} {{dport \{ telnet, ssh, http, https \} accept}}`
- Add a NAT rule to translate all traffic from the `192.168.0.0/24` subnet to the host's public IP:
`sudo nft add rule {{nat}} {{postrouting}} ip saddr {{192.168.0.0/24}} {{masquerade}}`
- Show rule handles:
`sudo nft --handle --numeric list chain {{family}} {{table}} {{chain}}`