Skip to content

Instantly share code, notes, and snippets.

@HugoPoi
Created March 15, 2018 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HugoPoi/f1ffd2a02a6f8567734dd37b4abbcf1a to your computer and use it in GitHub Desktop.
Save HugoPoi/f1ffd2a02a6f8567734dd37b4abbcf1a to your computer and use it in GitHub Desktop.
Iptables reset policies
#!/bin/sh
IPTABLES="$(which iptables)"
# RESET DEFAULT POLICIES
$IPTABLES -P INPUT ACCEPT
$IPTABLES -P FORWARD ACCEPT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -t nat -P PREROUTING ACCEPT
$IPTABLES -t nat -P POSTROUTING ACCEPT
$IPTABLES -t nat -P OUTPUT ACCEPT
$IPTABLES -t mangle -P PREROUTING ACCEPT
$IPTABLES -t mangle -P OUTPUT ACCEPT
# FLUSH ALL RULES, ERASE NON-DEFAULT CHAINS
$IPTABLES -F
$IPTABLES -X
$IPTABLES -t nat -F
$IPTABLES -t nat -X
$IPTABLES -t mangle -F
$IPTABLES -t mangle -X
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment