You can use iptables( for more info see the manual page of iptables)
"sudo iptables -F" //execute it as a super user,
Or
"sudo ufw disable" //it do the work for you.
you can also check before disabling it, i.e firewall is active or inactive.
"sudo ufw status"
To use this you have to install "ufw" first, using
$ sudo apt-get install ufw