mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-04-23 21:22:09 +02:00
27 lines
664 B
Markdown
27 lines
664 B
Markdown
# iptables
|
|
|
|
> Program that allows configuration of tables, chains and rules provided by the Linux kernel firewall.
|
|
|
|
- See chains and rules for specific table:
|
|
|
|
`sudo iptables -t {{table_name}} -vnL`
|
|
|
|
- Set chain policy rule:
|
|
|
|
`sudo iptables -P {{chain}} {{rule}}`
|
|
|
|
- Append rule to chain policy for IP:
|
|
|
|
`sudo iptables -A {{chain}} -s {{ip}} -j {{rule}}`
|
|
|
|
- Append rule to chain policy for IP considering protocol and port:
|
|
|
|
`sudo iptables -A {{chain}} -s {{ip}} -p {{protocol}} --dport {{port}} -j {{rule}}`
|
|
|
|
- Delete chain rule:
|
|
|
|
`sudo iptables -D {{chain}} {{rule_line_number}}`
|
|
|
|
- Save iptables configuration:
|
|
|
|
`sudo iptables-save > {{path/to/iptables_file}}`
|