If you are trying to disable the firewall, but lose Internet connection in the process, use this script:
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
Source: https://help.ubuntu.com/community/IptablesHowTo#Disabling%20the%20firewall