iptables-reset.bash 637 B

12345678910111213141516171819202122232425
  1. #!/bin/bash
  2. ## Reset iptables rules
  3. ## Kopied from http://ubuntuforums.org/showthread.php?t=1381516
  4. ## And from http://pikt.org/pikt/samples/iptables_reset_programs.cfg.html
  5. ## Modified
  6. sudo ip6tables --policy INPUT ACCEPT
  7. sudo ip6tables --policy OUTPUT ACCEPT
  8. sudo ip6tables --policy FORWARD ACCEPT
  9. sudo iptables --policy INPUT ACCEPT
  10. sudo iptables --policy OUTPUT ACCEPT
  11. sudo iptables --policy FORWARD ACCEPT
  12. for TABLE in filter nat mangle
  13. do
  14. sudo iptables -t ${TABLE} -F
  15. sudo iptables -t ${TABLE} -X
  16. sudo iptables -t ${TABLE} -Z
  17. sudo ip6tables -t ${TABLE} -Z
  18. sudo ip6tables -t ${TABLE} -F
  19. sudo ip6tables -t ${TABLE} -X
  20. done