iptables 使用小記

技術筆記

iptables

參考

  • iptables [-t table] command CHAIN [NUM] match criteria -j ACTION
  • CHAIN
    • -N: (new) new a chain
    • -X: delete chain
    • -F: flush all chain
    • -Z: zero the pkg counter
    • -P: policy of chain
    • -E: rename
  • rule
    • -A: append rule
    • -I: insert rule to number
    • -R: replace
    • -D: delete
  • LIST
    • -L: list
    • -S: Specification
    • -n: user number to show
    • -v: verbose
    • -x: show msg
    • –line number: show line number

DST-NAT

sudo sysctl net.ipv4.ip_forward=1
sudo iptables -t nat -A PREROUTING -j DNAT -p tcp --to-destination 192.168.15.254:80 -i ens19

comments powered by Disqus

Related