Skip to content

Instantly share code, notes, and snippets.

@jakoberpf
Last active December 16, 2021 09:54
Show Gist options
  • Save jakoberpf/7cd4a3af1f331f755c22bc67d972e0ab to your computer and use it in GitHub Desktop.
Save jakoberpf/7cd4a3af1f331f755c22bc67d972e0ab to your computer and use it in GitHub Desktop.

iptables cheatsheet

Show iptables rules

This will show the now current state of iptables

iptables -S

This will show all current iptable rules

iptables -L -v -n | more

Delete iptables rules

This will list all iptables rules with line numbers

iptables -L --line-numbers

This will delete the rule on line X

iptables -D INPUT X

Reset iptables

This will set the iptables standarts

iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT

This will clear all empty (-F) and non standart rules (-X).

iptables -t nat -F
iptables -t mangle -F
iptables -F
iptables -X
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment