Linux/iptables: Difference between revisions
Appearance
< Linux
m →Links |
m →Basics |
||
| Line 81: | Line 81: | ||
-I (insert - add at position) | -I (insert - add at position) | ||
-L (list - show all rules in chain) -p (protocol (tcp/udp)) | -L (list - show all rules in chain) -p (protocol (tcp/udp)) | ||
-N (new chain) --dport (port) | -N (new chain) --dport (destination port) | ||
-X (delete chain) | -X (delete chain) --sport (source port) | ||
-t (table to manipulate (default: filter) | -t (table to manipulate (default: filter) | ||
Revision as of 18:40, 4 December 2023
|
|
|---|
Basics
iptables
-A (append - add rule at end) -i (input interface) -j (target)
-C (check) -o (output interface)
-D (delete - remove rule) -s (source address)
-F (flush - remove all rules) -d (destination address)
-I (insert - add at position)
-L (list - show all rules in chain) -p (protocol (tcp/udp))
-N (new chain) --dport (destination port)
-X (delete chain) --sport (source port)
-t (table to manipulate (default: filter)
-n (numeric output of addresses and ports)
View state
iptables-save # show everything iptables --list-rules # list filter rules (default: filter) iptables --list-rules -t nat # list nat rules
raspi wifi to ethernet
- rc.local
- iptables --table nat --append POSTROUTING --out-interface wlan0 -j MASQUERADE
- iptables --append FORWARD --in-interface eth0 -j ACCEPT