Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save shaposhnikoff/e433cafb170d8c06c2c8e6c20ae8694a to your computer and use it in GitHub Desktop.
Save shaposhnikoff/e433cafb170d8c06c2c8e6c20ae8694a to your computer and use it in GitHub Desktop.
pi-star preparation to normal work
#!/bin/bash
# Flush all rules
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -t raw -F
iptables -t raw -X
# Set default policies to accept
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
# Save the flushed rules
iptables-save > /etc/iptables/rules.v4
# Unload netfilter modules
modprobe -r iptable_filter
modprobe -r iptable_nat
modprobe -r iptable_mangle
modprobe -r iptable_raw
modprobe -r nf_conntrack
modprobe -r nf_conntrack_ipv4
modprobe -r x_tables
echo "Iptables flushed and disabled. Modules unloaded."
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment