Skip to content

Latest commit

 

History

History
96 lines (76 loc) · 3.96 KB

itables-nftables.md

File metadata and controls

96 lines (76 loc) · 3.96 KB

Iptables & nftables

https://serverfault.com/questions/451104/how-do-you-test-iptables-rules-to-prevent-remote-lockout-and-check-matches/519430

Tables

Below are the names of the tables that rules are associated with. On web services you will typically only interact with the filter table.

List tables
ls /lib/modules/$(uname -r)/kernel/net/ipv4/netfilter | grep -Po '(?<=iptable_)[a-z]+'

  • filter
  • nat
  • mangle
  • raw
  • security (SeLinux)

Rules

List all the rules
sudo iptables -nvL --line-numbers

Show rules
sudo iptables -S

Really show everything
sudo iptables-save

Modules & Extensions

http://ipset.netfilter.org/iptables-extensions.man.html

List Extensions etc
sudo ls /lib/modules/$(uname -r)/kernel/net/netfilter/

List modules
sudo ls /lib/modules/$(uname -r)/kernel/net/netfilter/xt_* | grep -oP '(?<=xt_)([a-z]+)'

Find directory of modules
ls $(iptables -m xyz -h 2>&1 | grep -oP '(?<=:)([a-z0-9\/_\-\.]+)' | xargs dirname)

Get Help on module
iptables -m conntrack -h
iptables -m hashlimit -h 2>&1 | awk '/match options:$/,0'

Accounting & Quotas

Throttling, Rate Limiting

NFQUEUE

Many IPS depeond on NFQUEUE to pass packet handling to themselves!

Custom Chains

Links

nftables