How do I flush all IPv4 and IPv6 iptables rules under Ubuntu Linux?
To see your current rules in iptables (IPv4), enter:
$ sudo iptables -L
To see your current rules in ip6tables (IPv6), enter:
$ sudo ip6tables -L
How Do I Disable (flush) IPv4 Firewall?
If you need to disable the firewall, you can flush all the rules using the following command:
$ sudo iptables -F
Create a shell script as follows (say /root/stop.fw) :
#!/bin/sh echo "Stopping firewall and allowing everyone..." 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
Run it as follows:
$ sudo chmod +x /root/stop.fw
$ sudo /root/stop.fw
$ sudo iptables -L
How Do I Disable (flush) IPv6 Firewall?
If you need to disable the firewall, you can flush all the rules using the following command:
$ sudo ip6tables -F
Create a shell script as follows (say /root/stop6.fw) :
#!/bin/sh IPT6="/sbin/ip6tables" echo "Stopping IPv6 firewall..." $IPT6 -F $IPT6 -X $IPT6 -Z for table in $(</proc/net/ip6_tables_names) do $IPT6 -t $table -F $IPT6 -t $table -X $IPT6 -t $table -Z done $IPT6 -P INPUT ACCEPT $IPT6 -P OUTPUT ACCEPT $IPT6 -P FORWARD ACCEPT
Run it as follows:
$ sudo chmod +x /root/stop6.fw
$ sudo /root/stop6.fw
$ sudo ip6tables -L
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop














{ 0 comments… add one now }