Last active
September 20, 2019 12:17
-
-
Save majidalavizadeh/2de872755ec254fbbe88d56853343a6c to your computer and use it in GitHub Desktop.
Flush and remove all iptables rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo "Stopping firewall and allowing everyone..." | |
ipt="/sbin/iptables" | |
## Failsafe - die if /sbin/iptables not found | |
[ ! -x "$ipt" ] && { echo "$0: \"${ipt}\" command not found."; exit 1; } | |
$ipt -P INPUT ACCEPT | |
$ipt -P FORWARD ACCEPT | |
$ipt -P OUTPUT ACCEPT | |
$ipt -F | |
$ipt -X | |
$ipt -t nat -F | |
$ipt -t nat -X | |
$ipt -t mangle -F | |
$ipt -t mangle -X | |
$ipt iptables -t raw -F | |
$ipt -t raw -X | |
# this script copied from: | |
# https://www.cyberciti.biz/tips/linux-iptables-how-to-flush-all-rules.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chmod +x ./fw.stop | |
./fw.stop | |
# Verify the iptables flushed | |
iptables -L -n -v |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment