mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-04-22 06:22:07 +02:00
iptables, nft: add masquerade example (#6979)
This commit is contained in:
parent
a51f7f6ce1
commit
15c9047cb8
2 changed files with 8 additions and 0 deletions
|
@ -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}}`
|
||||
|
|
|
@ -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}}`
|
||||
|
|
Loading…
Add table
Reference in a new issue