Last active
September 7, 2022 12:05
-
-
Save gustavorv86/70145c63953256ea82c89a254f948428 to your computer and use it in GitHub Desktop.
Default iptables configuration.
This file contains hidden or 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 | |
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT | |
iptables -A INPUT -i lo -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT | |
iptables -P INPUT DROP | |
iptables -P FORWARD DROP | |
iptables -P OUTPUT ACCEPT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Apply configuration
$ sudo source iptables.conf
Persistent
Install iptables-persistent:
$ sudo apt install iptables-persistent
Save rules:
$ sudo iptables-save > /etc/iptables/rules.v4
Show log real-time
tail -f /var/log/messages | grep -F "FW:"