29
Oct/08
1

Linux: Reset iptables firewall rules

Create a shell script (iptables_flush.sh) and copy paste the following lines:

#!/bin/sh
echo "Flushing iptables rules..."
sleep 1
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT

Make the file executable

chmod +x iptables_flush.sh

and run the script:

./iptables_flush.sh

Related posts:

  1. Linux: Mount remote Windows shares with smbfs
  2. Linux: vsftpd and symbolic links
  3. Linux: Apache Tomcat tips and tricks
  4. OpenSuSE: Disable firewall completely

Comments (1) Trackbacks (0)
  1. Wladimir Tavares
    10:27 AM on August 10th, 2011
    Google Chrome 13.0.782.112 Google Chrome 13.0.782.112 Windows XP Windows XP
    Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.112 Safari/535.1

    There rules will lock down the machine and if you are connecting from a remote ssh session you wont connect.

    I’d recommend these rules

    # iptables -P INPUT ACCEPT
    # iptables -F
    # iptables -A INPUT -i lo -j ACCEPT
    # iptables -A INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT
    # iptables -A INPUT -p tcp –dport 22 -j ACCEPT
    # iptables -P INPUT DROP
    # iptables -P FORWARD DROP
    # iptables -P OUTPUT ACCEPT
    # iptables -L -v

Leave a comment

No trackbacks yet.