Created
June 16, 2017 14:57
-
-
Save MattMcMurray/3051ffd389e18dbddbe52330cc83070c to your computer and use it in GitHub Desktop.
Reset iptables
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/bash | |
# https://www.digitalocean.com/community/tutorials/how-to-list-and-delete-iptables-firewall-rules | |
# First, set the default policies for each of the built-in chains to ACCEPT. | |
# The main reason to do this is to ensure that you won't be locked out from your server via SSH: | |
sudo iptables -P INPUT ACCEPT | |
sudo iptables -P FORWARD ACCEPT | |
sudo iptables -P OUTPUT ACCEPT | |
# Then flush the nat and mangle tables, flush all chains (-F), and delete all non-default chains (-X): | |
sudo iptables -t nat -F | |
sudo iptables -t mangle -F | |
sudo iptables -F | |
sudo iptables -X |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment